Wikipedia:Route diagram template/Transwiki guide

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Route diagram template (RDT) project involves lots of templates to be functional, in order to allow the map in other Wiki which has not yet adopted this project to display correctly, you will need to copy the required templates carefully. If you have more questions regarding transwikiing this project, go to the home discussion page, Wikipedia talk:Route diagram template, and leave the message.

Icon[edit]

You do not need to upload any icons to your local Wiki because they are shared in Wikimedia Commons. However, if your Wiki project is not directly affiliated to Wikimedia Foundation such as Wikia, you do need to upload all the license-free icons to your local Wiki web space, or enable InstantCommons if possible. You can find all the icons of this project in Commons:category:BSicon and its subcategories, or check the catalog of pictograms for list of explanation of the icons. For starter, you will at least need   (KBHFa),   (BHF),   (STR) and   (KBHFe) to compose the most basic map.

Module and template[edit]

Since 2013, Lua module has been created to replace the original method of stacking BS row templates repeatedly to form the route map which not only improves the loading speed and resource usage, but also provides unlimited horizontal icon columns and overlapping layers. The Routemap module is being developed and tested. Ongoing updates are expected but the overall format of forming the basic route map is already stable, so Wikimedia projects have not yet adopted the RDT project are recommended to directly copy the module and transcluding template and make minor adjustments or localization if needed.

The module itself will work perfectly without translating anything inside it (which are technically commented notes). The only real changes that should be made to the module is the width of the collapsible button which differ from language to language. These are at the lines ["row-collapsible-left-button-width"] and ["row-collapsible-right-button-width"]. Change the width values so they fit just the longest length of the show/hide and expand/collapse buttons. Also the name of the category which groups diagram with error or improper usage should be translated as well.

Transition from legacy BS template to Routemap module[edit]

Here shows the example of how the old and new methods will produce the similar route map:

Legacy Lua module
Syntax
{{BS-map
|title = ABC Railway
|collapsible = 0
|map =
{{BS|KBHFa||Terminus A}}
{{BS3|WASSERq|WBRÜCKE|WASSERq|||Bridge B}}
{{BS3|BOOT|BHF|||Station C|ferry pier}}
{{BS3|BS2c2|BS2lr|BS2c3|||Junction D}}
{{BS2|KBHFe|STR||Terminus E}}
{{BS2||STR|O2=INCIDO||Crash site}}
{{BS2||KBHFe||Terminus F}}
}}
{{Routemap
|title = ABC Railway
|collapsible = 0
|map =
KBHFa~~Terminus A
WASSERq\WBRÜCKE\WASSERq~~ ~~ ~~Bridge B
BOOT\BHF\~~ ~~Station C~~ferry pier
BS2c2\BS2lr\BS2c3~~ ~~ ~~Junction D
KBHFe\STR~~Terminus E
\STR!~INCIDO~~Crash site
\KBHFe~~Terminus F
}}
Result
ABC Railway
Terminus A
Bridge B
Station Cferry pier
Junction D
Terminus E
Crash site
Terminus F
ABC Railway
Terminus A
Bridge B
Station C
ferry pier
Junction D
Terminus E
Crash site
Terminus F

When translating big map from legacy format to Lua, it would be a huge time saver to use the safesubst function. This requires adding the safesubst commands in all original BS row templates like the English versions do. When it is done correctly, for example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{safesubst:BS2|STR|BHF|0|1|2|3|O1=uSTRq}}, then save change, it will produce STR!~uSTRq\BHF~~0~~1~~2~~3.

If for whatever reason you cannot use safesubst in your home wiki, then use the "search and replace" Vector toolbar search-replace button.png function of enhanced edit toolbar (which requires enabling last 2 options of toolbar in Preferences-Editing-Editor) or copy the map codes to a text editor (e.g. Notepad++) capable of text replacement to do the transition and then copy it back to the wiki editor. Note that because the icon IDs are case-sensitive, you MUST check "match case" before proceeding replacement.

But before making any replacement, you should search carefully if the map has used the overlapping function (the "highlight all" option of find in some browser will help tremendously). If all overlapping parameters are lined up right after the icons of base and lower layer in the correct order, you can instantly apply the replacement of |O1=, |O2=, etc. by !~. Otherwise you should reline the overlapping parameters and values manually before replacing so you do not need to guess or check back and forth for the correct order of superimposition after the change.

The other thing you should look carefully is the additional templates used inside the BS row template such as {{RoutemapRoute}} and {{Rail-interchange}}. The initial character following the vertical bar | in the template could conflict with the icon ID. For example, if you are going to replace |K by \K for   (KBHFa) and   (KRWl) but there is also {{rmr|licon=u|Kingsland}} in the map code, you may consider changing the replacing rule to more specific |KB by \KB and |KR by \KR to avoid changing {{rmr|licon=u|Kingsland}} to {{rmr|licon=u\Kingsland}} at the same time.

Legacy BS templates[edit]

See also[edit]

  • Meta:Help:Transwiki
  • Mediawiki:Version, if you are running your own Wiki for a long time, your Wiki software might be outdated. Some Wiki syntax or parser used by this project are not available in the older versions.