Difference between revisions of "Template:Infobox chinese food"
([CFWK] Add empty defaults to all Infobox params to stop {{{param}}} leak) |
([CFWK] Add optional cuisine/heritage/GI/last-verified fields) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{| cellspacing="0" width="138px" style="padding: 0.1em; margin:1px 1px 0.5em 0.5em; border: #BBBBBB 1px solid; background: #FFFFF0; text-align: center; float: right;" class="editsection" | {| cellspacing="0" width="{{{width|138px}}}" style="padding: 0.1em; margin:1px 1px 0.5em 0.5em; border: #BBBBBB 1px solid; background: #FFFFF0; text-align: center; float: right;" class="editsection cfwk-infobox cfwk-infobox-food" | ||
|[[File:{{{image | |{{#if:{{{image|}}}|[[File:{{{image}}}|220px|thumb|center]] | ||
{{{caption|}}} | {{{caption|}}}}} | ||
{| class="wikitable" | {| class="wikitable cfwk-ib-rows" | ||
|- | |- | ||
| Alternative names || {{{alternate_name|}}} | | Alternative names || {{{alternate_name|}}} | ||
| Line 14: | Line 14: | ||
| Place of origin || {{{country|}}} | | Place of origin || {{{country|}}} | ||
|- | |- | ||
| Region or state || {{{region|}}} | | Region or state || {{{region|}}}{{#if:{{{cuisine|}}}|<nowiki/> | ||
{{!}}- class="cfwk-ib-row cfwk-ib-cuisine" | |||
{{!}} Cuisine {{!}}{{!}} {{{cuisine}}}}} | |||
|- | |- | ||
| Other || {{{other|}}} | | Other || {{{other|}}}{{#if:{{{heritage|}}}|<nowiki/> | ||
{{!}}- class="cfwk-ib-row cfwk-ib-heritage" | |||
{{!}} Intangible heritage {{!}}{{!}} {{{heritage}}}}}<!-- | |||
-->{{#if:{{{gi|}}}|<nowiki/> | |||
{{!}}- class="cfwk-ib-row cfwk-ib-gi" | |||
{{!}} Geographical indication {{!}}{{!}} {{{gi}}}}}<!-- | |||
-->{{#if:{{{last_verified|}}}|<nowiki/> | |||
{{!}}- class="cfwk-ib-row cfwk-ib-last-verified" | |||
{{!}} Last verified {{!}}{{!}} {{{last_verified}}}}} | |||
|} | |} | ||
|}<noinclude> | |}<noinclude> | ||
== Documentation == | |||
'''Infobox chinese food''' is the summary box for individual dishes, snacks, ingredients, condiments and drinks. For province, city and district food pages, use [[Template:Infobox food region]]. | |||
The rows ''Alternative names'', ''Pinyin'', ''Type'', ''Course'', ''Place of origin'', ''Region or state'' and ''Other'' are always shown, as they have been since the template was created. The four newer rows (''Cuisine'', ''Intangible heritage'', ''Geographical indication'' and ''Last verified'') only appear when their parameter is filled. | |||
=== Blank syntax === | |||
<pre> | |||
{{Infobox chinese food | |||
| image = | |||
| caption = | |||
| width = | |||
| alternate_name = | |||
| pinyin = | |||
| type = | |||
| course = | |||
| country = | |||
| region = | |||
| cuisine = | |||
| other = | |||
| heritage = | |||
| gi = | |||
| last_verified = | |||
}} | |||
</pre> | |||
=== Parameters === | |||
{| class="wikitable" | |||
! Parameter !! Label shown !! Shown when empty? !! Description | |||
|- | |||
| <code>image</code> || — || no || File name without the <code>File:</code> prefix. When it is empty, nothing is shown (no raw markup). | |||
|- | |||
| <code>caption</code> || — || no || Text under the image. Only used together with <code>image</code>. | |||
|- | |||
| <code>width</code> || — || — || Width of the box. The default is <code>138px</code> (the box grows to fit the 220 px image). Some place pages use <code>270px</code>. | |||
|- | |||
| <code>alternate_name</code> || Alternative names || yes || Other English names and the Chinese name. | |||
|- | |||
| <code>pinyin</code> || Pinyin || yes || Pinyin with tone marks. | |||
|- | |||
| <code>type</code> || Type || yes || For example ''Noodle soup'', ''Condiment'' or ''Huangjiu (rice wine)''. | |||
|- | |||
| <code>course</code> || Course || yes || Course or occasion. | |||
|- | |||
| <code>country</code> || Place of origin || yes || Usually ''China''. | |||
|- | |||
| <code>region</code> || Region or state || yes || Province, city or region of origin. | |||
|- | |||
| <code>cuisine</code> || Cuisine || no || Culinary tradition the item belongs to, for example <code><nowiki>[[Sichuan Food|Sichuan cuisine]]</nowiki></code>. ''New (2026-09).'' | |||
|- | |||
| <code>other</code> || Other || yes || Short free-text note (cooking time, related items, etc.). | |||
|- | |||
| <code>heritage</code> || Intangible heritage || no || National-level intangible cultural heritage (ICH) listing. It must be backed by the [https://www.ihchina.cn ihchina.cn] record, cited in the article body. ''New (2026-09).'' | |||
|- | |||
| <code>gi</code> || Geographical indication || no || Geographical indication (GI) status. It must be backed by the CNIPA ([https://www.cnipa.gov.cn cnipa.gov.cn]) record, cited in the article body. ''New (2026-09).'' | |||
|- | |||
| <code>last_verified</code> || Last verified || no || Year and month the box was last checked against sources, for example <code>2026-09</code>. ''New (2026-09).'' | |||
|} | |||
A few older pages also pass <code>name</code>, <code>national_cuisine</code>, <code>year</code>, <code>main_ingredient</code>, <code>minor_ingredient</code>, <code>similar_dish</code>, <code>mintime</code> or <code>maxtime</code>. This template does not display these parameters. | |||
=== CSS hooks === | |||
The outer table has the classes <code>cfwk-infobox cfwk-infobox-food</code>, the inner table has <code>cfwk-ib-rows</code>, and each optional row has <code>cfwk-ib-row cfwk-ib-''parameter''</code>. These classes have no styling yet. They exist so that mobile CSS can be added later in MediaWiki:Common.css. | |||
=== TemplateData === | |||
<templatedata> | |||
{ | |||
"description": "Summary box for Chinese dishes, snacks, ingredients and drinks.", | |||
"format": "block", | |||
"params": { | |||
"image": { | |||
"label": "Image", | |||
"description": "File name without the File: prefix.", | |||
"type": "wiki-file-name", | |||
"suggested": true | |||
}, | |||
"caption": { | |||
"label": "Caption", | |||
"description": "Text under the image.", | |||
"type": "content" | |||
}, | |||
"width": { | |||
"label": "Width", | |||
"description": "Box width; default 138px (grows to fit the image). Some place pages use 270px.", | |||
"type": "string" | |||
}, | |||
"alternate_name": { | |||
"label": "Alternative names", | |||
"description": "Other names, including the Chinese name.", | |||
"type": "content", | |||
"suggested": true | |||
}, | |||
"pinyin": { | |||
"label": "Pinyin", | |||
"description": "Pinyin with tone marks.", | |||
"type": "string", | |||
"suggested": true | |||
}, | |||
"type": { | |||
"label": "Type", | |||
"description": "Kind of food or drink.", | |||
"type": "content", | |||
"suggested": true | |||
}, | |||
"course": { | |||
"label": "Course", | |||
"description": "Course or occasion.", | |||
"type": "content" | |||
}, | |||
"country": { | |||
"label": "Place of origin", | |||
"description": "Usually China.", | |||
"type": "content", | |||
"suggested": true | |||
}, | |||
"region": { | |||
"label": "Region or state", | |||
"description": "Province, city or region of origin.", | |||
"type": "content", | |||
"suggested": true | |||
}, | |||
"cuisine": { | |||
"label": "Cuisine", | |||
"description": "Culinary tradition, e.g. [[Sichuan Food|Sichuan cuisine]]. Row hidden when empty.", | |||
"type": "content" | |||
}, | |||
"other": { | |||
"label": "Other", | |||
"description": "Short free-text note.", | |||
"type": "content" | |||
}, | |||
"heritage": { | |||
"label": "Intangible heritage", | |||
"description": "National-level ICH listing; must be backed by an ihchina.cn record cited in the article body. Row hidden when empty.", | |||
"type": "content" | |||
}, | |||
"gi": { | |||
"label": "Geographical indication", | |||
"description": "GI status; must be backed by a CNIPA record cited in the article body. Row hidden when empty.", | |||
"type": "content" | |||
}, | |||
"last_verified": { | |||
"label": "Last verified", | |||
"description": "Year-month last checked, e.g. 2026-09. Row hidden when empty.", | |||
"type": "string" | |||
} | |||
}, | |||
"paramOrder": [ | |||
"image", | |||
"caption", | |||
"width", | |||
"alternate_name", | |||
"pinyin", | |||
"type", | |||
"course", | |||
"country", | |||
"region", | |||
"cuisine", | |||
"other", | |||
"heritage", | |||
"gi", | |||
"last_verified" | |||
] | |||
} | |||
</templatedata> | |||
</noinclude> | |||
Latest revision as of 16:12, 25 September 2026
|
Documentation
Infobox chinese food is the summary box for individual dishes, snacks, ingredients, condiments and drinks. For province, city and district food pages, use Template:Infobox food region.
The rows Alternative names, Pinyin, Type, Course, Place of origin, Region or state and Other are always shown, as they have been since the template was created. The four newer rows (Cuisine, Intangible heritage, Geographical indication and Last verified) only appear when their parameter is filled.
Blank syntax
{{Infobox chinese food
| image =
| caption =
| width =
| alternate_name =
| pinyin =
| type =
| course =
| country =
| region =
| cuisine =
| other =
| heritage =
| gi =
| last_verified =
}}
Parameters
| Parameter | Label shown | Shown when empty? | Description |
|---|---|---|---|
image |
— | no | File name without the File: prefix. When it is empty, nothing is shown (no raw markup).
|
caption |
— | no | Text under the image. Only used together with image.
|
width |
— | — | Width of the box. The default is 138px (the box grows to fit the 220 px image). Some place pages use 270px.
|
alternate_name |
Alternative names | yes | Other English names and the Chinese name. |
pinyin |
Pinyin | yes | Pinyin with tone marks. |
type |
Type | yes | For example Noodle soup, Condiment or Huangjiu (rice wine). |
course |
Course | yes | Course or occasion. |
country |
Place of origin | yes | Usually China. |
region |
Region or state | yes | Province, city or region of origin. |
cuisine |
Cuisine | no | Culinary tradition the item belongs to, for example [[Sichuan Food|Sichuan cuisine]]. New (2026-09).
|
other |
Other | yes | Short free-text note (cooking time, related items, etc.). |
heritage |
Intangible heritage | no | National-level intangible cultural heritage (ICH) listing. It must be backed by the ihchina.cn record, cited in the article body. New (2026-09). |
gi |
Geographical indication | no | Geographical indication (GI) status. It must be backed by the CNIPA (cnipa.gov.cn) record, cited in the article body. New (2026-09). |
last_verified |
Last verified | no | Year and month the box was last checked against sources, for example 2026-09. New (2026-09).
|
A few older pages also pass name, national_cuisine, year, main_ingredient, minor_ingredient, similar_dish, mintime or maxtime. This template does not display these parameters.
CSS hooks
The outer table has the classes cfwk-infobox cfwk-infobox-food, the inner table has cfwk-ib-rows, and each optional row has cfwk-ib-row cfwk-ib-parameter. These classes have no styling yet. They exist so that mobile CSS can be added later in MediaWiki:Common.css.
TemplateData
Summary box for Chinese dishes, snacks, ingredients and drinks.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Image | image | File name without the File: prefix. | File | suggested |
| Caption | caption | Text under the image. | Content | optional |
| Width | width | Box width; default 138px (grows to fit the image). Some place pages use 270px. | String | optional |
| Alternative names | alternate_name | Other names, including the Chinese name. | Content | suggested |
| Pinyin | pinyin | Pinyin with tone marks. | String | suggested |
| Type | type | Kind of food or drink. | Content | suggested |
| Course | course | Course or occasion. | Content | optional |
| Place of origin | country | Usually China. | Content | suggested |
| Region or state | region | Province, city or region of origin. | Content | suggested |
| Cuisine | cuisine | Culinary tradition, e.g. [[Sichuan Food|Sichuan cuisine]]. Row hidden when empty. | Content | optional |
| Other | other | Short free-text note. | Content | optional |
| Intangible heritage | heritage | National-level ICH listing; must be backed by an ihchina.cn record cited in the article body. Row hidden when empty. | Content | optional |
| Geographical indication | gi | GI status; must be backed by a CNIPA record cited in the article body. Row hidden when empty. | Content | optional |
| Last verified | last_verified | Year-month last checked, e.g. 2026-09. Row hidden when empty. | String | optional |