Editing
Module:Adjacent stations/doc
(section)
From Thetacola Wiki
Jump to navigation
Jump to search
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!
== 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)"}}
Summary:
Please note that all contributions to Thetacola Wiki 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
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information