添加7,231字节
、 2020年6月1日 (一) 10:34
{{FromOther|site=英文萌娘百科|originURL=https://en.moegirl.org/{{FULLPAGENAME}}|origin={{FULLPAGENAME}}|copyright=cc|lsubtype=by-sa|lver=3.0|contribURL=https://en.moegirl.org/index.php?title={{FULLPAGENAME}}&action=history}}[[Category:从英文萌娘百科引入的页面]]
==Template Data==
<templatedata>
{
"params": {
"noinclude": {
"description": "If this argument is \"true\" (the word ONLY, case insensitive), then nothing will be included, even if rules are met.",
"type": "string",
"label": "Don't include"
},
"anytalk": {
"description": "Information to be included at any talkpage.",
"type": "string"
},
"main": {
"description": "Information to be included at (main) namespaces.",
"type": "string"
},
"user": {
"description": "Information to be included at User namespaces.",
"type": "string"
},
"template": {
"description": "Information to be included at Template namespaces.",
"type": "string"
},
"help": {
"description": "Information to be included at Help namespaces.",
"type": "string"
},
"category": {
"description": "Information to be included at Category namespaces.",
"type": "string"
},
"pagename": {
"description": "The FULL name of a page.",
"type": "string"
},
"page": {
"description": "Information to be included at \"pagename\".",
"type": "string"
},
"pagename2": {
"description": "The FULL name of a page.",
"type": "string"
},
"page2": {
"description": "Information to be included at \"pagename2\".",
"type": "string"
},
"pagename3": {
"description": "The FULL name of a page.",
"type": "string"
},
"page3": {
"description": "Information to be included at \"pagename3\".",
"type": "string"
},
"other": {
"description": "Information to be included at any pages not matching any defined selections.",
"type": "string",
"suggested": true
},
"demospaceid": {
"description": "The ID of a namespace for demonstration. This \"fake\" ID will replace the actual namespace ID of the page the template is located on, leading it to act as if it is placed at the specified namespace.",
"type": "number",
"label": "Demonstration Namespace ID"
},
"project": {
"description": "Information to be included at Project namespaces.",
"type": "string"
}
},
"format": "block",
"description": "Meta template for including different information according to the namespace or the page they are included in. Common usage includes category management (e.g. do not include document page (where examples are given) into categories).",
"paramOrder": [
"anytalk",
"main",
"user",
"project",
"template",
"help",
"category",
"pagename",
"page",
"pagename2",
"page2",
"pagename3",
"page3",
"other",
"noinclude",
"demospaceid"
]
}
</templatedata>
==Syntax==
<pre>
{{IncludeAt
|anytalk=
|main=
|user=
|project=
|template=
|help=
|category=
|pagename=
|page=
|pagename2=
|page2=
|pagename3=
|page3=
|other=
|noinclude=
|demospaceid=
}}
</pre>
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 <code>other</code> instead.
Here are some selected behaviors of IncludeAt:
{| class="wikitable"
|-
! scope="col" width="250" | Code
! scope="col" width="165" | Result in main namespace
! scope="col" width="165" | Result in template namespace
! Comment
|-
| <code><code>{{IncludeAt<br />|main=main namespace<br />|other=other namespaces<br />}}</code></code>
| <code>{{IncludeAt|demospaceid=0|main=main namespace|other=other namespaces}}</code>
| <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>
|-
| <code><code>{{IncludeAt<br />|main=main namespace<br />|template=template namespace<br />|other=other namespaces<br />}}</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><code>{{IncludeAt<br />|main=main namespace<br />|template=<br />|other=other namespaces<br />}}</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><code>{{IncludeAt<br />|main=main namespace}}</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><code>{{IncludeAt}}</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>-->