வார்ப்புரு:Rail icon/doc
{{Documentation subpage}}
 {{High-use}}
 {{Sidebar Adjacent stations}}
 {{Template shortcut|ric}}
 {{Lua|Module:Adjacent stations}}
 
 '''Template:Rail icon''' returns an icon, an image or another preset value, from a subpage of {{tl|Adjacent stations}}.
 
 == Usage ==
 &lt;code&gt;Module:Adjacent stations/&lt;var&gt;system&lt;/var&gt;&lt;/code&gt; must exist for this template to work.
 * {{tlx|Rail icon|&lt;var&gt;system&lt;/var&gt;}}
 * {{tlx|Rail icon|&lt;var&gt;system&lt;/var&gt;|&lt;var&gt;line&lt;/var&gt;}}
 * {{tlx|Rail icon|&lt;var&gt;system&lt;/var&gt;|&lt;var&gt;line&lt;/var&gt;|&lt;var&gt;branch&lt;/var&gt;}}
 
 === Variables ===
 * &lt;var&gt;system&lt;/var&gt; is the name of the system or an abbreviation.
 * &lt;var&gt;line&lt;/var&gt; is the line name, if any.
 * &lt;var&gt;branch&lt;/var&gt; is the name of the branch or service, if any.
 
 == Parameters ==
 Optional parameters:
 * {{para|size}} – image size, expressed as width (&lt;code&gt;15px&lt;/code&gt;), height (&lt;code&gt;x15px&lt;/code&gt;) or both if necessary (&lt;code&gt;15x15px&lt;/code&gt;).
 * {{para|link}} – image link (full page name)
 * {{para|alt}} – [[alt text]]
 * {{para|bold}} – setting for some types of text-based icon; default is &quot;yes&quot; for all of those types
 * {{para|name|y}} – setting to any value will add the system or line name.
 
 == Examples ==
 Using [[Module:Adjacent stations/MTR]]:
 * {{tlx|Rail icon|MTR|_show_result=y}}
 * {{tlx|Rail icon|MTR|name{{=}}y|_show_result=y}}
 * {{tlx|Rail icon|MTR|Island|_show_result=y}}
 * {{tlx|Rail icon|MTR|Island|name{{=}}y|_show_result=y}}
 * {{tlx|Rail icon|MTR|ISL|_show_result=y}} (using the &quot;isl&quot; 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, {{tl|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 &lt;code&gt;p&lt;/code&gt;, or otherwise the table after &lt;code&gt;return&lt;/code&gt;. Lua tables (&lt;code&gt;{ &lt;var&gt;...&lt;/var&gt; }&lt;/code&gt;) contain ''keys'' and ''values'', which can be in the format &lt;code&gt;[&quot;&lt;var&gt;key&lt;/var&gt;&quot;] = &lt;var&gt;value&lt;/var&gt;&lt;/code&gt;. Values can be strings/characters (&lt;code&gt;&quot;&lt;var&gt;value&lt;/var&gt;&quot;&lt;/code&gt;, tables, or other values. Key–value pairs are separated by commas.
 
 In the main (outermost) table, either or both of the keys &quot;icon format&quot; and &quot;icon&quot; can be used to specify an icon (i.e. as an entry in the table like &lt;code&gt;[&quot;icon&quot;] = &quot;&lt;var&gt;value&lt;/var&gt;&quot;&lt;/code&gt;).
 
 The value for &quot;icon&quot; 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 &quot;icon format&quot; key and it is not &quot;image&quot;, then {{tl|Rail color box}} is used, with the display style being the value of &quot;icon format&quot;; all inputs except &quot;alt&quot; and &quot;size&quot; are passed through appropriately. (Note that {{tl|Rail color box}} does not currently work without a line name.)
 
 Lines are added as tables with named keys inside the &quot;lines&quot; table, which is inside the main table (i.e. &lt;code&gt;... [&quot;lines&quot;] = {[&quot;&lt;var&gt;line name&lt;/var&gt;&quot;] = { &lt;var&gt;... line table ...&lt;/var&gt; } } ...&lt;/code&gt;). Entries for &quot;icon format&quot; and &quot;icon&quot; work similarly inside these tables. If many lines have the same icon format, then a &quot;line icon format&quot; 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 &quot;icon format&quot; and &quot;icon&quot; work similarly inside these tables. If many types have the same icon format, then a &quot;type icon format&quot; value can be added to the main table.
 
 Lines and types can have aliases; these are all listed in the table with the key &quot;aliases&quot; 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. &lt;code&gt;... [&quot;aliases&quot;] = {[&quot;r&quot;] = &quot;Red&quot;, [&quot;b&quot;] = &quot;Blue&quot;} ...&lt;/code&gt;, where both &quot;Red&quot; and &quot;Blue&quot; are valid line or type names).
 
 If {{tl|Rail color box}} is used, then the key &quot;color&quot; and any of the keys &quot;line title&quot;, &quot;branch title&quot;, &quot;short name&quot; and &quot;text color&quot; should be present in the applicable table.
 
 == See also ==
 *{{tl|Rail-interchange}} (abbreviated {{tl|rint}}) for a similar template that has icons for many more systems.
 
 &lt;includeonly&gt;{{Sandbox other||
 [[Category:Internal article-link templates]]
 [[Category:Rail transport templates]]