跳转到内容

模板:Documentation:修订间差异

来自电棍ottowiki———电棍笑传之查查编
Subpages:
 
第1行: 第1行:
<div class="template-documentation" style="background: aliceblue; padding: 1em; border: 1px solid #aaa;"><!--
<div style="
--><div class="template-documentation-header" style="padding-bottom:3px; border-bottom: 1px solid #aaa; margin-bottom:1ex"><!--
  background: #ffffff;
     --><span style="font-weight: bold; font-size: 125%">{{#switch:{{NAMESPACE}}
  border: 1px solid #d8dee2;
    |{{ns:template}}=[[File:Template-info.jpg|50px|link=]] 模板文档
  border-radius: 8px;
    |{{ns:module}}=[[File:Template-info.jpg|50px|link=]] 模块文档
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    |{{ns:widget}}=[[File:Template-info.jpg|50px|link=]] 小部件文档
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    |#default=文档
  font-size: 0.95em;
  }}</span>&nbsp;&nbsp;<span class="editsection plainlinks" style="font-size:small;" id="doc_editlinks">{{#if:{{{content|}}}|
  color: #202122;
       <!--内联文档-->[[{{fullurl:{{FULLPAGENAME}}|action=edit}} 编辑]]
  margin: 2em 0;
    |{{#ifexist: {{{1|{{Documentation/docname}}}}}
  padding: 1.25em;
      |<!--**/doc 存在  **-->[[{{fullurl:{{{1|{{Documentation/docname}}}}}}} 查看]] [[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} 编辑]] [[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=history}} 历史]]
  line-height: 1.6;
      |<!--**/doc 不存在**-->[[{{fullurl:{{{1|{{Documentation/docname }}}}}|action=edit}} 创建]]
">
    }} [[{{fullurl:{{FULLPAGENAME}}|action=purge}} 刷新]]
 
  }}</span></div><!--
  <!-- 顶部标题区:图标 + 名称 -->
--><div id="template_doc_page_transcluded" class="dablink plainlinks" style="font-size:84%;"><!--
  <div style="display: flex; align-items: center; gap: 14px; margin-bottom: 1em; border-bottom: 1px solid #e0e4e9; padding-bottom: 0.6em;">
  -->{{#if:{{{content|}}}|
    [[File:Template-info.jpg|60px|link=]]
      <!--内联文档**-->这个[[zhwp:Wikipedia:模板文件頁模式|文档]]是内联文档。
     <div style="font-size: 1.3em; font-weight: bold; color: #1a4d8f;">
      |{{#ifexist: {{{1|{{Documentation/docname}}}}}
      {{#switch:{{NAMESPACE}}
        |<!--**/doc存在**-->这个[[zhwp:Wikipedia:模板文件頁模式|文档]][[zhwp:Wikipedia:嵌入包含|嵌入]]自[[{{{1|{{Documentation/docname}}}}}]]
        |{{ns:template}} 模板文档
      }}
        |{{ns:module}} 模块文档
    }}
        |{{ns:widget}} 小部件文档
</div>
        |#default=文档
{{#if:{{{content|}}}|{{{content}}}|{{#ifexist:{{{1|{{Documentation/docname}}}}} | {{ {{{1|{{Documentation/docname}}}}} }} }}}}
      }}
    </div>
  </div>
 
  <!-- 来源或提示说明区 -->
  <div style="
    background: #f4f8fb;
    border-left: 4px solid #69c;
    padding: 0.8em 1em;
    margin-bottom: 1em;
    font-size: 0.9em;
    color: #444;
  ">
    {{#if:{{{content|}}}|
       📄 此文档以 [[zhwp:Wikipedia:模板文件頁模式|内联格式]] 编写,内容直接嵌入主模板页面。
      |{{#ifexist: {{{1|{{Documentation/docname}}}}}
        |📎 此文档通过 [[zhwp:Wikipedia:嵌入包含|嵌入方式]] 引用自子页面 [[{{{1|{{Documentation/docname}}}}}]]。
        |⁉️ 未找到任何文档;点击下方“创建”补充。
      }}
    }}
  </div>
 
  <!-- 内容展示区 -->
  <div style="
    background-color: #fefefe;
    border: 1px solid #e1e4e8;
    padding: 1em;
    border-radius: 5px;
    font-size: 0.95em;
    color: #222;
    margin-bottom: 1em;
  ">
    {{#if:{{{content|}}}|
      {{{content}}}
      |{{#ifexist: {{{1|{{Documentation/docname}}}}}
        |{{ {{{1|{{Documentation/docname}}}}} }}
      }}
    }}
  </div>
 
  <!-- 按钮/链接行 -->
  <div style="text-align: right; font-size: 0.85em; color: #666;">
    {{#if:{{{content|}}}|
      [[{{fullurl:{{FULLPAGENAME}}|action=edit}} 编辑]]
      |{{#ifexist: {{{1|{{Documentation/docname}}}}}
        |[[{{fullurl:{{{1|{{Documentation/docname}}}}}}} 查看]]
        · [[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} 编辑]]
        · [[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=history}} 历史]]
        |[[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} 创建]]
      }}
      · [[{{fullurl:{{FULLPAGENAME}}|action=purge}} 刷新]]
    }}
  </div>
 
</div>
</div>

2025年5月4日 (日) 20:37的最新版本

   
     文档
   📎 此文档通过 嵌入方式 引用自子页面 模板:Documentation/doc
   == 模板说明 ==

本模板用于在模板、模块、小部件等页面底部显示标准的“文档”内容区域,包括:

  • 标题(自动根据页面命名空间识别为“模板文档”、“模块文档”等);
  • 如何加载文档(内联或嵌入方式);
  • 实际的文档正文(可以使用参数传入或来自子页面);
  • 编辑、查看、历史、刷新等便捷操作链接。

用法

1. 子页面嵌入(推荐方式)

将说明文档写入一个子页面,通常叫 `Template:模板名/doc`,然后在模板页面底部调用本模板:

{{Documentation}}

默认会寻找 `模板:Documentation/doc` 作为子页面载入文档内容。

---

2. 指定其他子页面(适用于自定义路径)

{{Documentation|1=Template:OtherTemplate/doc}}

指定第一个参数,就可以载入任意页面做为文档。

---

3. 使用 `content=` 内联方式写文档

{{Documentation
|content=
== 用法 ==
* 示例用法 1
* 参数说明
}}

当提供 `content=...` 参数时,内容将内联显示,不依赖/doc 子页面。


参数说明

参数 说明
1 可选。要嵌入的子页面名称,例如 Template:模板名/doc
content 可选。使用内联模式直接书写模板文档,不加载子页面

显示效果

  • 顶部显示模板类型(如“模板文档” / “模块文档”);
  • 自动识别内联或嵌入,并显示提示说明;
  • 显示文档正文;
  • 底部提供快速导航按钮:编辑、查看、历史、刷新。

你看到的这个文档页面就是一个 {{Documentation}} 模板的使用示例。

   [查看]
        · [编辑]
        · [历史]
     · [刷新]