Difference between revisions of "Template:IncludeAt/doc"

From Moegirlpedia
Jump to: navigation, search
(still working...)
 
m (TemplateData no longer in use// Edit via Wikiplus)
 
(15 intermediate revisions by one other user not shown)
Line 1: Line 1:
<templatedata>
+
==Syntax==
{
+
<pre>
"params": {
+
{{IncludeAt
"noinclude": {
+
|anytalk=
"description": "If this argument is \"<code>true</code>\", then nothing will be included. Used as a \"master switch\".",
+
|main=
"type": "string",
+
|user=
"default": "none"
+
|project=
},
+
|template=
"anytalk": {
+
|help=
"description": "Information to be included at any talkpage.",
+
|category=
"type": "string",
+
|pagename=
"default": "none",
+
|page=
"required": true
+
|pagename2=
},
+
|page2=
"main": {
+
|pagename3=
"description": "Information to be included at (main) namespaces.",
+
|page3=
"type": "string",
+
|other=
"required": true
+
|noinclude=
},
+
|demospaceid=
"user": {
+
}}
"type": "string",
+
</pre>
"required": true
+
Delete unused parameters; the template sensitive to whether a parameter is defined.
},
+
 
"template": {
+
==Behaviour==
"required": true
+
 
},
+
===parameters===
"help": {
+
If a parameter is defined('''even if it is null or whitespaces'''), the template will attempt to match its case.
"required": true
+
 
},
+
If a parameter is not defined, then the template will ignore that case when matching; it will usually be encompassed by the parameter <code>other</code> instead.
"category": {
+
 
"required": true
+
Here are some selected behaviors of IncludeAt:
},
+
{| class="wikitable"
"pagename": {},
+
|-
"page": {},
+
! scope="col" width="250" | Code
"pagename2": {},
+
! scope="col" width="165" | Result in main namespace
"page2": {},
+
! scope="col" width="165" | Result in template namespace
"pagename3": {},
+
! Comment
"page3": {},
+
|-
"other": {}
+
| <code>&lt;code>&#123;&#123;IncludeAt<br />&#124;main=main namespace<br />&#124;other=other namespaces<br />}}&lt;/code></code>
},
+
| <code>{{IncludeAt|demospaceid=0|main=main namespace|other=other namespaces}}</code>
"format": "block"
+
| <code>{{IncludeAt|demospaceid=10|main=main namespace|other=other namespaces}}</code>
}
+
| <span style="font-size:85%;">The <code>template</code> parameter is not defined, so IncludeAt disregard it during check. Only main namespace cases are checked and template namespace cases are caught by the <code>other</code> parameter.</span>
</templatedata>
+
|-
 +
| <code>&lt;code>&#123;&#123;IncludeAt<br />&#124;main=main namespace<br />&#124;template=template namespace<br />&#124;other=other namespaces<br />}}&lt;/code></code>
 +
| <code>{{IncludeAt|demospaceid=0|main=main namespace|template=template namespace|other=other namespaces}}</code>
 +
| <code>{{IncludeAt|demospaceid=10|main=main namespace|template=template namespace|other=other namespaces}}</code>
 +
| <span style="font-size:85%;">The two cases here are both defined. IncludeAt checks and provide results in both cases.</span>
 +
|-
 +
| <code>&lt;code>&#123;&#123;IncludeAt<br />&#124;main=main namespace<br />&#124;template=<br />&#124;other=other namespaces<br />}}&lt;/code></code>
 +
| <code>{{IncludeAt|demospaceid=0|main=main namespace|template=|other=other namespaces}}</code>
 +
| <code>{{IncludeAt|demospaceid=10|main=main namespace|template=|other=other namespaces}}</code>''(empty result)''
 +
| <span style="font-size:85%;">Notice that both cases here are still defined: the <code>template</code> parameter is present but the value is an empty string. IncludeAt checks and provide results in both cases, and for template namespace cases, it faithfully reproduces the empty string.</span>
 +
|-
 +
| <code>&lt;code>&#123;&#123;IncludeAt<br />&#124;main=main namespace}}&lt;/code></code>
 +
| <code>{{IncludeAt|demospaceid=0|main=main namespace}}</code>
 +
| <code>{{IncludeAt|demospaceid=10|main=main namespace}}</code>''(empty result)''
 +
| <span style="font-size:85%;">IncludeAt do not mangle with the <code>other</code> parameter (the default case); even if it wasn't explicitly defined, it will still catch all unmatched cases. The default value of <code>other</code> is an empty string.</span>
 +
|-
 +
| <code>&lt;code>&#123;&#123;IncludeAt}}&lt;/code></code>
 +
| <code>{{IncludeAt|demospaceid=0}}</code>''(empty result)''
 +
| <code>{{IncludeAt|demospaceid=10}}</code>''(empty result)''
 +
| <span style="font-size:85%;">An IncludeAt with no defined parameters. The <code>other</code> parameter will always be outputted and its default is an empty string.</span>
 +
|}
 +
 
 +
When a parameter is deemed undefined, the template adds <code>NULL</code> or <code>NULLPAGENEVERCHECK</code> to the comparison argument to prevent matches. This means that, in theory, if the template is placed on a page with a name like <code>{{{pagename}}}NULLPAGENEVERCHECK</code>, the template will misbehave.
 +
 
 +
===demospaceid===
 +
 
 +
<code>demospaceid</code> should be a positive integer. If it is not a number (including nonexistent), the template falls back on using the namspace number of the page it is located on; if it is a number but not an integer, the decimals are truncated by the template. You may use the magicword <code><nowiki>{{NAMESPACENUMBER:</nowiki>''(the page you want to emulate)''}}</code> or refer to the [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Namespace MediaWiki Manual] to obtain the namespace number you need.
 +
<includeonly>[[Category:Meta templates]]</includeonly><!--<noinclude>[[Category:Template documentations]]</noinclude>-->

Latest revision as of 09:54, 28 February 2022

Syntax

{{IncludeAt
|anytalk=
|main=
|user=
|project=
|template=
|help=
|category=
|pagename=
|page=
|pagename2=
|page2=
|pagename3=
|page3=
|other=
|noinclude=
|demospaceid=
}}

Delete unused parameters; the template sensitive to whether a parameter is defined.

Behaviour

parameters

If a parameter is defined(even if it is null or whitespaces), the template will attempt to match its case.

If a parameter is not defined, then the template will ignore that case when matching; it will usually be encompassed by the parameter other instead.

Here are some selected behaviors of IncludeAt:

Code Result in main namespace Result in template namespace Comment
<code>{{IncludeAt
|main=main namespace
|other=other namespaces
}}</code>
main namespace other namespaces The template parameter is not defined, so IncludeAt disregard it during check. Only main namespace cases are checked and template namespace cases are caught by the other parameter.
<code>{{IncludeAt
|main=main namespace
|template=template namespace
|other=other namespaces
}}</code>
main namespace template namespace The two cases here are both defined. IncludeAt checks and provide results in both cases.
<code>{{IncludeAt
|main=main namespace
|template=
|other=other namespaces
}}</code>
main namespace (empty result) Notice that both cases here are still defined: the template parameter is present but the value is an empty string. IncludeAt checks and provide results in both cases, and for template namespace cases, it faithfully reproduces the empty string.
<code>{{IncludeAt
|main=main namespace}}</code>
main namespace (empty result) IncludeAt do not mangle with the other parameter (the default case); even if it wasn't explicitly defined, it will still catch all unmatched cases. The default value of other is an empty string.
<code>{{IncludeAt}}</code> (empty result) (empty result) An IncludeAt with no defined parameters. The other parameter will always be outputted and its default is an empty string.

When a parameter is deemed undefined, the template adds NULL or NULLPAGENEVERCHECK to the comparison argument to prevent matches. This means that, in theory, if the template is placed on a page with a name like {{{pagename}}}NULLPAGENEVERCHECK, the template will misbehave.

demospaceid

demospaceid should be a positive integer. If it is not a number (including nonexistent), the template falls back on using the namspace number of the page it is located on; if it is a number but not an integer, the decimals are truncated by the template. You may use the magicword {{NAMESPACENUMBER:(the page you want to emulate)}} or refer to the MediaWiki Manual to obtain the namespace number you need.