「テンプレート:Infobox」の版間の差分
提供: Yourpedia
								
												
				|  ({{jawp}} 2010年4月18日 (日) 15:11 (UTC) で上書き。) | |||
| 1行目: | 1行目: | ||
| − | < | + | <noinclude>{{Template sandbox notice}}</noinclude>{{#ifeq:{{{child|}}}|yes||<table class="infobox {{{bodyclass|}}}" style="width:22em; {{{bodystyle|}}}"><!-- | 
|   Caption |   Caption | ||
| − | -->{{#if:{{{title|}}}|<caption class="{{{titleclass | + | -->{{#if:{{{title|}}}|<caption {{#if:{{{titleclass|}}}|class="{{{titleclass}}}"}} {{#if:{{{titlestyle|}}}|style="{{{titlestyle}}}"}}>{{{title}}}</caption>}}<!-- | 
|   Header |   Header | ||
| − | -->{{#if:{{{above|}}}|{{ | + | -->{{#if:{{{above|}}}|<tr><th colspan=2 {{#if:{{{aboveclass|}}}|class="{{{aboveclass}}}"}} style="text-align:center; font-size:125%; font-weight:bold; {{{abovestyle|}}}">{{{above}}}</th></tr>}} | 
| − | + | }}{{#ifeq:{{{child|}}}|yes|{{#if:{{{title|}}}|'''{{{title}}}'''}}}}<!-- | |
| − | + | ||
| − | }} }}<!-- | + | |
|   Subheader1 |   Subheader1 | ||
| − | -->{{#if:{{{subheader|}}}|{{Infobox/row | + | -->{{#if:{{{subheader|{{{subheader1|}}}}}}|{{Infobox/row | 
| − |   |data={{{subheader}}}  | + |   |data={{{subheader|{{{subheader1|}}}}}} | 
| − |   |class={{{subheaderclass|}}}  | + |  |datastyle={{{subheaderstyle|{{{subheaderstyle1|}}}}}} | 
| + |   |class={{{subheaderclass|}}} | ||
| + |  |rowclass={{{subheaderrowclass|{{{subheaderrowclass1|}}}}}} | ||
| }} }}<!-- | }} }}<!-- | ||
|   Subheader2 |   Subheader2 | ||
| -->{{#if:{{{subheader2|}}}|{{Infobox/row | -->{{#if:{{{subheader2|}}}|{{Infobox/row | ||
| − |   |data={{{subheader2}}}  | + |   |data={{{subheader2}}} | 
| − |   |class={{{subheaderclass|}}}  | + |  |datastyle={{{subheaderstyle|{{{subheaderstyle2|}}}}}} | 
| + |   |class={{{subheaderclass|}}} | ||
| + |  |rowclass={{{subheaderrowclass2|}}} | ||
| }} }}<!-- | }} }}<!-- | ||
|   Image1 |   Image1 | ||
| -->{{#if:{{{image|{{{image1|}}}}}}|{{Infobox/row | -->{{#if:{{{image|{{{image1|}}}}}}|{{Infobox/row | ||
| − |   |data={{{image|{{{image1}}} }}}{{#if:{{{caption|{{{caption1|}}}}}}|<div style="{{{captionstyle|}}}">{{{caption|{{{caption1}}}}}}</div>}}  | + |   |data={{{image|{{{image1}}} }}}{{#if:{{{caption|{{{caption1|}}}}}}|<div style="{{{captionstyle|}}}">{{{caption|{{{caption1}}}}}}</div>}} | 
| − |   |class={{{imageclass|}}}  | + |  |datastyle={{{imagestyle|}}} | 
| + |   |class={{{imageclass|}}} | ||
| + |  |rowclass={{{imagerowclass1|}}} | ||
| }} }}<!-- | }} }}<!-- | ||
|   Image2 |   Image2 | ||
| -->{{#if:{{{image2|}}}|{{Infobox/row | -->{{#if:{{{image2|}}}|{{Infobox/row | ||
| − |   |data={{{image2}}}{{#if:{{{caption2|}}}|<div style="{{{captionstyle|}}}">{{{caption2}}}</div>}}  | + |   |data={{{image2}}}{{#if:{{{caption2|}}}|<div style="{{{captionstyle|}}}">{{{caption2}}}</div>}} | 
| − |   |class={{{imageclass|}}}  | + |  |datastyle={{{imagestyle|}}} | 
| + |   |class={{{imageclass|}}} | ||
| + |  |rowclass={{{imagerowclass2|}}} | ||
| }} }}<!-- | }} }}<!-- | ||
| -->{{Infobox/row | -->{{Infobox/row | ||
| 428行目: | 434行目: | ||
|   |class={{{class80|}}}   |rowclass={{{rowclass80|}}} |   |class={{{class80|}}}   |rowclass={{{rowclass80|}}} | ||
| }}<!-- Below | }}<!-- Below | ||
| − | -->{{#if:{{{below|}}}|<tr><td colspan= | + | -->{{#if:{{{below|}}}|<tr><td colspan=2 {{#if:{{{belowclass|}}}|class="{{{belowclass}}}"}} style="text-align:center; {{{belowstyle|}}}">{{{below}}}</td></tr>}}<!-- | 
| − | + |   Navbar | |
| − | -->{{#if:{{{name|{{{tnavbar|}}}}}}|<tr><td colspan= | + | -->{{#if:{{{name|{{{tnavbar|}}}}}}|<tr class="noprint"><td colspan=2 style="text-align:right; font-size:85%">[[{{transclude|{{{name|{{{tnavbar}}}}}}}}|テンプレートを表示]]</td></tr>}} | 
| − | </table> | + | {{#ifeq:{{{child|}}}|yes||</table>}}<noinclude> | 
| − | {{ | + | {{Documentation}} | 
| − | + | <!-- カテゴリと言語間リンクはここではなく、/doc サブページに追加してください --></noinclude> | |
| − | <!-- カテゴリと言語間リンクはここではなく、/doc サブページに追加してください --> | + | |
| − | </noinclude> | + | |
2011年9月7日 (水) 21:40時点における版
| ここは、テンプレート:Infoboxのテンプレート・サンドボックスです。対応するテストケース・サブページもご覧ください。 | 
| {{{above}}} | |
|---|---|
| </tr> }}{{#if:| | |
| {{{subheader2}}} | </tr> }}{{#if:| | 
| {{{image1}}} {{#if:| {{{caption1}}}}} | </tr> }}{{#if:| | 
| {{{image2}}}{{#if:| {{{caption2}}}}} | </tr> }} | 
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr> | |
| </tr>{{#if:| | |
| {{{below}}} | |
Infoboxテンプレートは、Infoboxを作成するためのメタテンプレートです。Wikipediaの同名テンプレートとの互換を実現するために作成しました。
引数一覧
- body全体にかかる引数
- bodyclass:cssクラスを指定します。既定値は「infobox」に設定されており、引数を指定すると「infobox (bodyclass)」という名前のクラスになります。
- bodystyle:スタイルを指定します。既定値として「width:22em; clear:right; float:right」が設定されており、引数を指定するとスタイルが追加・修正されます。
 
- 最下部の、テンプレート本体への内部リンク
- nameまたはtnavbar:「テンプレート:ほげほげ」の「ほげほげ」にあたる文字列を入力します。
- nameflagまたはtnavbarflag:引数にNULL値を指定すると、テンプレートへのリンクが出力表示されなくなります。
 
| コンテンツ
 | スタイル
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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=
}}


