「テンプレート:Documentation」の版間の差分

提供:arl
ナビゲーションに移動 検索に移動
(ページの作成:「<!-- Automatically add {{template sandbox notice}} when on a /sandbox page. -->{{#ifeq: {{SUBPAGENAME}} | sandbox | <div style="clear: both;"></div>{{template sandbox n...」)
 
(119.224.172.208 (会話) による ID:64184301 の版を取り消し)
1行目: 1行目:
<!--
{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>
  Automatically add {{template sandbox notice}} when on a /sandbox page.
-->{{#ifeq: {{SUBPAGENAME}} | sandbox
| <div style="clear: both;"></div>{{template sandbox notice|{{{livepage|}}}}}
}}<!--
  Automatically add {{pp-template}} to protected templates.
-->{{template other
| {{#ifeq: {{PROTECTIONLEVEL:move}} | sysop
  | {{pp-template|docusage=yes}}
  | {{#if: {{PROTECTIONLEVEL:edit}}
    | {{pp-template|docusage=yes}}
    | <!--Not protected, or only semi-move-protected-->
    }}
  }}
}}<!--
  Start of green doc box.
-->{{documentation/start box2
| preload = {{{preload|}}}  <!--Allow custom preloads-->
| heading = {{{heading|¬}}}  <!--Empty but defined means no header-->
| heading-style = {{{heading-style|}}}
| content = {{#if:{{{content|}}}|1}}
 
<!--Some namespaces must have the /doc, /sandbox and /testcases
    in talk space-->
| docspace = {{documentation/docspace}}
 
| 1 = {{{1|}}}  <!--Other docname, if fed-->
 
<!--The namespace is added in /start box2-->
| template page = {{documentation/template page}}
 
}}<!-- Start content --><!--
  Start load the /doc content:
  Note: The line breaks between this comment and the next line are necessary
  so  "=== Headings ===" at the start and end of docs are interpreted.
-->
{{#switch: {{#if:{{{content|}}}|1|0}}{{#if:{{{1|}}}|1|0}}{{#ifexist:{{{1|}}}|1|0}}{{#ifexist:{{documentation/docspace}}:{{documentation/template page}}/doc|1|0}}
| 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110
| 1111 = {{{content|}}}
| 0110 | 0111 = {{ {{{1}}} }}
| 0001 | 0011 = {{ {{documentation/docspace}}:{{documentation/template page}}/doc }}
| 0000 | 0100 | 0010 | 0101 =
}}
<!--
  End load the /doc content:
  Note: The line breaks between this comment and the previous line are necessary
  so  "=== Headings ===" at the start and end of docs are interpreted.
-->{{documentation/end box2
| preload = {{{preload|}}}  <!--Allow custom preloads-->
| content = {{#if:{{{content|}}}|1}}
| link box = {{{link box|}}}  <!--So "link box=off" works-->
 
<!--Some namespaces must have the /doc, /sandbox and /testcases
    in talk space-->
| docspace = {{documentation/docspace}}
 
| 1 = {{{1|}}}  <!--Other docname, if fed-->
 
<!--The namespace is added in /end box2-->
| template page = {{documentation/template page}}
 
}}<!--
  End of green doc box
--><noinclude>
<!-- Add categories and interwikis to the /doc subpage, not here! -->
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
</noinclude>

2017年5月21日 (日) 14:06時点における版

このテンプレートは今ここに表示されているような解説を、他のページから自動的に呼び出して表示します。このテンプレートは他のページに呼び出されるようなページに解説を加えることに使われ、おもにテンプレートでの使用を想定していますが名前空間によって制限されているわけではありません。

使い方

基本

あなたがこのテンプレートを使用しようとしているページが「Template:X」だとすると「Template:X/doc」に解説を書いて保存し、「Template:X」に次のコードを付け足してください。

<noinclude>{{Documentation}}</noinclude>

ページ指定

解説が保存されているページが「Template:any page/doc」である場合、次のコードを「Template:X」に付け足してください。

<noinclude>{{Documentation|Template:any page/doc}}</noinclude>

インライン・コンテンツ

解説を別のページに保存せず、次のように「Template:X」に直接書き込むこともできます。

<noinclude>{{Documentation|content=This is documentation.}}</noinclude>

「Template:X/doc」が存在する場合は、そちらも同時に表示されます。

  • 注意:「|content=」で指定した部分に含まれているパイプ構文の表正しく表示されません。「|content=」で指定する部分に表を作成する場合はパイプ構文ではなくHTMLタグを使用するようにしてください(「/doc」等のこのテンプレートによって呼び出されたページにパイプ構文の表が含まれる場合は、正しく表示されます)。

ヘッドラインを変更する

次のように書き込めば、ヘッドラインを変更できます。

<noinclude>{{Documentation|heading=変更したヘッドライン}}</noinclude>

もし次のように heading 引数を空にすれば、ヘッドラインは表示されません。

<noinclude>{{Documentation|heading=}}</noinclude>

注意

これらのコードは<noinclude>の前に余分な空白をつけずに、テンプレートやその他の解説を呼び出したいページに付け加えてください。もし、解説・説明文書のページが<includeonly>や<noinclude>といったタグを解説の一部として含むならば「<」を「&lt;」で置き換えてください。

特別な機能

プリロード

もし解説のページが存在しなければ、[編集]リンクはTemplate:Documentation/preloadから解説の雛形ファイルをプリロードします。

プリロードするファイルは、preload 引数で変更できます。

サンドボックスとテストケースとの連携

このテンプレートはサンドボックスとテストケースの存在を確認し、存在していればそのことを存在していなくてもそのことを通知しサンドボックスとテストケースの使用に誘導します。

この機能は、sandbox-testcases引数に「show」以外を指定することによってキャンセルできます。

引数

引数の一覧
引数 指定内容 既定値 説明
1 ページ名 {{Documentation/docname}} 解説として読み込むページ名。
content 任意の文章 {{{{{1}}}}} 解説として表示する文章。
heading 任意の文字列 解説 ヘッドラインとして表示する文字列。
heading-style CSS書式 font-size:150% ヘッドラインのスタイル。
heading-padding 単位つき数値(CSS書式) 3px ヘッドラインのパディング。
heading-margin 単位つき数値(CSS書式) 1ex ヘッドラインのマージン。
transcluded 任意の文字列 show 「show」以外を指定すると、読込先を表示しない。
sandbox-testcases 任意の文字列 show 「show」以外を指定すると、サンドボックスとテストケースの存否を表示しない。
preload ページ名 Template:Documentation/preload 解説のページが存在しない場合にプレロードする雛形ファイル。

カテゴリ

このテンプレートが貼り付けられたページに適用するカテゴリはありません。

このテンプレートを使う理由

  • このテンプレートを使うことによってテンプレートやその他のページが保護されていても、そのページのための解説、言語間リンク、カテゴリなどを変更することができます。
  • テンプレートのページはテンプレートを表示するための空間に読み込まれますが、その空間の大きさはパフォーマンス上の理由により制限されています。解説をサブページにおけば、テンプレートのページ自体に書かれるコードを減らすことができます。

関連項目