Template:Normalized pagename/doc

Jump to navigation Jump to search

{{Normalized pagename}} is a template which normalizes a page's name, as returned by {{FULLPAGENAME}} and other page name magic words, by replacing numeric character references and character entity references (collectively, "character references") with the actual character (for instance, " is replaced with "). This is most often useful when using the #ifeq parser function to compare the value of these magic words with values passed into a template via a parameter.

By default, {{Normalized pagename}} uses {{FULLPAGENAME}}, but it accepts an unnamed parameter allowing other values to be used, e.g. {{Normalized pagename|{{PAGENAME}}}}.

Technical details

Characters in page names

Several different characters may be replaced by {{FULLPAGENAME}} and related magic words. The replacements made for a particular title can be viewed using the code {{ #tag: syntaxhighlight | {{PAGENAME:Title}} }}; for instance, for the title "We'll Be There" - Rex & Weevil, this code produces "We'll Be There" - Rex & Weevil.

On this wiki, the following character replacements are made by {{FULLPAGENAME}} and related magic words. Note that because a lone period (.) is not output (it represents the working directory in Unix-like systems and Microsoft Windows) and a leading colon (:foo) is stripped, they are prefixed by a capital "A"; the other characters are also prefixed for consistency. The asterisk (*) is also shown preceding the "A" since when it is the leading character (*foo), it gets replaced with a character reference. Four hyphen-minuses (---- are also shown because the first hyphen-minus gets replaced with a character reference. The characters < > [ ] { | } are illegal in page titles in MediaWiki, and the character # introduces the fragment identifier in URLs, so these characters are not listed below ({{FULLPAGENAME}} and related magic words will strip these characters, or output nothing, when they are passed in).

A! A!
A" A&#34;
A$ A$
A% A%
A& A&#38;
A' A&#39;
A( A(
A) A)
A* A*
*A &#42;A
A+ A+
A, A,
A. A.
A/ A/
A: A:
A; A&#59;
A= A&#61;
A? A?
A@ A@
A\ A\
A^ A^
A_ A
A` A`
A~ A~
---- &#45;---

Replacements

{{Normalized pagename}} performs the following replacements.

Numeric character reference Character entity reference Character
&#34; &quot; "
&#38; &amp; &
&#39; &apos; '
&#42; *
&#45; -
&#59; ;
&#61; =