User:Charanguero/Mytopia

Contents

Bug in 2011 Template:Mutopia

I was making some notes to myself on how to use this template, but it trashed my wiki markup, like this:

  • Here are some examples of how Template:Mutopia can be used:
    • {{Mutopia}}
      • Publisher Information=Mutopia Project with no args simply links to the project home page
    • {{Mutopia|2201}}
      • Publisher Information=Mutopia Project while putting the item ID in the first arg links to that specific piece
    • {{Mutopia|2201|2018}}
      • Publisher Information=Mutopia Project, 2018 whatever you put in the second arg, e.g. the date, will be appended after a comma
    • {{Mutopia||2018}}
      • Publisher Information=Mutopia Project, 2018 omitting the first arg reverts the link to the home page but keeps the appended text

Problem is due to putting <noinclude> after a newline

Those double bullets and pre-formatted blocks (above) are a side effect of a newline from the template. Here's the template's code, with a <noinclude> clause as the last line:

<span class="plainlinks">[http://www.mutopiaproject.org/{{ #if: {{{1|}}} |cgibin/piece-info.cgi?id={{{1}}}| }} Mutopia Project{{ #if: {{{2|}}} |, {{{2}}}| }}]</span>
<noinclude>[[Category:External Links templates|m]]</noinclude>

Transclusion omits the <noinclude> but does include the trailing newline ahead of the <noinclude>, just like this:

<span class="plainlinks">[http://www.mutopiaproject.org/{{ #if: {{{1|}}} |cgibin/piece-info.cgi?id={{{1}}}| }} Mutopia Project{{ #if: {{{2|}}} |, {{{2}}}| }}]</span>

That trailing newline causes whatever text that follows the template invocation (including an innocent space) to appear at the start of the next line, where it can be misinterpreted as wiki markup (hence the innocent space begins a pre-formatted block).

Fixed in 2018 Template:Mytopia

Putting the <noinclude> on the same line as the <span> produces the expected output:

  • Here are some examples of how Template:Mytopia can be used:
    • {{Mytopia}}
      • Publisher Information=Mutopia Project with no args simply links to the project home page
    • {{Mytopia|2201}}
      • Publisher Information=Mutopia Project while putting the item ID in the first arg links to that specific piece
    • {{Mytopia|2201|2018}}
      • Publisher Information=Mutopia Project, 2018 whatever you put in the second arg, e.g. the date, will be appended after a comma
    • {{Mytopia||2018}}
      • Publisher Information=Mutopia Project, 2018 omitting the first arg reverts the link to the home page but keeps the appended text

Could be an issue for other templates with <noinclude> clauses

Admittedly, the {{Mutopia}} template is typically used only as an argument within a work page template, where the extra newline does no harm. But other templates that are intended to be used within ordinary wiki markup should be careful not to put a <noinclude> clause on a line by itself.

A Known Issue

A quick google suggests this sort of issue is a known headache: