「テンプレート:Infobox/doc」の版間の差分

提供: Yourpedia
移動: 案内検索
(テストも兼ねて、色々書き直し)
 
(同じ利用者による、間の7版が非表示)
1行目: 1行目:
'''Infobox'''テンプレートは、Infoboxを作成するための[[メタテンプレート]]です。記事に直接使われることは想定していません。現在、条件文を使わない版を開発中ですが、テンプレートの中でタグを使われると表示が壊れるバグが解消できていないため、まだ使えません。
+
<noinclude>{{Documentation subpage}}</noinclude>
 +
'''Infobox'''テンプレートは、Infoboxを作成するための[[メタテンプレート]]です。Wikipediaの同名テンプレートとの互換を実現するために作成しました。
  
 
== 引数一覧 ==
 
== 引数一覧 ==
 
*body全体にかかる引数
 
*body全体にかかる引数
**クラス(class)は「infobox」が既定値になっており、引数「bodyclass」を指定すると、「infobox (bodyclass)」というクラスになります。
+
**'''bodyclass''':cssクラスを指定します。既定値は「infobox」に設定されており、引数を指定すると「infobox (bodyclass)」という名前のクラスになります。
**スタイル(style)は幅22em(width:22em)が規定値として設定されており、それ以外のスタイルは引数「bodystyle」で指定します。
+
**'''bodystyle''':スタイルを指定します。既定値として「width:22em; clear:right; float:right」が設定されており、引数を指定するとスタイルが追加・修正されます。
*最下部の、テンプレート本体への内部リンクは、引数「name」または「tnavbar」に「テンプレート:ほげほげ」の「ほげほげ」にあたる文字列を入力すると、正常に設定されます。
+
*最下部の、テンプレート本体への内部リンク
*引数「child」を指定することによって、別のInfobox内に組込み可能なInfobox(Infoboxからtableタグをなくした版)にすることは、今のところ、できません。
+
**'''name'''または'''tnavbar''':「テンプレート:ほげほげ」の「ほげほげ」にあたる文字列を入力します。
 
+
**'''nameflag'''または'''tnavbarflag''':引数にNULL値を指定すると、テンプレートへのリンクが出力表示されなくなります。
 
{{Multicol}}
 
{{Multicol}}
 
=== コンテンツ ===
 
=== コンテンツ ===
{{Infobox/sandbox2
+
{{Infobox
 
|title          = title
 
|title          = title
 +
|titlestyle      = background-color:#ccf
 
|above          = above
 
|above          = above
 
|abovestyle      = background-color:#ccf
 
|abovestyle      = background-color:#ccf
 
|headerstyle    = background-color:#ccf
 
|headerstyle    = background-color:#ccf
|subheader      = subheader<br /> 
+
|subheader      = subheader<br />&nbsp;
|subheader2      = subheader2<br /> 
+
|subheader2      = subheader2<br />&nbsp;
|image          = image<br /> 
+
|image          = image<br />&nbsp;
|caption        = caption
+
|caption        = caption<br />&nbsp;
|image2          = image2<br /> 
+
|image2          = image2<br />&nbsp;
|caption2        = caption2
+
|caption2        = caption2<br />&nbsp;
 
|header1  = header1
 
|header1  = header1
 
|label1  = label1
 
|label1  = label1
30行目: 32行目:
 
|label3  = …
 
|label3  = …
 
|data3    = …
 
|data3    = …
|header50 = header50
+
|header40 = header40
|label50   = label50
+
|label40   = label40
|data50   = data50
+
|data40   = data40
 +
|below      = below
 
|belowstyle = background-color:#ccf
 
|belowstyle = background-color:#ccf
|below = below
+
|tnavbar = Infobox
}}
+
{{Multicol-break}}
+
=== クラス ===
+
{{Infobox/sandbox2
+
|title          = titleclass
+
|above          = aboveclass
+
|abovestyle      = background-color:#ccf
+
|headerstyle    = background-color:#ccf
+
|subheader      = subheaderclass,<br />subheaderrowclass
+
|subheader2      = subheaderclass,<br />subheaderclass2
+
|image          = imageclass,<br />imagerowclass
+
|caption        = (なし)
+
|image2          = imageclass,<br />imagerowclass2
+
|caption2        = (なし)
+
|header1  = class1
+
|label1  = rowclass1
+
|data1    = class1, rowclass1
+
|header2  = class2
+
|label2  = label2
+
|data2    = class2, rowclass2
+
|header3  = …
+
|label3  = …
+
|data3    = …
+
|header50  = class50
+
|label50  = rowclass50
+
|data50    = class50, rowclass50
+
|belowstyle = background-color:#ccf
+
|below = belowclass
+
 
}}
 
}}
 
{{Multicol-break}}
 
{{Multicol-break}}
 
=== スタイル ===
 
=== スタイル ===
{{Infobox/sandbox2
+
{{Infobox
 
|title          = titlestyle
 
|title          = titlestyle
 +
|titlestyle      = background-color:#ccf
 
|above          = abovestyle
 
|above          = abovestyle
 
|abovestyle      = background-color:#ccf
 
|abovestyle      = background-color:#ccf
73行目: 49行目:
 
|subheader      = subheaderstyle,<br />subheaderstyle1
 
|subheader      = subheaderstyle,<br />subheaderstyle1
 
|subheader2      = subheaderstyle,<br />subheaderstyle2
 
|subheader2      = subheaderstyle,<br />subheaderstyle2
|image          = imagestyle<br /> 
+
|image          = imagestyle,<br />imagestyle1
|caption        = captionstyle
+
|caption        = captionstyle,<br />captionstyle1
|image2          = imagestyle<br /> 
+
|image2          = imagestyle,<br />imagestyle2
|caption2        = captionstyle
+
|caption2        = captionstyle,<br />captionstyle2
 
|header1  = headerstyle
 
|header1  = headerstyle
 
|label1  = labelstyle
 
|label1  = labelstyle
86行目: 62行目:
 
|label3  = …
 
|label3  = …
 
|data3    = …
 
|data3    = …
|header50 = 同上
+
|header40 = 同上
|label50   = 同上
+
|label40   = 同上
|data50   = 同上
+
|data40   = 同上
 +
|below      = belowstyle
 
|belowstyle = background-color:#ccf
 
|belowstyle = background-color:#ccf
|below = belowstyle
+
|tnavbar = Infobox
 
}}
 
}}
 
{{multicol-end}}
 
{{multicol-end}}
 
{{Clear}}
 
{{Clear}}
 +
== Infobox使用テンプレートの移入時調整手順 ==
 +
*条件文は、表示崩れの原因になるため、除去します。
 +
*スタイルの設定がやや複雑に書かれていて、title行やsubheader行、caption行が活用されていない場合などは、入力先を整理して簡潔に書き直した方がいいと思います。
 +
*最下部のテンプレートへのリンクを表示したくない場合は、nameflagないしtnavbarflagの引数にNULL値を指定します。表示したい場合は、既にnameないしtnavbarが入力指定されていれば、そのままで問題ないと思いますが、入力指定がなければ、テンプレート名を入力指定します。
 +
 +
=== 限界 ===
 +
*ラベル付データ行は40行あり、それを超える行は表示されなくなります。
 +
*ラベル付データ行のラベルの列を消してデータを表示することはできません。
 +
*引数「child」を指定することによって、別のInfobox内に組込み可能なInfobox(Infoboxからtableタグをなくした版)にする機能はありません。
 +
*行の表示・非表示は、制御できません。条件文が使えない前提があり、また<nowiki>class{{{変数|}}}="hiddenStructure"</nowiki>のように書いて、「変数」に入力があったときコードを壊して出力表示させるというやり方を使うと、レイアウトが崩れ易くなるためです。
 +
:とはいえ、或る行に何も入力がなければ、行が細く表示されますので、
 +
:*画像の欄は、「画像ファイル」と「画像サイズ」と「画像コメント」を別々に入力する仕様にするよりも、「<nowiki>[[画像:画像ファイル{{!}}画像サイズ{{!}}画像コメント]]</nowiki>」をまとめて入力する仕様にする
 +
:*外部リンクの欄を作るときは、「URL」と「サイト名」を別々に入力する仕様にするよりも、「<nowiki>[URL サイト名]</nowiki>」をまとめて入力する仕様にする
 +
:など工夫すれば、それほど目立たなくなると思います。
  
 
== フォーマット ==
 
== フォーマット ==
<pre style="overflow:auto">{{Infobox
+
<pre style="overflow:auto">
|bodyclass =
+
{{Infobox
|bodystyle =
+
|bodyclass=
|title     =
+
|bodystyle=
|titleclass =
+
|title=
|titlestyle =
+
|titlestyle=
|above     =
+
|above=
|aboveclass =
+
|abovestyle=
|abovestyle =
+
|subheader=
 
+
|subheaderstyle=
|subheader         =
+
|subheader2=
|subheaderclass    =
+
|subheaderstyle2=
|subheaderrowclass =
+
|image=
|subheaderstyle   =
+
|imagestyle=
 
+
|caption=
|subheader2         =
+
|captionstyle=
|subheaderrowclass2 =
+
|image2=
 
+
|imagestyle2=
|image         =
+
|caption2=
|imageclass    =
+
|captionstyle2=
|imagerowclass =
+
|headerstyle=
|imagestyle   =
+
|labelstyle=
|caption       =
+
|datastyle=
|captionstyle =
+
|header1=
 
+
|label1=
|image2         =
+
|data1=
|imagerowclass2 =
+
|header2=
|caption2       =
+
|label2=
 
+
|data2=
|headerstyle =
+
|labelstyle =
+
|datastyle   =
+
 
+
|header1   =
+
|class1    =
+
|label1   =
+
|rowclass1 =
+
|data1     =
+
 
+
|header2   =
+
|class2    =
+
|label2   =
+
|rowclass2 =
+
|data2     =
+
 
.
 
.
 
.
 
.
 
.
 
.
|header50  =
+
|header40=
|class50    =
+
|label40=
|label50    =
+
|data40=
|rowclass50 =
+
|below=  
|data50    =
+
|belowstyle=
 
+
|tnavbar=
|below     =
+
|belowclass =
+
|belowstyle =
+
|tnavbar   =
+
 
}}
 
}}
 
</pre>
 
</pre>
159行目: 131行目:
 
<!--カテゴリは以下に追加してください-->
 
<!--カテゴリは以下に追加してください-->
 
[[Category:基礎情報テンプレート| ]]
 
[[Category:基礎情報テンプレート| ]]
[[Category:メタテンプレート|{{PAGENAME}}]]
+
[[Category:メタテンプレート]]
 
</includeonly>
 
</includeonly>

2018年5月27日 (日) 01:02時点における最新版

Tech Doc このページは、テンプレートの解説ページです。このページを直接参照すると、リンク先のページ名やURLを変数で指定しているリンク赤リンクになる場合がありますが、リンク先を指定し直さなくてよい場合もあります。リンクの設定の不具合に関する質問等は親ページの会話ページに投稿して下さい。

Infoboxテンプレートは、Infoboxを作成するためのメタテンプレートです。Wikipediaの同名テンプレートとの互換を実現するために作成しました。

引数一覧[編集]

  • body全体にかかる引数
    • bodyclass:cssクラスを指定します。既定値は「infobox」に設定されており、引数を指定すると「infobox (bodyclass)」という名前のクラスになります。
    • bodystyle:スタイルを指定します。既定値として「width:22em; clear:right; float:right」が設定されており、引数を指定するとスタイルが追加・修正されます。
  • 最下部の、テンプレート本体への内部リンク
    • nameまたはtnavbar:「テンプレート:ほげほげ」の「ほげほげ」にあたる文字列を入力します。
    • nameflagまたはtnavbarflag:引数にNULL値を指定すると、テンプレートへのリンクが出力表示されなくなります。

コンテンツ[編集]

title
above
subheader
 
subheader2
 
image
 
caption
 
image2
 
caption2
 
header1
label1data1
header2
label2data2
header40
label40data40
below
テンプレートを表示

スタイル[編集]

titlestyle
abovestyle
subheaderstyle,
subheaderstyle1
subheaderstyle,
subheaderstyle2
imagestyle,
imagestyle1
captionstyle,
captionstyle1
imagestyle,
imagestyle2
captionstyle,
captionstyle2
headerstyle
labelstyledatastyle
同上
同上同上
同上
同上同上
belowstyle
テンプレートを表示


Infobox使用テンプレートの移入時調整手順[編集]

  • 条件文は、表示崩れの原因になるため、除去します。
  • スタイルの設定がやや複雑に書かれていて、title行やsubheader行、caption行が活用されていない場合などは、入力先を整理して簡潔に書き直した方がいいと思います。
  • 最下部のテンプレートへのリンクを表示したくない場合は、nameflagないしtnavbarflagの引数にNULL値を指定します。表示したい場合は、既にnameないしtnavbarが入力指定されていれば、そのままで問題ないと思いますが、入力指定がなければ、テンプレート名を入力指定します。

限界[編集]

  • ラベル付データ行は40行あり、それを超える行は表示されなくなります。
  • ラベル付データ行のラベルの列を消してデータを表示することはできません。
  • 引数「child」を指定することによって、別のInfobox内に組込み可能なInfobox(Infoboxからtableタグをなくした版)にする機能はありません。
  • 行の表示・非表示は、制御できません。条件文が使えない前提があり、またclass{{{変数|}}}="hiddenStructure"のように書いて、「変数」に入力があったときコードを壊して出力表示させるというやり方を使うと、レイアウトが崩れ易くなるためです。
とはいえ、或る行に何も入力がなければ、行が細く表示されますので、
  • 画像の欄は、「画像ファイル」と「画像サイズ」と「画像コメント」を別々に入力する仕様にするよりも、「[[画像:画像ファイル{{!}}画像サイズ{{!}}画像コメント]]」をまとめて入力する仕様にする
  • 外部リンクの欄を作るときは、「URL」と「サイト名」を別々に入力する仕様にするよりも、「[URL サイト名]」をまとめて入力する仕様にする
など工夫すれば、それほど目立たなくなると思います。

フォーマット[編集]

{{Infobox
|bodyclass=
|bodystyle=
|title=
|titlestyle=
|above=
|abovestyle=
|subheader=
|subheaderstyle=
|subheader2=
|subheaderstyle2=
|image=
|imagestyle=
|caption=
|captionstyle=
|image2=
|imagestyle2=
|caption2=
|captionstyle2=
|headerstyle=
|labelstyle=
|datastyle=
|header1=
|label1=
|data1=
|header2=
|label2=
|data2=
.
.
.
|header40=
|label40=
|data40=
|below= 
|belowstyle=
|tnavbar=
}}