• 首页
  • 随机
  • 登录
  • 设置
  • 关于悠日計画 維基百科 ~ Yuuni Wiki
  • 免责声明
悠日計画 維基百科 ~ Yuuni Wiki

模板:Rail icon

  • 语言
  • 监视
  • 查看源代码
文件:Test Template Info-Icon - Version (2).svg Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 6,200 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Pages related to
Module:Adjacent stations
(talk | sandbox | sub-pages)
{{Infobox station}}
(talk | sandbox | testcases)
{{Station link}}
(talk | sandbox | testcases)
{{Rail color}}
(talk | sandbox | testcases)
{{Line link}}
(talk | sandbox | testcases)
{{Rail icon}}
(talk | sandbox | testcases)
{{Rail color box}}
(talk | sandbox | testcases)
{{Adjacent stations}}
(talk | sandbox | testcases)
  • v
  • t
  • e
Shortcut
  • {{ric}}
文件:Lua-logo-nolabel.svg此模板使用Lua语言:
  • Module:Adjacent stations

Template:Rail icon returns an icon, an image or another preset value, from a subpage of {{Adjacent stations}}.

目录

  • 1 Usage
    • 1.1 Variables
  • 2 Parameters
  • 3 Examples
  • 4 Addition of values in module subpages
  • 5 See also

Usage

Module:Adjacent stations/system must exist for this template to work.

  • {{Rail icon|system}}
  • {{Rail icon|system|line}}
  • {{Rail icon|system|line|branch}}

Variables

  • system is the name of the system or an abbreviation.
  • line is the line name, if any.
  • branch is the name of the branch or service, if any.

Parameters

Optional parameters:

  • |size= – image size, expressed as width (15px), height (x15px) or both if necessary (15x15px).
  • |link= – image link (full page name)
  • |alt= – alt text
  • |bold= – setting for some types of text-based icon; default is "yes" for all of those types
  • |name=y – setting to any value will add the system or line name.

Examples

Using Module:Adjacent stations/MTR:

  • {{Rail icon|MTR}} → MTR
  • {{Rail icon|MTR|name=y}} → MTR MTR
  • {{Rail icon|MTR|Island}} →     
  • {{Rail icon|MTR|Island|name=y}} →      Island line
  • {{Rail icon|MTR|ISL}} →      (using the "isl" alias)

If there are two or more images by default, then the image-applicable values will be set for all of them.

Addition of values in module subpages

(For simplicity, {{Rail color box}} is used here to refer to the p._box function in Module:Adjacent stations.)

Each module subpage sends a Lua table to Module:Adjacent stations. The outermost table (often the table called p, or otherwise the table after return. Lua tables ({ ... }) contain keys and values, which can be in the format ["key"] = value. Values can be strings/characters ("value", tables, or other values. Key–value pairs are separated by commas.

In the main (outermost) table, either or both of the keys "icon format" and "icon" can be used to specify an icon (i.e. as an entry in the table like ["icon"] = "value").

The value for "icon" is the standard file syntax for an inline image; there should be alt text, a page link and a size value; see Wikipedia:Extended image syntax.

If there is a value for the "icon format" key and it is not "image", then {{Rail color box}} is used, with the display style being the value of "icon format"; all inputs except "alt" and "size" are passed through appropriately. (Note that {{Rail color box}} does not currently work without a line name.)

Lines are added as tables with named keys inside the "lines" table, which is inside the main table (i.e. ... ["lines"] = {["line name"] = { ... line table ... } } ...). Entries for "icon format" and "icon" work similarly inside these tables. If many lines have the same icon format, then a "line icon format" value can be added to the main table.

Types are added as tables inside their line tables (each type is a variation of a line). Entries for "icon format" and "icon" work similarly inside these tables. If many types have the same icon format, then a "type icon format" value can be added to the main table.

Lines and types can have aliases; these are all listed in the table with the key "aliases" inside the main table. The keys in that table should be lowercase, and the values should refer to the key of a branch or line table (e.g. ... ["aliases"] = {["r"] = "Red", ["b"] = "Blue"} ..., where both "Red" and "Blue" are valid line or type names).

If {{Rail color box}} is used, then the key "color" and any of the keys "line title", "branch title", "short name" and "text color" should be present in the applicable table.

See also

  • {{Rail-interchange}} (abbreviated {{rint}}) for a similar template that has icons for many more systems.
The above documentation is transcluded from 模板:Rail icon/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
检索自“https://wiki.czzzz.work/index.php?title=模板:Rail_icon&oldid=2372”
最后编辑于2022年9月19日 (星期一) 21:17

语言

    此页面在其他语言不可用。

    悠日計画 維基百科 ~ Yuuni Wiki
    • 此页面最后编辑于2022年9月19日 (星期一) 21:17。
    • 除非另有声明,本网站内容采用知识共享署名-非商业性使用-相同方式共享授权。
    • 隐私政策
    • 关于悠日計画 維基百科 ~ Yuuni Wiki
    • 免责声明
    • 桌面版