Difference between revisions of "Template:Normalized pagename/doc"
Dinoguy1000 (talk | contribs) (create) (Tags: Mobile edit, Mobile web edit) |
Dinoguy1000 (talk | contribs) (update to account for the module implementation) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | ||
+ | {{Lua|Module:Normalized pagename}} | ||
+ | |||
{{tl|Normalized pagename}} is a template which [[wikipedia:Data normalization|normalizes]] a page's name, as returned by <code><nowiki>{{FULLPAGENAME}}</nowiki></code> and other [[mw:Special:MyLanguage/Help:Magic words#Page names|page name magic words]], by replacing [[wikipedia:Numeric character reference|numeric character references]] and [[wikipedia:List of XML and HTML character entity references|character entity references]] (collectively, "character references") with the actual character (for instance, <code>&quot;</code> is replaced with <code>"</code>). This is most often useful when using the [[mw:Special:MyLanguage/Help:Extension:ParserFunctions##ifeq|<code>#ifeq</code> parser function]] to compare the value of these magic words with values passed into a template via a parameter. | {{tl|Normalized pagename}} is a template which [[wikipedia:Data normalization|normalizes]] a page's name, as returned by <code><nowiki>{{FULLPAGENAME}}</nowiki></code> and other [[mw:Special:MyLanguage/Help:Magic words#Page names|page name magic words]], by replacing [[wikipedia:Numeric character reference|numeric character references]] and [[wikipedia:List of XML and HTML character entity references|character entity references]] (collectively, "character references") with the actual character (for instance, <code>&quot;</code> is replaced with <code>"</code>). This is most often useful when using the [[mw:Special:MyLanguage/Help:Extension:ParserFunctions##ifeq|<code>#ifeq</code> parser function]] to compare the value of these magic words with values passed into a template via a parameter. | ||
Line 7: | Line 9: | ||
== Technical details == | == Technical details == | ||
=== Characters in page names === | === Characters in page names === | ||
− | Several different characters may be replaced by <code><nowiki>{{FULLPAGENAME}}</nowiki></code> and related magic words. The replacements made for a particular title can be viewed using the code <code class="nowrap"><nowiki>{{ #tag: syntaxhighlight | {{PAGENAME:</nowiki>''Title''<nowiki>}} }}</nowiki></code>; for instance, for the title <code class="nowrap">"We'll Be There" - Rex & Weevil</code>, this code produces <span class="nowrap">{{ #tag: syntaxhighlight | {{PAGENAME:"We'll Be There" - Rex & Weevil}} | inline=yes }}</span>. | + | Several different characters may be replaced by <code><nowiki>{{FULLPAGENAME}}</nowiki></code> and related magic words. The replacements made for a particular title can be viewed using the code <code class="nowrap"><nowiki>{{ #tag: syntaxhighlight | {{PAGENAME:</nowiki>''Title''<nowiki>}} }}</nowiki></code>; for instance, for the title <code class="nowrap">"We'll Be There" - Rex & Weevil</code>, this code produces <span class="nowrap">{{ #tag: syntaxhighlight | {{PAGENAME:"We'll Be There" - Rex & Weevil}} | lang=html | inline=yes }}</span>. |
On this wiki, the following character replacements are made by <code><nowiki>{{FULLPAGENAME}}</nowiki></code> and related magic words. Note that because a lone period (<code>.</code>) is not output (it represents the [[wikipedia:Working directory|working directory]] in Unix-like systems and Microsoft Windows) and a leading colon (<code>:''foo''</code>) is stripped, they are prefixed by a capital "A"; the other characters are also prefixed for consistency. The asterisk (<code>*</code>) is also shown preceding the "A" since when it is the leading character (<code>*''foo''</code>), it gets replaced with a character reference. The characters <code class="nowrap"><nowiki>< > [ ] { | }</nowiki></code> are illegal in page titles in MediaWiki, and the character <code>#</code> introduces the [[wikipedia:Fragment identifier|fragment identifier]] in URLs, so these characters are not listed below (<code><nowiki>{{FULLPAGENAME}}</nowiki></code> and related magic words will strip these characters, or output nothing, when they are passed in). | On this wiki, the following character replacements are made by <code><nowiki>{{FULLPAGENAME}}</nowiki></code> and related magic words. Note that because a lone period (<code>.</code>) is not output (it represents the [[wikipedia:Working directory|working directory]] in Unix-like systems and Microsoft Windows) and a leading colon (<code>:''foo''</code>) is stripped, they are prefixed by a capital "A"; the other characters are also prefixed for consistency. The asterisk (<code>*</code>) is also shown preceding the "A" since when it is the leading character (<code>*''foo''</code>), it gets replaced with a character reference. The characters <code class="nowrap"><nowiki>< > [ ] { | }</nowiki></code> are illegal in page titles in MediaWiki, and the character <code>#</code> introduces the [[wikipedia:Fragment identifier|fragment identifier]] in URLs, so these characters are not listed below (<code><nowiki>{{FULLPAGENAME}}</nowiki></code> and related magic words will strip these characters, or output nothing, when they are passed in). | ||
Line 35: | Line 37: | ||
A` {{PAGENAME: A` }} | A` {{PAGENAME: A` }} | ||
A~ {{PAGENAME: A~ }} | A~ {{PAGENAME: A~ }} | ||
− | }} | + | | lang=html }} |
=== Replacements === | === Replacements === | ||
Line 56: | Line 58: | ||
| <code>&apos;</code> | | <code>&apos;</code> | ||
| <code>'</code> | | <code>'</code> | ||
+ | |- | ||
+ | | <code>&#42;</code> | ||
+ | | — | ||
+ | | <code>*</code> | ||
|- | |- | ||
| <code>&#59;</code> | | <code>&#59;</code> | ||
Line 66: | Line 72: | ||
|- | |- | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<includeonly> | <includeonly> |
Revision as of 21:41, 4 September 2018
This is a documentation subpage for Template:Normalized pagename. It contains usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
{{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. 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"
A$ A$
A% A%
A& A&
A' A'
A( A(
A) A)
A* A*
*A *A
A+ A+
A, A,
A. A.
A/ A/
A: A:
A; A;
A= A=
A? A?
A@ A@
A\ A\
A^ A^
A_ A
A` A`
A~ A~
Replacements
{{Normalized pagename}} performs the following replacements.
Numeric character reference | Character entity reference | Character |
---|---|---|
"
|
"
|
"
|
&
|
&
|
&
|
'
|
'
|
'
|
*
|
— | *
|
;
|
— | ;
|
=
|
— | =
|