Template:ARTICLEROOTPAGENAME/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{dochead}}
{{dochead}}{{substitute}}
Returns the associated content namespace (e.g. "Template" if used on a page in the "Template" or "Template talk" namespace), followed by the root of the page name in namespaces where automatic subpages are enabled, or the page name without the namespace otherwise. It is equivalent to <code><nowiki>{{</nowiki>[[mw:Help:Magic words#Namespaces|ARTICLESPACE]]<nowiki>}}:{{</nowiki>[[mw:Help:Magic words#Namespaces|ROOTPAGENAME]]<nowiki>}}</nowiki></code>, with an additional <code><nowiki>{{</nowiki>[[mw:Help:Extension:ParserFunctions|#if:&nbsp;]]<nowiki>}}</nowiki></code> statement to avoid adding a colon on pages in the main (article) namespace.
<code>ARTICLEROOTPAGENAME</code> is a pseudo-magic word that returns the associated content namespace (e.g. "Template" if used on a page in the "Template" or "Template talk" namespace), followed by the root of the page name in namespaces where automatic subpages are enabled, or the page name without the namespace otherwise. It is equivalent to <code style="white-space: nowrap;">{{tlx|ARTICLESPACE|plaincode}}:{{tlx|ROOTPAGENAME|plaincode}}</code>, with an additional <code style="white-space: nowrap;"><nowiki>{{</nowiki>[[mw:Help:Extension:ParserFunctions|#if: ]]<nowiki>}}</nowiki></code> statement to avoid adding a colon on pages in the main (article) namespace (where it will return {{tlx|PAGENAME}} instead).


=== Examples ===
=== Options ===
{| class="wikitable"
; <code>wbr</code>
: Pass <code>yes</code>, <code>y</code>, <code>true</code>, <code>t</code>, <code>on</code>, or <code>1</code> to insert a zero-width space character ([https://www.compart.com/en/unicode/U+200B U+200B], <code>&amp;ZeroWidthSpace;</code>) after the namespace's colon, to allow for a line break.
 
=== Usage examples ===
The table below shows live usage examples.
 
{| class="wikitable" style="text-align: center;"
|-
|-
! Full page name !! Output
! Complete page title<br />(i.e.&nbsp;{{tl|FULLPAGENAME}}&#x202F;) !! Output of<br /><nowiki>{{ARTICLEROOTPAGENAME}}</nowiki>
|-
|-
| Template:ABC || rowspan="4" | Template:ABC
| Template:ABC || {{ARTICLEROOTPAGENAME|Template:ABC}}
|-
|-
| Template:ABC/DEF
| Template:ABC/DEF || {{ARTICLEROOTPAGENAME|Template:ABC/DEF}}
|-
|-
| Template talk:ABC
| Template talk:ABC || {{ARTICLEROOTPAGENAME|Template talk:ABC}}
|-
|-
| Template talk:ABC/DEF
| Template talk:ABC/DEF || {{ARTICLEROOTPAGENAME|Template talk:ABC/DEF}}
|-
|-
| ABC || rowspan="2" | ABC
| ABC || {{ARTICLEROOTPAGENAME|ABC}}
|-
|-
| Talk:ABC
| Talk:ABC || {{ARTICLEROOTPAGENAME|Talk:ABC}}
|-
|-
| ABC/DEF || rowspan="2" | ABC/DEF
| ABC/DEF || {{ARTICLEROOTPAGENAME|ABC/DEF}}
|-
|-
| Talk:ABC/DEF
| Talk:ABC/DEF || {{ARTICLEROOTPAGENAME|Talk:ABC/DEF}}
|}
|}

Latest revision as of 11:48, 2 July 2025

This template may be substituted.

ARTICLEROOTPAGENAME is a pseudo-magic word that returns the associated content namespace (e.g. "Template" if used on a page in the "Template" or "Template talk" namespace), followed by the root of the page name in namespaces where automatic subpages are enabled, or the page name without the namespace otherwise. It is equivalent to {{ARTICLESPACE}}:{{ROOTPAGENAME}}, with an additional {{#if: }} statement to avoid adding a colon on pages in the main (article) namespace (where it will return {{PAGENAME}} instead).

Options

wbr
Pass yes, y, true, t, on, or 1 to insert a zero-width space character (U+200B, &ZeroWidthSpace;) after the namespace's colon, to allow for a line break.

Usage examples

The table below shows live usage examples.

Complete page title
(i.e. {{FULLPAGENAME}} )
Output of
{{ARTICLEROOTPAGENAME}}
Template:ABC Template:ABC
Template:ABC/DEF Template:ABC
Template talk:ABC Template:ABC
Template talk:ABC/DEF Template:ABC
ABC ABC
Talk:ABC ABC
ABC/DEF ABC/DEF
Talk:ABC/DEF ABC/DEF