|
|
(14人の利用者による、間の28版が非表示) |
1行目: |
1行目: |
− | <noinclude>{{Template sandbox notice}}</noinclude><div
| + | <div style="clear:both; text-align:center; margin:1em; padding:0.2em; border-top:3px double #ccc; border-bottom:3px double #ccc">[[File:Test Template Info-Icon.svg|50px|Template Info]] このテンプレートの解説は[[{{{1|{{FULLPAGENAME}}/doc}}}]]から[[Help:テンプレートの説明文|呼び出されています]]。<span class="plainlinks" style="font-size:small">[[{{fullurl:{{{1|{{FULLPAGENAMEE}}/doc}}}|action=edit}} 編集]] [[{{fullurl:{{{1|{{FULLPAGENAMEE}}/doc}}}|action=history}} 履歴]]</span></div><includeonly> |
− | class="template-documentation" style="clear: both; margin: 1em 0 1em 0; border: 1px solid #aaa; background-color: #ecfcf4; padding: 5px"><!--
| + | {{{{{1|{{PAGENAME}}/doc}}}}}</includeonly><noinclude> |
− | | + | {{Documentation/doc}} |
− | styleパラメータは、本来はスタイルシートに記述するべき?
| + | </noinclude> |
− | …スタイルシートをどこから見つけたのか忘れてしまった。-->
| + | |
− | {{
| + | |
− | #if: {{{heading|解説}}}
| + | |
− | |<!-- headingがキャンセルされていない場合。
| + | |
− | headingが指定されていなければ、デフォルトの「解説」になる。
| + | |
− | {{Documentation|heading=}}のように設定することでキャンセルできる。
| + | |
− | --><div style="padding-bottom: {{{heading-padding|3px}}}; border-bottom: 1px solid #aaa; margin-bottom: {{{heading-margin|1ex}}}"><span id="doc_editlinks" class="editsection plainlinks">{{
| + | |
− | #ifexist: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | |<!-- /doc がある
| + | |
− | -->[[{{
| + | |
− | fullurl: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | }} 閲覧]] [[{{
| + | |
− | fullurl: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | | action=edit
| + | |
− | }} 編集]]
| + | |
− | |<!-- /doc がない
| + | |
− | -->{{
| + | |
− | #if: {{{content|}}}
| + | |
− | |<!-- contentあり: 動作なし -->
| + | |
− | |<!-- contentなし
| + | |
− | -->[[{{
| + | |
− | fullurl: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | | action=edit&preload={{urlencode:{{{preload|Template:Documentation/preload}}}}}
| + | |
− | }} 編集]]
| + | |
− | }}<!-- #if: {{{content|}}} 閉じる -->
| + | |
− | }}<!-- #ifexist: {{{ 1 | {{Documentation/docname}} }}} 閉じる
| + | |
− | --></span><span style="{{{heading-style|font-size: 150%}}}">{{{heading|解説}}}</span></div><!-- ここまでheadingがキャンセルされていない場合 -->
| + | |
− | |<!-- headingがキャンセルされた場合: 動作なし -->
| + | |
− | }}<!-- #if: {{{heading|解説}}} を閉じる
| + | |
− | --><!--
| + | |
− | 呼び出し先とサンドボックス・テストケースの誘導に使われるdivセクション。
| + | |
− | 本来はスタイルシートに記述するべき?
| + | |
− | --><div id="template_doc_page_transcluded" style="clear: both; border: none; background-color: #ecfcf4; margin: 0 0 0 2em; font-style: italic; font-size: 85%" ><!--
| + | |
− | 呼び出し元処理の開始
| + | |
− | -->{{
| + | |
− | #ifeq: {{{transcluded|show}}} | show
| + | |
− | |<!-- 呼び出し先を表示 -->{{
| + | |
− | #ifexist: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | |<!-- /doc がある場合
| + | |
− | -->この[[Help:テンプレートの説明文|解説]]は、[[{{{ 1 | {{Documentation/docname}} }}}]]から[[Help:テンプレート#テンプレートとは|呼び出されて]]います<small style="font-style: normal">([{{
| + | |
− | fullurl: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | | action=edit
| + | |
− | }} 編集] | [{{
| + | |
− | fullurl: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | | action=history
| + | |
− | }} 履歴])</small><br />
| + | |
− | |<!-- /doc がない場合:動作なし -->
| + | |
− | }}
| + | |
− | |<!-- 呼び出し先を表示しない:動作なし -->
| + | |
− | }}<!-- #ifeq: {{{transcluded|show}}} | show を閉じる。 | + | |
− | --><!--
| + | |
− | サンドボックス・テストケース処理の開始
| + | |
− | -->。
| + | |
− | {{
| + | |
− | #switch: {{SUBPAGENAME}}
| + | |
− | |sandbox=<!-- sandbox -->
| + | |
− | |testcases=<!-- testcases -->
| + | |
− | |#default={{
| + | |
− | #switch: {{SUBJECTSPACE}}/{{{sandbox-testcases|show}}}
| + | |
− | | {{ns:template}}/show
| + | |
− | | {{ns:user}}/show = <!-- show /sandbox /testcases -->{{
| + | |
− | #ifexist: {{ #rel2abs: /sandbox }}
| + | |
− | | {{
| + | |
− | #ifexist: {{ #rel2abs: /testcases }}
| + | |
− | | <!-- /sandbox も /testcases も存在する
| + | |
− | -->このテンプレートには、[[/sandbox|サンドボックス]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /sandbox }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>と[[/testcases|テストケース]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /testcases }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>があります。<br />
| + | |
− | | <!-- /sandbox は存在するが、 /testcases が存在しない
| + | |
− | -->このテンプレートには、[[/sandbox|サンドボックス]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /sandbox }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>がありますが、[[/testcases|テストケース]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /testcases }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>はありません。<br />
| + | |
− | }}<!-- #ifexist: {{ #rel2abs: /testcases }} を閉じる -->
| + | |
− | | {{
| + | |
− | #ifexist: {{ #rel2abs: /testcases }}
| + | |
− | | <!-- /sandbox は存在しないが /testcases が存在する
| + | |
− | -->このテンプレートには、[[/testcases|テストケース]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /testcases }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>がありますが、[[/sandbox|サンドボックス]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /sandbox }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>はありません。<br />
| + | |
− | | <!-- /sandbox も /testcases も存在しない
| + | |
− | -->このテンプレートは、[[/sandbox|サンドボックス]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /sandbox }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>も[[/testcases|テストケース]]<small style="font-style: normal">([{{
| + | |
− | fullurl: {{ #rel2abs: /testcases }}
| + | |
− | | action=edit
| + | |
− | }} 編集])</small>もありません。<br />
| + | |
− | }}<!-- #ifexist: {{ #rel2abs: /testcases }} を閉じる -->
| + | |
− | }}<!-- #ifexist: {{ #rel2abs: /sandbox }} を閉じる -->
| + | |
− | }}<!-- #switch: {{SUBJECTSPACE}}/{{{sandbox-testcases|show}}} を閉じる-->
| + | |
− | | + | |
− | }}<!-- #switch: {{SUBPAGENAME}} を閉じる --><!-- | + | |
− | 呼び出し先とサンドボックス・テストケースの誘導に使われるdivセクションを閉じる。
| + | |
− | --></div><!--
| + | |
− | -->{{#if: {{{content|}}} | {{{content}}} }}
| + | |
− | {{
| + | |
− | {{ #ifexist: {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | | {{{ 1 | {{Documentation/docname}} }}}
| + | |
− | | ns:0
| + | |
− | }}
| + | |
− | }} | + | |
− | </div> | + | |
2019年6月9日 (日) 03:11時点における最新版
Documentationテンプレートは、今ここに表示されているような、テンプレートなどの説明文を、他のページから自動的に呼び出して表示するためのテンプレートです。主にテンプレートに解説を加えることに使われることを想定していますが、テンプレート以外の他のページに呼び出されるページにも使用できます(名前空間によって制限されているわけではありません)。
使い方[編集]
あなたがこのテンプレートを使用しようとしているページが「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>といったタグを解説の一部として含むならば「<」を「<」で置き換えてください。
特別な機能[編集]
プリロード[編集]
もし解説のページが存在しなければ、[編集]リンクは Template:Documentation/preload から解説の雛形ファイルをプリロードします。
プリロードするファイルは、preload 引数で変更できます。
サンドボックスとテストケースとの連携[編集]
このテンプレートはサンドボックスとテストケースの存在を確認し、有無に関わらずそのことを通知しサンドボックスとテストケースの使用に誘導します。
この機能は、sandbox-testcases引数に「show」以外を指定することによってキャンセルできます。
引数の一覧
引数 |
指定内容 |
既定値 |
説明
|
1
|
ページ名 |
(対象のページ名)/doc |
解説として読み込むページ名。
|
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 |
解説のページが存在しない場合にプレロードする雛形ファイル。
|
カテゴリ[編集]
このテンプレートが貼り付けられたページに適用するカテゴリはありません。
このテンプレートを使う理由[編集]
- このテンプレートを使うことによってテンプレートやその他のページが保護されていても、そのページのための解説、言語間リンク、カテゴリなどを変更することができます。
- テンプレートのページはテンプレートを表示するための空間に読み込まれますが、その空間の大きさはパフォーマンス上の理由により制限されています。解説をサブページにおけば、テンプレートのページ自体に書かれるコードを減らすことができます。
関連項目[編集]