1

Suppose I have a simple template Foo

The wikitext

 {{{1}}}

renders as

<blockquote>{{{2}}}</blockquote>

So including {{Foo|<nowiki>'''bold''' and ''italics''</nowiki>|'''bold''' and ''italics''}} in a page renders as

The wikitext

'''bold''' and ''italics''

renders as

bold and italics

Is there any way to reduce the duplication required to use template Foo? That is, either modify Foo or call it via another template in such a way that the user only needs to specify the desired wikitext once, instead of two times?

I don't really care if it would be as

{{DRYFoo|<nowiki>'''bold''' and ''italics''</nowiki>}}

or

{{FooDRY|'''bold''' and ''italics''}}

and I'd be satisfied by something that used subst: to expand something else into a normal call to Foo.

The rules for order of evaluation would seem to rule out FooDRY, and I've been unable to find a template/parser function that would re-expand wikitext to make DRYFoo work.

  • My current solution is to put the template argument in a separate page, and then use msgnw:, e.g. {{Foo|msgnw:FooArg|{{FooArg}}}} – rampion Oct 24 at 18:29
2
The wikitext

 {{{1}}}

renders as

<blockquote>{{#tag:nowiki|{{{2}}}}}</blockquote>

should do the job ({{#tag}} turns XML-style tags into normal parserfuncions, ie. flips the evaluation order).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.