Content deleted Content added
start a dab section |
|||
Line 346:
-->
|}
== For editors ==
=== Disambiguating stations ===
Station links are generated using the <code>station format</code> part of the data module. Each data module defines a default case and then exceptions, if necessary. <code>Station format</code> is an array, similar to a switch with cases. Take [[Module:Adjacent stations/Incheon Subway]], shown below:
{{syntaxhighlight|lang=lua|{{Module:Adjacent stations/Incheon Subway}}}}
The default case is <code>"%1 station"</code>, listed first. The "%1" expands to whatever the passed name of the station is. "Bakchon" becomes [[Bakchon station]]. There are several exceptions. The two usual reasons for exceptions are disambiguation or presenting a name in a non-standard way. In this case, the [[Incheon Subway]] serves three stations whose names are disambiguated: [[Arts Center station (Incheon)]], [[Central Park station (Incheon)]], and [[Mansu station (Incheon)]]. This is handled by specifying a key for each station and supplying a different format. Since all three are disambiguated the same way, you can define a local variable at the top of the module:
{{syntaxhighlight|lang=lua|code=local incheon = "%1 station (Incheon)"}}
This can then be used with the exceptions:
{{syntaxhighlight|lang=lua|code=["Arts Center"] = incheon,}}
Were it written out, it would look like this:
{{syntaxhighlight|lang=lua|code=["Arts Center"] = "%1 station (Incheon)"}}
== For developers ==
|