Admin Forum:How to use nowiki in Templates?

I'm not at all happy with the way Wikia renders code. So I tried to create myself a template to use instead of the code-tag. Here's what my Template:Code looks like so far:

&lt;div style="border: 1px solid #998b7a; padding: 10px; background-color: white; color: black; font-family: "Courier New", Courier, monospace; font-style: normal; font-weight: normal; font-size: 14px; line-height: 18px; text-decoration: none; white-space: pre;"&gt;&lt;/div&gt;

And I would use it like this:

&lt;nowiki&gt;void main { doStuff; }&lt;nowiki&gt;

As you can see, I'm using the template and the nowiki-tag. What I would like to do is abstract this tag away into the template, so that I would only have to write this:

void main { doStuff; }

but all my attempts to transform the template failed miserably. Does anybody else haven an idea how to do that? Is that even possible? Should I try something completely different?

Pecoes 12:48, February 10, 2012 (UTC)
 * You cannot insert ECMAScript directly into a page, no matter the context. However, if you create a template page with  and add the following jQuery to MediaWiki:Common.js:

{C}it should work. Cheers! 21:07, February 10, 2012 (UTC)


 * Thanks, but I wasn't trying to insert ECMAScript. This isn't about active code at all. I want the code to be inserted as text with the formatting that's in the style-attribute of the surrounding div.


 * My problem is that the code may contain the characters "{", "}" and "|" and so I need to use nowiki-tags. But where? It's easy to use them in the code that calls the template, but what's the point of using a template in the first place, if it doesn't work without additional wiki-markup? So I want the nowiki-tags to be integrated into the template, but I can't figure out how...


 * Does that make my problem clearer?


 * Pecoes 21:25, February 10, 2012 (UTC)
 * Ah. You could create a page named Template:! then, with the content being a vertical bar, |, and make a similar for the curly brackets. This should fix it. 21:34, February 10, 2012 (UTC)


 * Er. Now you lost me. How would that fix it?


 * Pecoes 21:39, February 10, 2012 (UTC)
 * This way, if you transclude these templates, they will render as a vertical bar, left curly bracket or whatever is in them without breaking the template. 21:42, February 10, 2012 (UTC)


 * Wouldn't I have to somehow rewrite the code?


 * Pecoes 21:51, February 10, 2012 (UTC)

void main doStuff; or whatever the name is should work fine. 21:54, February 10, 2012 (UTC)