Hi

I'm trying to write a template for source code for our wiki
(octave.org/wiki/) and am facing some problems. The idea is to have a
template that would work like:

{{Code|multiline
code goes
here
}}

and highlight it using the SyntaxHighlight GeSHi extension. I have
managed to do this with #tag so it looks like

{{#tag:syntaxhighlight|{{{1}}}|lang="octave"}}

However, code typically involves characters such as pipes and closing
curly brackets which mess up the template. I have tried to use <pre>
and <nowiki> around the actual code when using the template as in

{{Code|<nowki>some text</nowiki>}}

but that replaces the text by a weird string such as
" UNIQ17a021e41516d0ad-nowiki-00000001-QINU ". Same happens when using
<pre> (by the way, is this a bug on the {{#tag magic word?)

I expected that this would be a common thing and that I'd find many
templates already doing this but actually found none. The
recommendation on wikipedia is to use <syntaxhighlight> directly
(which I'd like to avoid since we want to change the default look of
it and are already using a template to place the code inside a table
with a title and legend). The alternatives that I see are:

  * use wikipedia's {{!}} template (it does solve my problem)
  * modify the actual extension code so it does all I want and use
that instead of a template

However, none of them sound right. Does anyone knows how to solve this?


Thanks in advance,
Carnë Draug

_______________________________________________
MediaWiki-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to