Khác biệt giữa bản sửa đổi của “Bản mẫu:Hộp thông tin/doc”

Nội dung được xóa Nội dung được thêm vào
n →‎top: clean up using AWB
Không có tóm lược sửa đổi
Dòng 2:
{{chú ý|'''Bản mẫu này {{đỏ|không được [[Wikipedia:Thay thế bản mẫu|thay thế]]}}.}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->
{{distinguishPhân biệt|Template:Userbox}}
<includeonly>{{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2 }} | old | <!-- null --> | {{lua|Module:Infobox}} }}</includeonly>
Bản mẫu này được sử dùng để viết các bản mẫu khác. Nó không được khuyến khích dùng trực tiếp vào bài viết, tuy nhiên vẫn có thể dùng được trong trường hợp cần thiết. Xem [[:en:Help:Infobox]] về hướng dẫn viết hộp thông tin và cách thức viết chúng. Tham khảo [[Wikipedia:Cẩm nang biên soạn]] và [[:Thể loại:Bản mẫu hộp thông tin]] để xem các bản mẫu đã viết.
 
This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See [[Help:Infobox]] for an introduction to infoboxes and information on how to design them. See [[:Category:Infobox templates]] for specific infobox templates.
 
Hàng 28 ⟶ 30:
Examples:
 
{{Hộp thông tin
{{Infobox
| name = Infobox/doc
| title = Text in caption over infobox
Hàng 35 ⟶ 37:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| name = {{subst:PAGENAME}}
| title = Text in caption over infobox
Hàng 43 ⟶ 45:
</pre>{{clear}}
 
{{Hộp thông tin
{{Infobox
| name = Infobox/doc
| above = Text in uppermost cell of infobox
Hàng 51 ⟶ 53:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| name = {{subst:PAGENAME}}
| above = Text in uppermost cell of infobox
Hàng 69 ⟶ 71:
; data(n) : Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.
 
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{paraThông số|header''(n)''}} will cause the corresponding {{paraThông số|data''(n)''}} (and {{paraThông số|rowclass''(n)''}} {{paraThông số|label''(n)''}}, see below) to be ignored; the absence of a {{paraThông số|data''(n)''}} will cause the corresponding {{paraThông số|label''(n)''}} to be ignored. Valid combinations for any single row are:
 
* {{paraThông số|class''(n)''}} {{paraThông số|header''(n)''}}
* {{paraThông số|rowclass''(n)''}} {{paraThông số|class''(n)''}} {{paraThông số|data''(n)''}}
* {{paraThông số|rowclass''(n)''}} {{paraThông số|label''(n)''}} {{paraThông số|class''(n)''}} {{paraThông số|data''(n)''}}
 
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.
Hàng 116 ⟶ 118:
===== Hiding headers when all data fields are hidden =====
You can also make headers optional in a similar way. Consider this example:
{{Hộp thông tin
{{Infobox
| title = Example of an undesirable header
| header1 = Undesirable header
Hàng 126 ⟶ 128:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| title = Example of an undesirable header
| header1 = Undesirable header
Hàng 139 ⟶ 141:
If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:
 
{{Hộp thông tin
{{Infobox
| title = Example of an optional header
| header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
Hàng 149 ⟶ 151:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| title = Example of an optional header
| header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
Hàng 172 ⟶ 174:
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter.
 
* Turn on italic titles by passing {{paraThông số|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox.
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{paraThông số|italic title|<nowiki>{{{italic title|no}}}</nowiki>}}
* Do not make any titles italic by not passing the parameter at all.
 
Hàng 228 ⟶ 230:
Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell :
 
{{Hộp thông tin
{{Infobox
|name = Infobox/doc
|bodystyle =
Hàng 269 ⟶ 271:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
|name = {{subst:PAGENAME}}
|bodystyle =
Hàng 313 ⟶ 315:
For this example, the '''bodystyle''' and '''labelstyle''' parameters are used to adjust the infobox width and define a default width for the column of labels:
 
{{Hộp thông tin
{{Infobox
|name = Infobox/doc
|bodystyle = width:20em
Hàng 344 ⟶ 346:
}}
<pre style="overflow: auto">
{{Hộp thông tin
{{Infobox
|name = {{subst:PAGENAME}}
|bodystyle = width:20em
Hàng 377 ⟶ 379:
 
=== Embedding ===
One infobox template can be embedded into another using the {{paraThông số|child}} parameter. This feature can be used to create a modular infobox, or to create more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infoboxHộp thông tin}}</nowiki></code>.
 
{{Hộp thông tin
{{Infobox
| title = Top level title
| data1 = {{InfoboxHộp thông tin| decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{InfoboxHộp thông tin| decat = yes | child = yes
|title = Second subsection
| label1= Label 2.1
Hàng 395 ⟶ 397:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| title = Top level title
| data1 = {{InfoboxHộp thông tin| decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| data2 = {{InfoboxHộp thông tin| decat = yes | child = yes
|title = Second subsection
| label1= Label 2.1
Hàng 414 ⟶ 416:
Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using
 
{{Hộp thông tin
{{Infobox
| title = Top level title
| header1 = {{InfoboxHộp thông tin| decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{InfoboxHộp thông tin| decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
Hàng 430 ⟶ 432:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| title = Top level title
| header1 = {{InfoboxHộp thông tin| decat = yes | child = yes
| title = First subsection
| label1= Label 1.1
| data1 = Data 1.1
}}
| header2 = {{InfoboxHộp thông tin| decat = yes | child = yes
| title = Second subsection
| label1= Label 2.1
Hàng 449 ⟶ 451:
or,
 
{{Hộp thông tin
{{Infobox
| title = Top level title
| header1 = First subsection
{{InfoboxHộp thông tin| decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{InfoboxHộp thông tin| decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
Hàng 465 ⟶ 467:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| title = Top level title
| header1 = First subsection
{{InfoboxHộp thông tin| decat = yes | child = yes
| label1 = Label 1.1
| data1 = Data 1.1
}}
| header2 = Second subsection
{{InfoboxHộp thông tin| decat = yes | child = yes
| label1 = Label 2.1
| data1 = Data 2.1
Hàng 482 ⟶ 484:
</pre>{{clear}}
 
Note that omitting the {{paraThông số|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation.
 
=== Subboxes ===
An alternative method for embedding is to use {{paraThông số|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.
 
{{Hộp thông tin
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{InfoboxHộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
Hàng 499 ⟶ 501:
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{InfoboxHộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
Hàng 507 ⟶ 509:
}}
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
| data3 = {{InfoboxHộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
Hàng 519 ⟶ 521:
| label3 = Label 3-3 | data3 = Data 3-3
}}
| data4 = {{InfoboxHộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
Hàng 535 ⟶ 537:
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{InfoboxHộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
Hàng 542 ⟶ 544:
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{InfoboxHộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
Hàng 554 ⟶ 556:
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{InfoboxHộp thông tin | subbox = yes
| headerstyle = background-color:#ccc;
| labelstyle = background-color:#ddd;
Hàng 561 ⟶ 563:
| label3 = Label 3-3 | data3 = Data 3-3
}}
| content4 = {{InfoboxHộp thông tin | subbox = yes
| labelstyle = background-color:#ccc;
| label1 = Label 4-1 | data1 = Data 4-1
Hàng 575 ⟶ 577:
 
<pre style="overflow:auto">
{{Hộp thông tin
{{Infobox
| name = {{subst:PAGENAME}}
| child = {{{child|}}}