In a custom wiki based on MediaWiki installation 1.29, I would like to include an example in a template page.
To include this example I want both to print the code of the template and to show it. So I need to write the text down two times: one surrounded by the <pre> tag to show the text and the other one in plain text to show the interpreted example.
In order the maintain the text once only, I thought about inserting the example in a subpage like this <pre>{{SomeTemplate|SomeParameter}}</pre> and transclude this text to show it in the instruction page.
So, for the code I simply transclude {{/subpage}} while for the actual template to be shown my plan was to replace <pre></pre> with an empty string using the #replace function from https://www.mediawiki.org/wiki/Extension:ParserFunctions .
The first part worked flawlessly, the second one I am unable to make it work. The code I use for the replacement is
{{#replace:{{#replace:{{/subpage}}|<nowiki><pre></nowiki>|}}|<nowiki></pre></nowiki>|}}
But this always returns an empty string. In fact, even the part
{{#replace:{{/subpage}}|<nowiki><pre></nowiki>|}}
returns the same empty string.
Interesting enough, even the code
{{#replace:<nowiki><pre>{{SomeTemplate|SomeParameter}}</pre></nowiki>|<nowiki><pre></nowiki>|}}
returns nothing.
Is my plan feasible and I am doing something wrong in the syntax, or is it conceptually wrong and never going to work?
Thanks
Luca
{{#tag:pre}}instead of<pre>work? - a stone arachnid{{#tag:pre}}unfortunately leads to the same result, apparently an empty string. - lucamauri