Escape template-breaking characters

επεξεργασία

There are some characters that, if used inside a template, will break its output: most frequently this happens with = (the equal sign) and | (the pipe sign).

The easiest and most effective solutions to this problem are:

  • Using numbered parameters like in:
Σημείωση: This method is effective only with = and is very useful with query strings in URLs, e.g. https://www.archlinux.org/?foo=bar

<pre<noinclude></noinclude>>{{Note|1=This method is effective only with = and is very useful with query strings in URLs, e.g. https://www.archlinux.org/?foo=bar}}</pre<noinclude></noinclude>>

  • Replacing the offending characters with their respective HTML entities, like in:
Σημείωση: This method supports all kinds of characters, including =, | and }} ( https://www.archlinux.org/?foo=bar )

<pre<noinclude></noinclude>>{{Note|This method supports all kinds of characters, including &#61;, &#124; and &#125;&#125; ( https://www.archlinux.org/?foo&#61;bar )}}</pre<noinclude></noinclude>>

  • Enclosing the offending characters in <nowiki> tags, like in:
Σημείωση: This method displays all kinds of characters ( = | }} ), but completely prevents the wiki engine from processing text markup, like links ( https://www.archlinux.org/ ) and other templates ( {{ic|foo}} ).

<pre<noinclude></noinclude>>{{Note|<nowiki>This method displays all kinds of characters ( = | }} ), but completely prevents the wiki engine from processing text markup, like links ( https://www.archlinux.org/ ) and other templates ( {{ic|foo}} ).</nowiki>}}</pre<noinclude></noinclude>>