Template:Comma

来自Terraria Wiki
跳到导航 跳到搜索
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
See Template:Comma/l10n for the localization of this template.
Template-info.svg 文档 以下文档来自Template:Comma/doc。(编辑 | 历史

Separate items with commas. It uses the "Oxford Comma" way(for English).

Usage

{{comma|or=y|<item>|<item>|...||<item>}}

or

If set, it will use "or" as the separator between last 2 items. By default it will use "and".

all numbered parameters

List items. Empty parameter(s) will be ignored.

sep1, sep2, sep3

Override default separators. default seprators are ,, and / or (for 2 items), , and /, or (for 3 or more items)

-OR-

{{comma/start|or=y}}{{comma/item|<item>}}{{comma/item|<item>}}{{comma/item|<item>}}{{comma/item|<item>}}{{comma/end|}}

By this way, you can handle a variable number of items(usually used in templates). See {{Distinguish}} for example.

Examples

Code Output
{{comma|A}} A
{{comma|A|B}} A和B FAIL! (expected: A and B)
{{comma|A|B|C}} A、B、和C FAIL! (expected: A, B, and C)
{{comma|A|B|C|D}} A、B、C、和D FAIL! (expected: A, B, C, and D)
{{comma|A||C|D}} A、C、和D FAIL! (expected: A, C, and D)
{{comma|A||C|||||H}} A、C、和H FAIL! (expected: A, C, and H)
{{comma|or=y|A}} A
{{comma|or=y|A|B}} A或B FAIL! (expected: A or B)
{{comma|or=y|A|B|C}} A、B、或C FAIL! (expected: A, B, or C)
{{comma|or=y|A|B|C|D}} A、B、C、或D FAIL! (expected: A, B, C, or D)
{{comma|A|B|C|D|sep1=×|sep3=×...×}} A×B×C×...×D
{{comma|or=y|A|B|C|D|sep1=×|sep3=×...×}} A×B×C×...×D
{{comma/start}}{{comma/item|A}}{{comma/item|B}}{{comma/end}} A和B FAIL! (expected: A and B)
{{comma/start}}{{comma/item|A}}{{comma/item|B}}{{comma/item|C}}{{comma/item|D}}{{comma/end}} A、B、C、和D FAIL! (expected: A, B, C, and D)
{{comma/start|or=y}}{{comma/item|A}}{{comma/item|B}}{{comma/item|C}}{{comma/end}} A、B、或C FAIL! (expected: A, B, or C)
{{comma/start}}{{comma/item|A}}{{comma/item|B}}{{comma/item|C}}{{comma/end|or=y}} A、B、或C FAIL! (expected: A, B, or C)
{{comma/start}}{{comma/end}}
{{comma/start|sep1=×|sep3=×...×}}{{comma/item|A}}{{comma/item|B}}{{comma/item|C}}{{comma/item|D}}{{comma/end}} A×B×C×...×D