Template:TemplateData header: Difference between revisions
en>SUM1 (Added "based" parameter to other transclusion) |
Mediawiki>Kaganer (PAGELANGUAGE) |
||
Line 1: | Line 1: | ||
<div class="templatedata-header">{{#if:{{{ | <noinclude> | ||
<languages/> | |||
-->{{ | <onlyinclude>{{#switch:<translate></translate> | ||
|= | |||
--> | <div class="templatedata-header"><!-- | ||
-->{{#if:{{yesno|{{{editlinks|}}}}}<!-- | |||
-->|{{#ifexpr:<!-- | |||
-->{{#if:{{{docpage|}}}<!-- | |||
--> | -->|{{#ifeq:{{FULLPAGENAME}}|{{transclude|{{{docpage}}}}}|0|1}}<!-- | ||
-->|not{{IsDocSubpage|false=0}}<!-- | |||
--> | -->}}<!-- | ||
-->|{{Navbar|{{{docpage|{{BASEPAGENAME}}/doc}}}|plain=1|brackets=1|style=float:{{dir|{{PAGELANGUAGE}}|left|right}};}}<!-- | |||
-->}}<!-- | |||
-->}} | -->}} | ||
{{#if:{{{noheader|}}}||<translate><!--T:1--> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}} | |||
''' | '''{{{1|{{BASEPAGENAME}}}}}''' | ||
</div><includeonly><!-- | </div><includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|<!-- | ||
-->|{{#if:{{IsDocSubpage|false=}}<!-- | |||
-->|[[Category:TemplateData documentation{{#translation:}}]]<!-- | |||
-->|[[Category:Templates using TemplateData{{#translation:}}]]<!-- | |||
-->}}<!-- | |||
-->}}</includeonly> | |||
| #default= | |||
{{#invoke:Template translation|renderTranslatedTemplate|template=Template:TemplateData header|noshift=1|uselang={{#if:{{pagelang}}|{{pagelang}}|{{int:lang}}}}}} | |||
}}</onlyinclude> | |||
{{Documentation|content= | |||
Inserts a brief header for the template data section. Adds the /doc subpage to [[:Category:TemplateData documentation{{#translation:}}]] and the template page to [[:Category:Templates using TemplateData{{#translation:}}]]. | |||
[[Category:Templates using TemplateData]] | |||
}}}} | == Usage == | ||
{{#tag:syntaxhighlight| | |||
==TemplateData== or ==Parameters== or ==Usage== | |||
{{((}}TemplateData header{{))}} | |||
{{^(}}templatedata{{)^}}{ | |||
... | |||
}{{^(}}/templatedata{{)^}} | |||
|lang=html | |||
}} | |||
Use <code><nowiki>{{TemplateData header|Template name}}</nowiki></code> to display a name for the template other than the default, which is [[Help:Magic_words#Variables|<nowiki>{{BASEPAGENAME}}</nowiki>]]. | |||
<dl><dd> | |||
{{TemplateData header|Template name}} | |||
</dd></dl> | |||
Use <code><nowiki>{{TemplateData header|noheader=1}}</nowiki></code> to omit the first sentence of the header text. | |||
<dl><dd> | |||
{{TemplateData header|noheader=1}} | |||
</dd></dl> | |||
==Parameters== | |||
{{TemplateData header/doc}} | |||
}} | |||
</noinclude> |
Revision as of 17:48, 30 January 2022
{{#switch:
|=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:TemplateData header|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}
TemplateData header
| #default=
{{#switch:
|=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:TemplateData header|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}
TemplateData header
{{#ifeq:TemplateData header|sandbox||{{#if:{{#ifexpr: (
{{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
Lua error: expandTemplate: template loop detected.
}} }}
Inserts a brief header for the template data section. Adds the /doc subpage to Category:TemplateData documentation and the template page to Category:Templates using TemplateData.
Usage
<syntaxhighlight lang="html">
TemplateData== or ==Parameters== or ==Usage
{{TemplateData header}} Template:^(templatedataTemplate:)^{ ... }Template:^(/templatedataTemplate:)^ </syntaxhighlight>
Use {{TemplateData header|Template name}}
to display a name for the template other than the default, which is {{BASEPAGENAME}}.
-
{{#switch:<translate></translate>
|=
{{#if:{{safesubst:#switch:{{#ifeq:TemplateData header|sandbox||{{#if:{{#ifexpr: (
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:TemplateData header|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||<translate> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}}
Template name
{{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
{{#switch:
|=
{{#if:{{safesubst:#switch:{{#ifeq:TemplateData header|sandbox||{{#if:{{#ifexpr: (|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:TemplateData header|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}
Template name
{{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
Lua error: expandTemplate: template loop detected.
}} }}
Use {{TemplateData header|noheader=1}}
to omit the first sentence of the header text.
-
{{#switch:<translate></translate>
|=
{{#if:{{safesubst:#switch:{{#ifeq:TemplateData header|sandbox||{{#if:{{#ifexpr: (
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:TemplateData header|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:1||<translate> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}}
TemplateData header
{{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
{{#switch:
|=
{{#if:{{safesubst:#switch:{{#ifeq:TemplateData header|sandbox||{{#if:{{#ifexpr: (|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:TemplateData header|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = TemplateData header/doc | = {{#ifeq: | | Template:TemplateData header/doc | TemplateData header/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:1||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}
TemplateData header
{{#ifeq:templatedata header|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:templatedata header|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
Lua error: expandTemplate: template loop detected.
}} }}