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

提供: Yourpedia
移動: 案内検索
(-tmp)
(テストも兼ねて、色々書き直し)
1行目: 1行目:
<noinclude><!-- カテゴリと言語間リンクはこのページの下に加えてください。 -->
+
'''Infobox'''テンプレートは、Infoboxを作成するための[[メタテンプレート]]です。記事に直接使われることは想定していません。現在、条件文を使わない版を開発中ですが、テンプレートの中でタグを使われると表示が壊れるバグが解消できていないため、まだ使えません。
{{Documentation subpage}}</noinclude><includeonly>
+
{{Pp-template}}
+
{{複雑なテンプレート}}</includeonly>
+
== 使い方 ==
+
このテンプレートはメタテンプレート(他のテンプレートを作成するときに使われるテンプレート)として使われることを想定しています。記事に直接使われることを想定していません。<!--ページが無いのでコメントアウト→一般的なInfoboxの作り方については[[Help:Infobox]]を見てください。-->
+
  
使い方は{{Tl|Navbox}}に似ていますが、追加された機能があります。テーブルの各行は「見出し」(header)でも、ラベルとデータ対でも、単なるデータセルでもありえます。また、ある行に見出しとラベル/データ対の両方を定義すればラベル/データ対は無視されます。
+
== 引数一覧 ==
 +
*body全体にかかる引数
 +
**クラス(class)は「infobox」が既定値になっており、引数「bodyclass」を指定すると、「infobox (bodyclass)」というクラスになります。
 +
**スタイル(style)は幅22em(width:22em)が規定値として設定されており、それ以外のスタイルは引数「bodystyle」で指定します。
 +
*最下部の、テンプレート本体への内部リンクは、引数「name」または「tnavbar」に「テンプレート:ほげほげ」の「ほげほげ」にあたる文字列を入力すると、正常に設定されます。
 +
*引数「child」を指定することによって、別のInfobox内に組込み可能なInfobox(Infoboxからtableタグをなくした版)にすることは、今のところ、できません。
  
Infoboxの最上部以外のどこかで画像を挿入したい場合、あるいは他の「自由な形式」のデータを挿入したい場合、<!-- そのような使用を許している -->“data”フィールドによる行を使うように注意してください。
 
=== パラメータ ===
 
このテンプレートでは全てのパラメータを省略可能です。
 
==== タイトル ====
 
タイトルをキャプションにする場合にはtitle、最上部のヘッダセルにする場合にはaboveを使います。通常はどちらか片方を使いますが、両方使うこともできます。
 
; title
 
: 表のキャプションに置くテキストです。
 
; above
 
: 表の最上部に置くテキストです。
 
; subheader,subheader2
 
: 表の最上部と画像の間に表示されるテキストです。
 
 
==== テキストなど ====
 
; name(またはtnavbar)
 
: 表の最下部の、テンプレート本体へのリンクを表示するために必要なテンプレート名です。<nowiki>{{subst:PAGENAME}}</nowiki>を使うことができますが、<nowiki><includeonly></includeonly></nowiki>をはさんでいる場合はsubst展開されないので注意してください。指定が無い場合はリンクが表示されません。
 
; image,image2
 
: テンプレートの上部に表示される画像です。<nowiki>[[ファイル:example.png|200px]]</nowiki>のような、完全な画像構文を使ってください。デフォルトで中央に表示されます。
 
; caption,caption2
 
: 画像の下に置くテキストです。
 
; header(n)
 
: 列nのヘッダとして使うテキストです。
 
; label(n)
 
: 列nのラベルとして使うテキストです。
 
; data(n)
 
: 列nのデータとして表示されるテキストです。
 
; below
 
: 最下行に置くテキストです。脚注、関連項目、その他の情報として使われることを想定しています。
 
 
==== CSSスタイル ====
 
; bodystyle
 
: Infobox全体のスタイル指定です。
 
; titlestyle
 
: タイトルセルだけのスタイル指定です。
 
; abovestyle
 
: 表の最上部のセルだけのスタイル指定です。
 
; imagestyle
 
: 画像があるセル(captionも含む)のスタイル指定です。
 
; captionstyle
 
: captionのテキストのスタイル指定です。
 
; headerstyle
 
: 全てのヘッダセルのスタイル指定です。
 
; labelstyle
 
: 全てのラベルセルのスタイル指定です。
 
; datastyle
 
: 全てのデータセルのスタイル指定です。
 
; belowstyle
 
: 最下行のセルだけのスタイル指定です。
 
 
==== マイクロフォーマット ====
 
; bodyclass
 
: このパラメータは、Infobox全体の「class」属性に挿入されます。デフォルトは<code>infobox</code>です。そのため、このパラメータに<code>bordered</code>と記述すると<code>infobox bordered</code>となるので、表全体に罫線が引かれます。
 
 
 
==== 組み込み ====
 
Infoboxテンプレートの<code>datax</code>に{{Para|child}}のパラメータを設定したInfoboxテンプレートの構文を記述することでInfobox内に別のInfoboxを組み込むことが出来ます。項目数を拡張した基礎情報テンプレートを作成できるなどの利点があります。{{Para|child}}を設定しないと二重に罫線が書かれるため見た目がよくありません。
 
{{Infobox
 
| data1 = {{Infobox
 
  | child = yes
 
  | title = 第1サブセクション
 
  | label1= ラベル1.1
 
  | data1 = データ1.1
 
}}
 
| data2 = {{Infobox
 
  | child = yes
 
  | title = 第2サブセクション
 
  | label1= ラベル2.1
 
  | data1 = データ2.1
 
}}
 
|belowstyle =
 
|below = 最下部テキスト
 
}}
 
<pre style="overflow:auto">{{Infobox
 
| data1 = {{Infobox
 
  | child = yes
 
  | title = 第1サブセクション
 
  | label1= ラベル1.1
 
  | data1 = データ1.1
 
}}
 
| data2 = {{Infobox
 
  | child = yes
 
  | title = 第2サブセクション
 
  | label1= ラベル2.1
 
  | data1 = データ2.1
 
}}
 
|belowstyle =
 
|below = 最下部テキスト
 
}}</pre>
 
 
== 表示例 ==
 
 
{{Multicol}}
 
{{Multicol}}
=== 通常 ===
+
=== コンテンツ ===
{{Infobox
+
{{Infobox/sandbox2
 
|title          = title
 
|title          = title
 
|above          = above
 
|above          = above
 
|abovestyle      = background-color:#ccf
 
|abovestyle      = background-color:#ccf
 
|headerstyle    = background-color:#ccf
 
|headerstyle    = background-color:#ccf
|subheader      = subheader
+
|subheader      = subheader<br /> 
|subheader2      = subheader2
+
|subheader2      = subheader2<br /> 
|image          = [[ファイル:Example.svg|200px]]
+
|image          = image<br /> 
 
|caption        = caption
 
|caption        = caption
|image2          = [[ファイル:Example.svg|200px]]
+
|image2          = image2<br /> 
 
|caption2        = caption2
 
|caption2        = caption2
 
|header1  = header1
 
|header1  = header1
 +
|label1  = label1
 +
|data1    = data1
 +
|header2  = header2
 
|label2  = label2
 
|label2  = label2
 
|data2    = data2
 
|data2    = data2
 +
|header3  = …
 +
|label3  = …
 +
|data3    = …
 +
|header50  = header50
 +
|label50  = label50
 +
|data50    = data50
 
|belowstyle = background-color:#ccf
 
|belowstyle = background-color:#ccf
 
|below = below
 
|below = below
 
}}
 
}}
 
{{Multicol-break}}
 
{{Multicol-break}}
=== bodyclassにborderedを指定 ===
+
=== クラス ===
{{Infobox
+
{{Infobox/sandbox2
|bodyclass      = bordered
+
|title          = titleclass
|title          = title
+
|above          = aboveclass
|above          = above
+
 
|abovestyle      = background-color:#ccf
 
|abovestyle      = background-color:#ccf
 
|headerstyle    = background-color:#ccf
 
|headerstyle    = background-color:#ccf
|subheader      = subheader
+
|subheader      = subheaderclass,<br />subheaderrowclass
|subheader2      = subheader2
+
|subheader2      = subheaderclass,<br />subheaderclass2
|image          = [[ファイル:Example.svg|200px]]
+
|image          = imageclass,<br />imagerowclass
|caption        = caption
+
|caption        = (なし)
|image2          = [[ファイル:Example.svg|200px]]
+
|image2          = imageclass,<br />imagerowclass2
|caption2        = caption2
+
|caption2        = (なし)
|header1  = header1
+
|header1  = class1
 +
|label1  = rowclass1
 +
|data1    = class1, rowclass1
 +
|header2  = class2
 
|label2  = label2
 
|label2  = label2
|data2    = data2
+
|data2    = class2, rowclass2
 +
|header3  = …
 +
|label3  = …
 +
|data3    = …
 +
|header50  = class50
 +
|label50  = rowclass50
 +
|data50    = class50, rowclass50
 
|belowstyle = background-color:#ccf
 
|belowstyle = background-color:#ccf
|below = below
+
|below = belowclass
 +
}}
 +
{{Multicol-break}}
 +
=== スタイル ===
 +
{{Infobox/sandbox2
 +
|title          = titlestyle
 +
|above          = abovestyle
 +
|abovestyle      = background-color:#ccf
 +
|headerstyle    = background-color:#ccf
 +
|subheader      = subheaderstyle,<br />subheaderstyle1
 +
|subheader2      = subheaderstyle,<br />subheaderstyle2
 +
|image          = imagestyle<br /> 
 +
|caption        = captionstyle
 +
|image2          = imagestyle<br /> 
 +
|caption2        = captionstyle
 +
|header1  = headerstyle
 +
|label1  = labelstyle
 +
|data1    = datastyle
 +
|header2  = 同上
 +
|label2  = 同上
 +
|data2    = 同上
 +
|header3  = …
 +
|label3  = …
 +
|data3    = …
 +
|header50  = 同上
 +
|label50  = 同上
 +
|data50    = 同上
 +
|belowstyle = background-color:#ccf
 +
|below = belowstyle
 
}}
 
}}
 
{{multicol-end}}
 
{{multicol-end}}
141行目: 97行目:
 
== フォーマット ==
 
== フォーマット ==
 
<pre style="overflow:auto">{{Infobox
 
<pre style="overflow:auto">{{Infobox
|bodyclass       =  
+
|bodyclass =
|bodystyle       =  
+
|bodystyle =
|title           =  
+
|title     =
|titlestyle     =  
+
|titleclass =
|above           =  
+
|titlestyle =
|abovestyle     =  
+
|above     =
 +
|aboveclass =
 +
|abovestyle =
  
|subheader       =  
+
|subheader         =
|subheader2      =  
+
|subheaderclass    =
|subheaderstyle =  
+
|subheaderrowclass =
 +
|subheaderstyle   =
  
|image          =
+
|subheader2         =
|caption         =  
+
|subheaderrowclass2 =
|image2          =
+
|caption2        =
+
|imagestyle      =
+
|captionstyle    =  
+
  
|headerstyle    =  
+
|image        =
|labelstyle      =  
+
|imageclass    =
|datastyle       =  
+
|imagerowclass =
 +
|imagestyle    =
 +
|caption       =
 +
|captionstyle  =
  
|header1  =  
+
|image2        =
|label1  =  
+
|imagerowclass2 =
|data1    =  
+
|caption2      =
|header2  =
+
 
|label2  =
+
|headerstyle =
|data2    =  
+
|labelstyle =
|header3 =  
+
|datastyle   =
|label3   =  
+
 
|data3    =
+
|header1   =
|header4  =
+
|class1   =
|label4   =  
+
|label1   =
|data4   =  
+
|rowclass1 =
|header5  =
+
|data1    =
|label5  =
+
 
|data5   =  
+
|header2   =
|header6  =  
+
|class2   =
|label6  =  
+
|label2   =
|data6    =
+
|rowclass2 =
|header7  =
+
|data2    =
|label7   =  
+
|data7   =  
+
|header8  =
+
|label8  =
+
|data8   =  
+
|header9  =  
+
|label9  =
+
|data9    =
+
|header10 =
+
|label10  =
+
|data10  =
+
|header11 =
+
|label11  =
+
|data11  =
+
|header12 =
+
|label12  =
+
|data12  =
+
|header13 =
+
|label13  =
+
|data13  =
+
|header14 =
+
|label14  =
+
|data14  =
+
|header15 =
+
|label15  =
+
|data15  =
+
|header16 =
+
|label16  =
+
|data16  =
+
|header17 =
+
|label17  =
+
|data17  =
+
|header18 =
+
|label18  =
+
|data18  =
+
|header19 =
+
|label19  =
+
|data19  =
+
|header20 =
+
|label20  =
+
|data20  =  
+
 
.
 
.
 
.
 
.
 
.
 
.
|header80 =  
+
|header50  =
|label80  =  
+
|class50    =
|data80  =  
+
|label50    =
 +
|rowclass50 =
 +
|data50    =
  
 +
|below      =
 +
|belowclass =
 
|belowstyle =
 
|belowstyle =
|below =  
+
|tnavbar    =
 
}}
 
}}
</pre><includeonly>
+
</pre>
  
 +
<includeonly>
 
<!--カテゴリは以下に追加してください-->
 
<!--カテゴリは以下に追加してください-->
 
[[Category:基礎情報テンプレート| ]]
 
[[Category:基礎情報テンプレート| ]]
 
[[Category:メタテンプレート|{{PAGENAME}}]]
 
[[Category:メタテンプレート|{{PAGENAME}}]]
 
+
</includeonly>
<!--言語間リンクは以下に追加してください-->
+
[[ar:قالب:قالب معلومات]]
+
[[be-x-old:Шаблён:Картка]]
+
[[bg:Шаблон:Infobox]]
+
[[bs:Šablon:Infokutija]]
+
[[cs:Šablona:Infobox]]
+
[[da:Skabelon:Infoboks-en]]
+
[[de:Vorlage:Infobox]]
+
[[en:Template:Infobox]]
+
[[eo:Ŝablono:Informkesto]]
+
[[et:Mall:Infobox]]
+
[[es:Plantilla:Ficha]]
+
[[fa:الگو:دادان]]
+
[[fr:Modèle:Infobox]]
+
[[hsb:Předłoha:Infokašćik]]
+
[[ia:Patrono:Infobox]]
+
[[it:Template:Infobox]]
+
[[is:Snið:Infobox]]
+
[[ka:თარგი:ინფოდაფა]]
+
[[ko:틀:정보상자]]
+
[[mk:Шаблон:Infobox]]
+
[[no:Mal:Infoboks]]
+
[[nn:Mal:Infoboks]]
+
[[os:Шаблон:Infobox]]
+
[[pt:Predefinição:Info]]
+
[[ru:Шаблон:Карточка]]
+
[[sk:Šablóna:Infobox]]
+
[[sl:Predloga:Infopolje]]
+
[[sv:Mall:Infobox]]
+
[[th:แม่แบบ:กล่องข้อมูล]]
+
[[tr:Şablon:Infobox]]
+
[[uk:Шаблон:Картка]]
+
[[zh:Template:Infobox]]</includeonly>
+

2018年5月10日 (木) 20:28時点における版

Infoboxテンプレートは、Infoboxを作成するためのメタテンプレートです。記事に直接使われることは想定していません。現在、条件文を使わない版を開発中ですが、テンプレートの中でタグを使われると表示が壊れるバグが解消できていないため、まだ使えません。

引数一覧

  • body全体にかかる引数
    • クラス(class)は「infobox」が既定値になっており、引数「bodyclass」を指定すると、「infobox (bodyclass)」というクラスになります。
    • スタイル(style)は幅22em(width:22em)が規定値として設定されており、それ以外のスタイルは引数「bodystyle」で指定します。
  • 最下部の、テンプレート本体への内部リンクは、引数「name」または「tnavbar」に「テンプレート:ほげほげ」の「ほげほげ」にあたる文字列を入力すると、正常に設定されます。
  • 引数「child」を指定することによって、別のInfobox内に組込み可能なInfobox(Infoboxからtableタグをなくした版)にすることは、今のところ、できません。


フォーマット

{{Infobox
|bodyclass  =
|bodystyle  =
|title      =
|titleclass =
|titlestyle =
|above      =
|aboveclass =
|abovestyle =

|subheader         =
|subheaderclass    =
|subheaderrowclass =
|subheaderstyle    =

|subheader2         =
|subheaderrowclass2 =

|image         =
|imageclass    =
|imagerowclass =
|imagestyle    =
|caption       =
|captionstyle  =

|image2         =
|imagerowclass2 =
|caption2       =

|headerstyle =
|labelstyle  =
|datastyle   =

|header1   =
|class1    =
|label1    =
|rowclass1 =
|data1     =

|header2   =
|class2    =
|label2    =
|rowclass2 =
|data2     =
.
.
.
|header50   =
|class50    =
|label50    =
|rowclass50 =
|data50     =

|below      = 
|belowclass =
|belowstyle =
|tnavbar    =
}}