[Mediawiki-l] template parameters within preformatted blocks

Thomas Dalton thomas.dalton at gmail.com
Mon Jan 28 14:08:50 UTC 2008


On 28/01/2008, Frederik Dohr <fdg001 at gmx.net> wrote:
> Hello all,
>
> Is there a way to embed a template parameter within a PRE block?
>
> For example, I need a "File" template that is to be used like this:
>      {{File|file name|file contents}}
> The template source might look like this:
>      '''{{{1|sample file}}}'''
>      <pre>{{{2|sample contents}}}</pre>
>
> Unfortunately, the second parameter is never resolved, i.e. it shows up
> as literal "{{{2|sample contents}}}".
> I understand that's because PRE sections are not wikified.
>
> However, the file contents need to be contained within a PRE (or NOWIKI)
> block to prevent them from being wikified (e.g. "# comment" would be
> transformed into a numbered list otherwise).
>
> Do I have to rely on users wrapping the file contents into PRE tags?

Try replacing <pre> and </pre> with <pre<noinclude></noinclude>> and
</pre<noinclude></noinclude>>, that sometimes works with these kind of
things.



More information about the MediaWiki-l mailing list