This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[1] Notepad++[2] and Sublime Text[3].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
Usage
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[4] Notepad++[5] and Sublime Text[6].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
Usage
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[7] Notepad++[8] and Sublime Text[9].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
The asterisk indicating a text cell can be preceded by one of the BSicons' width prefixes. (Normal BSicons are square.)
Letters
o
c
d
cd
none
b
s
bs
w
Width
1⁄8
1⁄4
1⁄2
3⁄4
1
2
4
6
8
Icon overlay, icon link, background color and colspan
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
Usage
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[10] Notepad++[11] and Sublime Text[12].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
Usage
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[13] Notepad++[14] and Sublime Text[15].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
Usage
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[16] Notepad++[17] and Sublime Text[18].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
{{Routemap/sandbox/1|title=Example 3.2:<br/>Mixed odd and even rows
|tw=70
|map=
-startCollapsible-collapsed
d\KBHFa\d~~terminus
hKRZWae~~ ~~ ~~bridge
-endCollapsible-
BS2+l\BS2+r~~junction
}}
This template is used for constructing route diagram templates. It is the Lua-based successor of the {{BS-map}} templates, which have been superseded by {{Routemap/sandbox/1}} on the English Wikipedia but are still used on other wikis.
Usage
{{Routemap/sandbox/1|navbar =|navbar pos =|navbar mini =|title =|title color =|title bg =|bg =|inline =|collapsible =|collapse =|legend =|legend alt =|float =|style =|top =|footnote =|text-width =|map =}}
Markup for map parameter
关于a tabulated list of many of the pictograms available for railway Routemap/sandbox/1s,请见「commons:BSicon/Catalogue」。
If you've already read this section, you may want to skip to § Syntax overview.
The markup for composing the diagram in the |map= parameter is different to the {{BSrow}}-based templates. The major differences are the separators in each row. Subtemplates are not necessary, since a new row in the table is simply created by a carriage return (newline).
{{Routemap/sandbox/1
Add other parameters like |title= here.
|map=
Map markup goes here!
}}
The third and fourth pairs of tildes can be omitted if there is no content following either of them.
After the last icon ID, if there is only one set of "tilde-tilde" (~~), the following text will be displayed in the main text cell instead of dist./time.
Separating text cells requires at least one empty space; otherwise the tildes will be treated as a signature.
Overlay separator "exclamation mark-tilde" (!~) must follow the icon ID which is to be overlaid.
Overlay is practically unlimited, but legibility should be taken into account.
The width of the underlying icon determines the width of the combination, even if less than the overlay. The icons are aligned with their left edges together, so that they will not be centered on each other if they differ in width. If the overlay extends past the underlying icon, it will overlay the following icon (but not the following icon's overlay).
When using icon overlay and icon link for the same icon cell, the icon link separator (!@) must follow the last (top) overlaying icon ID.
The background color parameter (bg=) requires 5 sets of preceding text separators to be recognizable even if there is no text on that row whatsoever.
Other formatting options
Rows
{{Routemap/sandbox/1|title=Example 2.2
|map=
utSTR~~ ~~ ~~{{mono|1=bg=<abbrtitle="This is the normal BSicon color for watercourses.">#007CC3</abbr>}}~~ ~~bg=#007CC3
*1\*2\*3~~ ~~ ~~{{mono|1=color=red,bold=yes}}~~ ~~color=red,bold=yes
*A\*C\*E~~ ~~ ~~{{mono|1=align=l,b=1,fontsize=cmt}}~~ ~~align=left,b=1,fontsize=cmt
*B\*D\*F~~ ~~ ~~{{mono|1=colour=orange, align=b, i=y}}~~ ~~colour=orange, align=b, i=y
}}
Aside from bg=, there are several other parameters, separated by commas (,), which can be used to customize the display of a row. Only bg= can be used to change the display of icons; all others only affect text cells.
Parameters for a single icon or text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, or a single icon or text box with no overlays) are preceded by an exclamation mark and an underscore (!_). This must follow the link (if any).
For the last overlaid item in a stack, the individual item parameters (if any) must precede the stack parameters.
Most of the parameters are the same as those for rows, but there are a few additional ones. Additionally, the values for align=, bg= and color= will override the row parameter values.
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Dual text sidebar collapsible
Code
Result
{{Routemap/sandbox/1
|title=Example 6.1: All text cells applied
|text-width=,130,,,110,
|map=
~~km! !\\~~km~~
-startCollapsible
commuter terminus~~0{{0|00}}! !uKBHFa\leer\KBHFa~~{{0|00}}0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2{{0|00}}! !uKBHFe\\KBHFe~~{{0|00}}2~~regional terminus
}}
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\| → {{subst:$1/safesubst|, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[19] Notepad++[20] and Sublime Text[21].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template {{subst:convertbs}} can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Result
Safe substitution:
{{Routemap
|title=Demonstration
|map=
{{safesubst:BS/safesubst|KBHFa|0 km|A station|Shuttle bus}}
{{safesubst:BS3/safesubst|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{safesubst:BS/safesubst|KINTe|10 km|B station|City hub}}
-colspan-2
----
Not to scale
}}
Original:
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in <includeonly>...</includeonly> tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps
字符串
可选
Adjust |text-width= (or |tw=) parameter until there is no break.
Unit is "px" by default, but other units such as "em" are acceptable.
Check the map in different browser and in mobile view, and increase text-width if it breaks.
The icon number of the first row of collapsible section must be equal to or greater than the icon number of the widest non-collapsible row.
As in example 3.2, use half-width empty icon (d) as filler when you are mixing both odd and even rows in the same map.
Changing "collapsed" to "nil" will change the default state of the collapible section to uncollapsed.
~~km! !~~km~~
commuter terminus~~0! !uKBHFa\\KBHFa~~0~~regional terminus
River Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~ ~~ ~~bridge
transfer for HSR~~station~~1! !uINT\LDER\LSTR
commuter terminus~~2! !uKBHFe\\KBHFe~~2~~regional terminus
}}
Left text cells require "exclamation mark-space-exclamation mark" (! !) separating them from icon cells.
If there is no "tilde-tilde" (~~) separator to the left of "exclamation mark-space-exclamation mark", the text to the left of the separator will be displayed in the left main text cell.
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number)
-filler-...
Start of filler row
Transition from legacy BS row template to Routemap/sandbox/1 markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap/sandbox/1 have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap/sandbox/1. Opponents deem the map markups of Routemap/sandbox/1 to be too esoteric for editors unfamiliar with Routemap/sandbox/1 markup to modify. While proponents support a complete conversion for better performance. There is no consensus reached at the moment so any transition without massively updating the map appearance for reflecting service and/or structural change in reality should only be done with the following considerations:
The map of the legacy BS row template design has exceeded template size limit in the transcluding page, which means the template does not expand into its intended appearance but only the link to the template page is shown, so there is an imminent need to translate the map into Routemap/sandbox/1 design to reduce post-expand include size.
If there is no template size issue, respect the preference of the initial contributor of the first completed version of the diagram. If that contributor contests the change to Routemap/sandbox/1, retain the BS row template design.
Technical options
All BS row templates have had substitutable counterparts created; hence conversion can be easily done by prepending subst: and appending /safesubst to every BS row template name in the map. For example, change {{BS2|STR|BHF|0|1|2|3|O1=uSTRq}} in the map to {{subst:BS2/safesubst|STR|BHF|0|1|2|3|O1=uSTRq}}, then publish changes; it will produce STR!~uSTRq\BHF~~0~~1~~2~~3. The process can be sped up by using the "replace all" function of advanced edit tool or separate text editor such as Notepad or Notepad++, but the search rule for the BS row templates should ideally be a regular expression, like \{\{(BS\d*(\-2)?)\! → Template:((subst:$1/safesubst!, in order to avoid templates with similar names such as BSto and BSsplit in case they are present in the map.
"Column mode editing" can avoid the trouble of find and replace to add safesubst: on all rows efficiently. This function is common in advanced text editors like Geany,[22] Notepad++[23] and Sublime Text[24].
You can also use the "convertbs" function of Module:Routemap/sandbox/1.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
Then copy and paste the original BS-map or BS-table map code between the <nowiki> tags (alternatively paste the invoke convertbs header before the original map code and the </nowiki>}} ending after the map code) and show preview. It will generate the safesubst version and show the original versions (for comparison) of the map code. You copy the safesubst code from the preview area back to the edit area, and you should remove everything of #invoke:Routemap/sandbox/1|convertbs if the preview of the new code works properly.
On the English Wikipedia, the template Template:Tls can be used as a shortcut:
{{subst:convertbs|1=
}}
If it doesn't work, it's possible that you haven't copied some of the relevant code, such as table markup for BS-table diagrams, or that you've copied code which actually belongs to something else.
Example
{{#invoke:Routemap/sandbox/1|convertbs|<nowiki>
{{BS-map
|title=Demonstration
|map=
{{BS|KBHFa|0 km|A station|Shuttle bus}}
{{BS3|WASSERq|hKRZWae|WASSERq||||{{BSsplit|Suburb|Capital}}}}
{{BS|KINTe|10 km|B station|City hub}}
{{BS-colspan}}
----
Not to scale
}}
</nowiki>}}
Use {{{inline}}} to remove title bar and table border. If creating a separate template which will be embedded into an infobox, wrap inline=1 in Template:Tag tags. Also {{{navbar pos}}} is helpful to locate the Template:Tl better.
Remove title bar and border for transclusion in infobox
字符串
可选
Table title
title
Official title of the system. Value «no» will remove the table title row, but this will also disable the table collapsible switch as well
字符串
可选
Title font color
title colortitle-color
Color of the title's text; automatically black or white to contrast with the title background color. Only use colors that contrast well with the background color
默认值
#FFF or #252525; depends
字符串
可选
Title background color
title bg colortitle-bg
Background color of the title
默认值
#27404E
字符串
可选
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
字符串
可选
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
字符串
可选
Template name for Navbar
navbar
This must exactly match the diagram template page name so the Navbar template will appear and link to the template page
字符串
可选
Position of the Navbar
navbar pos
Position of the Navbar template. Float to left in the title bar by default; «1» for top-left corner of the map (just under the title bar); «2» for the middle bottom of the map
字符串
可选
Small navbar
navbar mini
If the navbar is not in default position, then this changes whether the navbar displays as "V · T · E" (default for navbar pos 1; values: «1», «y», «yes», «true») or "This diagram: view · talk · edit" (default for navbar pos 2; values: «0», «n», «no», «false»).
字符串
可选
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath», «road» or «track». «0» or «no» for no legend at all
默认值
Template:Railway line legend
页面名称
可选
Legend link text
legend alt
Different link name in place of «Legend» if desirable
默认值
Legend
字符串
可选
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
默认值
right
字符串
可选
Background color
bg
Background color of the whole map area
默认值
#F9F9F9
字符串
可选
CSS style values
style
Additional CSS style definition of the whole infobox
字符串
可选
Top note
topon top
Space for optional note or infobox above the map
字符串
可选
Bottom note
footnotebottom
Space for optional note or infobox below the map
字符串
可选
Width of map text cell
text-widthtw
Extend the width of the map text cell so the collapsible section within the map does not break
字符串
可选
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style. Use "map2", "map3" etc. for additional maps
字符串
必需
Map title
map-title
Title of map. Use "map2-title", "map3-title" etc. for titles of addition maps