Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Adjacent stations/doc
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== 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)"}}
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)