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