模 板 :Namespace detect
![]() | 此模 为了避免 测试 |
这是{{Namespace detect}}
{{namespace detect |参 数 名 =模 板 被 包含 在 该参数 对应的 命名 空 间时所 显示的 文 本 }}
- main:
主 /条目 命名 空 间。 - talk:讨论
命名 空 间,包括 但 不 限 于“Talk:”“User_talk:”“Wikipedia_talk:”开头的 页面。 - pseudo:伪
命名 空 间。- mos, lta:
分 别对应“MOS:”和 “LTA:”开头的 页面。
- mos, lta:
- user, wikipedia, file, mediawiki, template, help, category, portal, wikiproject:
分 别对应用户命名 空 间、计划命名 空 间(维基百科 命名 空 间)、文 件 命名 空 间、MediaWiki命名 空 间、模 板 命名 空 间、帮助命名 空 间、分 类命名 空 间、主 题命名 空 间和维基专题命名 空 间。 - other = 如果对应
的 命名 空 间参数 没 有 值,则使用 此参数 。
为了
用法
{{namespace detect | main =条目 | talk = 讨论页 | other = 其他页面 }}
如果
条目
如果
- 其他页面
{{namespace detect | file =文 件 | category =分 类页面 | other = }}
这个
{{namespace detect | main = | other = 其他页面 }}
- 其他页面
演 示 空 间
该模
{{namespace detect | main =条目 | other = 其他页面 | demospace = main }}
无论
条目
您可以在
{{namespace detect | main =条目 | other = 其他页面 | demospace = {{{demospace|}}} }}
如果demospace
参 数
{{namespace detect | main = ... | other = | demospace = {{{demospace|}}} / main / talk / user / wikipedia / file / mediawiki / template / help / category / portal / other }}
Note: Empty values to the "main" ... "portal" parameters do have special meaning.
技 术细节
Namespace "Image" was renamed to "File" on 11 December 2008. This template was updated to understand both names well before that, thus it still works fine. For backwards compatibility it still understands "image" both as a parameter name, such as "image = File page text", and as a value "demospace = image".
If you intend to feed tables as content to the numbered parameters of this template, then you need to know this:
Templates do have a problem to handle parameter data that contains pipes "|
", unless the pipe is inside another template {{name|param1}}
or inside a piped link [[帮助:
. Thus templates can not handle wikitables as input unless you escape them by using the {{!}} template. This makes it hard to use wikitables as parameters to templates. Instead the usual solution is to use "HTML wikimarkup" for the table code, which is more robust.
For more technical details such as about "copying to other projects" and "CSS based namespace detection" see {{main talk other}} and its talk page.
参 见
- {{main other}} –
用 于条目 模 板 。 - {{talk other}} –
用 于讨论页模 板 。 - {{user other}} –
用 于用户页模 板 。 - {{wikipedia other}} –
用 以侦测"Wikipedia:"计划页面。 - {{file other}} –
用 于档案 (图像)模 板 - {{template other}} –
用 以侦测模板 页。 - {{help other}} –
用 于帮助 页模板 。 - {{category other}} –
用 于分类页模 板 。 - {{portal other}} –
用 于主题页模 板 。
- {{main talk other}} –
区分 某 些命名 空 间。 - {{main talk category other}} –
区分 某 些命名 空 间。
- {{namespace detect}} –
多功 能 模 板 。 - {{namespace detect showall}} –
超 多功 能 模 板 。
- {{talkspace detect}} - 侦测
不同 命名 空 间的讨论页面。
Technical stuff:
- Wikipedia:
命名 空 间 – Lists all the namespaces. - Help:
魔 术字 – About{{NAMESPACE}}
etc. - Help:
解析 器 函数 – About{{#ifeq:|||}}
etc.
编者 请在/doc |