Template:Documentation/doc:修订间差异

删除的内容 添加的内容
无编辑摘要
 
(未显示同一用户的2个中间版本)
第1行:
{{Documentation subpage}}{{Uses Lua|Module:Documentation}}
== 用法概要 ==
{{Uses Lua|Module:Documentation}}
{{tlx|Documentation}} 模板自动显示“模板文档”框,就像你现在看到的这样,文档框中的内容由其它页面生成。
 
== 參數及使用方法 ==
{{tlx|Documentation}} 模板用于显示某个模板的帮助文档,通常从 /doc 子页面加载。它包含两部分:上方的"文档框"(显示文档内容 + [查看][编辑][历史][清除缓存]工具栏)和下方的"链接框"(显示嵌入来源、沙盒/测试样例链接等元数据)。
将以下代码放# 模板代码末尾的 中增加<syntaxhighlight lang=wikitext inline><noinclude>{{Documentation}}</noinclude></syntaxhighlight> 之前:
# 点击“编辑”链接,它将打开/doc子页面,并在那里填写文档。
用于模板本身的# 將类应写類增加 /doc 面的 <syntaxhighlight lang=wikitext inline><includeonly> </includeonly></syntaxhighlight> 标签中。
 
=== 正常的/doc子页面 ===
使用本模板可以让模板本身得到保护,同时允许任何人编辑文档和分类。
<syntaxhighlight lang="wikitext">
 
<noinclude>{{Documentation}}</noinclude>
== 用法 ==
 
=== 基本语法 ===
将以下代码放在模板代码末尾的 <syntaxhighlight lang=wikitext inline><noinclude></syntaxhighlight> 之前:
 
<syntaxhighlight lang="wikitext"><!-- 模板最后一行 --><noinclude>
{{Documentation}}
</noinclude>
</syntaxhighlight>
 
=== 嵌入其他任意/doc子页面 ===
<syntaxhighlight lang="wikitext"><noinclude>
通过第一个参数指定不同的文档页:
<noinclude>{{Documentation|Template:其他页面any page/doc}}</noinclude>
 
<syntaxhighlight lang="wikitext"><noinclude>
{{Documentation|Template:其他页面/doc}}
</noinclude>
</syntaxhighlight>
 
=== 使用 content 参数内联内容 ===
-{zh-hans:<syntaxhighlight lang="wikitext"><noinclude>
直接嵌入文档内容(此时不显示 [查看][编辑] 工具栏):
<noinclude>{{Documentation|content=这是一个文档。}}</noinclude>
</syntaxhighlight>; zh-hant:<syntaxhighlight lang="wikitext">
<noinclude>{{Documentation|content=這是一個文件。}}</noinclude>
</syntaxhighlight>;}-
 
=== 有[查看][编辑]链接的内联内容 ===
<syntaxhighlight lang="wikitext"><noinclude>
<syntaxhighlight lang="wikitext"><!-- 模板最后一行 --><noinclude>
{{Documentation|content=这是一个文档。}}
</noinclude>{{Documentation
|1 = Template:模板名/doc
|content = {{Template:模板名/doc|参数}}
}}</noinclude>
</syntaxhighlight>
 
=== 基本语最佳用法 ===
当同时指定 <code>|1=</code> 和 <code>|content=</code> 时,<code>|content=</code> 优先显示在文档框中。
此代码应在模板代码末尾,的底部“<syntaxhighlight lang=wikitext inline><noinclude></syntaxhighlight> 之前要有多余空格(否则会出现在导致使用该模板的页面上出现多余空格。参数可以像上面这样来使用以包含任意文档页
用于模板本身的分类链接应该用 <syntaxhighlight lang=wikitext inline><includeonly> </includeonly></syntaxhighlight> 标签来添加到文档页面。
如果文档页包含 <code>includeonly</code> 或 <code>noinclude</code> 标签并作为文档的一部分,请用“<code>&amp;lt;</code>”替代“<code><</code>”。
 
勿在 /doc 次使用 掛上{{tlx|Documentation}},以避免出
== 高级语法 ==
 
本模板会检查页面的保护情况,并自动放置保护图标(于顶部indicator位置)。因此使用本模板时不应再手动调用{{tl|pp}}系列模板,否则将显示重复的保护图标。
=== 自定义标题 ===
默认标题根据命名空间自动显示"模板文档"或"模块文档"。可通过 <code>|heading=</code> 自定义。
设为 <code>|heading=</code>(空值)则不显示标题栏。
 
=== 自定义链接框 ===
通过 <code>|link box=</code> 自定义链接框内容。设为 <code>off</code> 则隐藏链接框。
 
=== 测试 ===
通过 <code>|page=</code> 参数模拟在某页面的显示效果,例如 <code>|page=Template:Infobox</code>。
 
== 放置位置和分类 ==
此代码应放在模板代码末尾,<syntaxhighlight lang=wikitext inline><noinclude></syntaxhighlight> 之前不要有多余空格(否则会出现在使用该模板的页面上)。
用于模板本身的分类应写在 /doc 子页面的 <syntaxhighlight lang=wikitext inline><includeonly> </includeonly></syntaxhighlight> 标签中。
 
请勿在 /doc 子页面中再次使用 {{tlx|Documentation}},以避免出错。
 
== 完整语法 ==
<syntaxhighlight lang="wikitext">
{{Documentation
| 1 = 文档页面路径(可选)
| content = 直接嵌入的文档(可选)
| heading = 自定义标题(可选)
| heading-style = 标题的 CSS 样式(可选)
| link box = 自定义链接框(可选,设为 off 则隐藏)
| page = 模拟页面(可选,仅测试用)
}}
</syntaxhighlight>
 
== 模板数据 ==
第68行 ⟶ 第46行:
 
== 重定向 ==
* {{Tl|Doc}}
* {{Tl|模板文档Documentations}}
*{{Tl|Template doc}}
*&#123;&#123;[[Template:模板文档|-{模板文档}-]]&#125;&#125;
 
<includeonly>{{Sandbox other||