Template:Routemap
{{#ifeq:routemap |doc
|
{{#ifeq:show |show
| Template:Mbox }}{{#if: | | {{#ifexist:Template:Routemap | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
This template is used on approximately 14,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Related pages |
---|
{{#if:
}}{{#ifeq: |yes
|{{{content}}} |}}
|
This template uses Lua: |
This template uses TemplateStyles: |
This Lua-based template replaces the older parser-function-based {{BS-map}} (and deprecated {{Railway line header}}, {{BS-header}} and {{BS-table}}) templates for Wikipedia:Route diagram templates because diagrams created by {{Routemap}} load faster.
Usage
{{routemap | inline = | title = | title color = | title bg = | collapsible = | collapse = | navbar = | navbar pos = | navbar mini = | legend = | legend alt = | float = | bg = | style = | top = | footnote = | text-width = | map = }}
Markup for map parameter
The markup for composing the diagram in the |{{SAFESUBST:#if:map|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).
{{#if:{{Routemap Add other parameters like|{{SAFESUBST:#if:title|title=}}
here. |map= Map markup goes here! }}|{{Routemap Add other parameters like|{{SAFESUBST:#if:title|title=}}
here. |map= Map markup goes here! }}}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
Basic
Example 1.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
{{#if:icon ID\icon ID\icon ID|icon ID\icon ID\icon ID}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
- Icons are separated by the backslash
\
. - Each group of icons is centered in its row. The nameless icon (at the start of row 5 in the diagram) can be used as a spacer.
- The ID of each icon can be seen in its tooltip. Move your cursor over the icons to see them.
Sidebar text
{{#if:icon ID\icon ID\icon ID~~dist./time~~main text~~remark~~right remark|icon ID\icon ID\icon ID~~dist./time~~main text~~remark~~right remark}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
or
{{#if:icon ID\icon ID\icon ID~~main text|icon ID\icon ID\icon ID~~main text}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
{{Routemap |title=Example 1.2 |map= KBHFa~~terminus WASSERq\hKRZWae\WASSERq~~ ~~ ~~ ~~Bridge LDER\INT\~~1 km~~station~~transfer for HSR \KBHFe\BUS~~2 km~~terminus~~bus terminal }} |
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 1.2 | map=
KBHFa~~terminus WASSERq\hKRZWae\WASSERq~~ ~~ ~~ ~~Bridge LDER\INT\~~1 km~~station~~transfer for HSR \KBHFe\BUS~~2 km~~terminus~~bus terminal }} |
- 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.
Text cells in icon rows
{{#if:*text\d*text\cd*text~~main text|*text\d*text\cd*text~~main text}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
<source lang="moin">
|
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 1.3 | map=
ENDEa~~ ~~ ~~Reversing siding SPLa cBS\vSTR\cBS~~Station d*1\cBS\vSTR\cBS\d*2~~ ~~ ~~Platform numbers cBS\vSTR\cBS vCONTfge~~ ~~ ~~to City }} |
The asterisk indicating a text cell can be preceded by one of the BSicons' width prefixes. (Normal BSicons are square.)
Letters | c |
d |
cd |
none | b |
s |
bs |
w
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Width | {{#if: | 1 4⁄{{{3}}} | {{#if:4 | 1⁄4 | {{#if:1 | 1⁄1 | ⁄
}} }} }} || {{#if: |
1 2⁄{{{3}}} | {{#if:2 | 1⁄2 | {{#if:1 | 1⁄1 | ⁄
}} }} }} || {{#if: |
3 4⁄{{{3}}} | {{#if:4 | 3⁄4 | {{#if:3 | 1⁄3 | ⁄
}} }} }} || 1 || 2 || 4 || 6 || 8 |
Icon overlay, icon link, background color and colspan
<source lang="moin">
|
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 2.1 | map=
-colspan-1 Icon overlay uSTRq!~STR2!~BHF!~lHUB\\dSTR!~uSTRq\dSTR!~dNULf -colspan-2-style=border-bottom:5px solid red; icon link utBHF!@Superhub -colspan background color -colspan-end utSTR~~ ~~ ~~ ~~ ~~bg=#7af }} |
- 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
{{ {{#ifeq:0|0|{{{{#if:||FULL}}BASEPAGENAME}}|{{{{#if:||FULL}}PAGENAME}}}} |collapsible=0 |legend=0 |title=Example 2.2 |map= utSTR~~ ~~ ~~{{ safesubst:#if: |{{ safesubst:#ifeq:{{{demo}}} |no
| |
}} |{{ safesubst:#ifeq:Template|Template
| |
}}}}bg=#007CC3~~ ~~bg=#007CC3
- 1\*2\*3~~ ~~ ~~{{ safesubst:#if:
|{{ safesubst:#ifeq:{{{demo}}} |no
| |
}} |{{ safesubst:#ifeq:Template|Template
| |
}}}}color=red,bold=yes~~ ~~color=red,bold=yes
- A\*C\*E~~ ~~ ~~{{ safesubst:#if:
|{{ safesubst:#ifeq:{{{demo}}} |no
| |
}} |{{ safesubst:#ifeq:Template|Template
| |
}}}}align=l,b=1,fontsize=cmt~~ ~~align=left,b=1,fontsize=cmt
- B\*D\*F~~ ~~ ~~{{ safesubst:#if:
|{{ safesubst:#ifeq:{{{demo}}} |no
| |
}} |{{ safesubst:#ifeq:Template|Template
| |
}}}}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.
Row parameters | ||
---|---|---|
Parameter name | Values | Result |
bg= , background= or bgcolor=
|
Any X11 color name, RGB hex triplet or other valid values of the CSS background property | Row background is colored |
color= or colour=
|
Any X11 color name or RGB hex triplet | Text cells in a row are colored |
b= or bold=
|
1 , yes , y or true
|
Text cells in a row are emboldened |
i= , it= or italic=
|
1 , yes , y or true
|
Text cells in a row are italicized |
align=
|
No or invalid value | Text in cells is centered horizontally and vertically |
l or left
|
Text in cells is aligned to the left | |
r or right
|
Text in cells is aligned to the right | |
a , t or top
|
Text in cells is aligned to the top | |
e , b or bottom
|
Text in cells is aligned to the bottom | |
la , tl , c4 , nw , top-left or topleft
|
Text in cells is aligned to the top-left corner | |
ra , tr , c1 , ne , top-right or topright
|
Text in cells is aligned to the top-right corner | |
le , bl , c3 , sw , bottom-left or bottomleft
|
Text in cells is aligned to the bottom-left corner | |
re , br , c2 , se , bottom-right or bottomright
|
Text in cells is aligned to the bottom-right corner | |
fontsize=
|
No value | Text in cells is 10px high and is transformed to be narrower (example)
|
info or main
|
Text in cells is the same size as the large sidebar text (second column from center) | |
cmt or comment
|
Text in cells is the same size as the small sidebar text (other columns) | |
Any valid values of the CSS font-size property | Text in cells is a different size (percentages are relative to the large sidebar text) |
Individual cells/icons
{{#if:icon!_bg=purple\*text__align=l!~*more text__align=r,b=yes|icon!_bg=purple\*text__align=l!~*more text__align=r,b=yes}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
- 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=
andcolor=
will override the row parameter values.
Icon, text box and overlay stack parameters | ||||
---|---|---|---|---|
Parameter name | Values | Result | ||
bg= , background= or bgcolor=
|
Any X11 color name, RGB hex triplet or other valid values of the CSS background property | Background is colored This should not be used with overlays above icons. | ||
color= or colour=
|
Any X11 color name or RGB hex triplet | All the text of a cell, or the text of an individual text box, is colored | ||
b= or bold=
|
1 , yes , y or true
|
Boldfaced text | ||
i= , it= or italic=
|
1 , yes , y or true
|
Italicized text | ||
align=
|
No or invalid value | Text is aligned per parameters of its parent (default: centered vertically and horizontally) | ||
l or left
|
Text is aligned to… (vertical / horizontal) "Inherit" indicates that the cell will inherit its parent's value for that axis. |
inherit | left | |
r or right
|
inherit | right | ||
a , t or top
|
top | inherit | ||
e , b or bottom
|
bottom | inherit | ||
la , tl , c4 , nw , top-left or topleft
|
top | left | ||
ra , tr , c1 , ne , top-right or topright
|
top | right | ||
le , bl , c3 , sw , bottom-left or bottomleft
|
bottom | left | ||
re , br , c2 , se , bottom-right or bottomright
|
bottom | right | ||
c , center or centre
|
inherit | center | ||
m or middle
|
middle | inherit | ||
ma , tc , top-center , top-centre , topcenter or topcentre
|
top | center | ||
me , bc , bottom-center , bottom-centre , bottomcenter or bottomcentre
|
bottom | center | ||
lm , ml , middle-left or middleleft
|
middle | left | ||
rm , mr , middle-right or middleright
|
middle | right | ||
cm , mc , middle-center , middle-centre , middlecenter or middlecentre
|
middle | center | ||
fontsize=
|
No value | Text is 10px high and is transformed to be narrower (example)
| ||
info or main
|
Text is the same size as the large sidebar text (second column from center) | |||
cmt or comment
|
Text is the same size as the small sidebar text (other columns) | |||
Any valid values of the CSS font-size property | Text is a different size (percentages are relative to the large sidebar text) | |||
abbr=
|
Pretty much anything that doesn't mess up the MediaWiki markup | Text has dotted underline and a tooltip containing the text after abbr= This will not have any effect if used on an overlay stack. |
Collapsible
{{Routemap |title=Example 3.1: Basic collapsible |text-width=80 |map= -startCollapsible-collapsed \KBHFa\~~terminus hSTRa@g WASSERq\hKRZW\WASSERq~~ ~~ ~~ ~~bridge hSTRe@f -endCollapsible- LDER\INT\~~ ~~station~~transfer for HSR \KBHFe\BUS~~ ~~terminus~~bus terminal }} |
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 3.1: Basic collapsible | text-width=80 | map=
-startCollapsible-collapsed \KBHFa\~~terminus hSTRag WASSERq\hKRZW\WASSERq~~ ~~ ~~ ~~bridge hSTRef -endCollapsible- LDER\INT\~~ ~~station~~transfer for HSR \KBHFe\BUS~~ ~~terminus~~bus terminal }} |
{{Routemap |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 }} |
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 3.2: Mixed odd and even rows |
tw=70 | map=
-startCollapsible-collapsed d\KBHFa\d~~terminus hKRZWae~~ ~~ ~~bridge -endCollapsible- BS2+l\BS2+r~~junction }} |
- Adjust
|{{SAFESUBST:#if:text-width|text-width=}}
(or|{{SAFESUBST:#if:tw|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.
| no | 0 =
| #default = ({{#if:|{{{alt}}}|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.
Collapsible replacement
{{Routemap |title=Example 4.1 |text-width=150 |map= KBHFa~~terminus -startCollapsible-collapsed-replace \LSTR\~~hidden section \hSTRa@g\ WASSERq\hKRZW\WASSERq~~ ~~ ~~viaduct hSTRe@f -endCollapsible- LDER\INT\~~ ~~station~~transfer for HSR \KBHFe\BUS~~ ~~terminus~~bus terminal }} |
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 4.1 | text-width=150 | map=
KBHFa~~terminus -startCollapsible-collapsed-replace \LSTR\~~hidden section \hSTRag\ WASSERq\hKRZW\WASSERq~~ ~~ ~~viaduct hSTRef -endCollapsible- LDER\INT\~~ ~~station~~transfer for HSR \KBHFe\BUS~~ ~~terminus~~bus terminal }} |
{{Routemap |title=Example 4.2: Empty filler |text-width=150 |map= -startCollapsible-collapsed-replace exCONTg~~under construction leer exKBHFa~~future terminus exBHF~~future station -endCollapsible KBHFxa~~terminus KBHFe~~terminus }} |
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | title=Example 4.2: Empty filler | text-width=150 | map=
-startCollapsible-collapsed-replace exCONTg~~under construction leer exKBHFa~~future terminus exBHF~~future station -endCollapsible KBHFxa~~terminus KBHFe~~terminus }} |
- Both replacement and replaced rows must be as wide as the widest non-collapsible row in the diagram.
- If you want to hide the replaced row after expanding the collapsible, use icon {{#switch:{{{2}}}
| no | 0 =
| #default = ({{#if:|{{{alt}}}|leer}}
)
}} as empty filler as in example 4.2.
- In any case, mind to provide a sufficient text-width. Here, using text-width=120 would break the alignment of the icons.
- Collapsible elements are intentionally disabled in mobile view, so the replaced row will never be visible. Keep this in mind while creating a diagram.
Dual text sidebar
For larger and more complicated diagrams, it often helps to have a text sidebar on the left as well as the right.
{{#if:left-left remark~~left remark~~left main text~~left dist./time! !icon ID~~right dist./time~~right main text~~right remark~~right-right remark|left-left remark~~left remark~~left main text~~left dist./time! !icon ID~~right dist./time~~right main text~~right remark~~right-right remark}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
or
{{#if:left main text! !icon ID~~right main text|left main text! !icon ID~~right main text}}{{#if:||{{{2}}}|}}{{#if:||{{{3}}}|}}{{#if:||{{{4}}}|}}{{#if:||{{{5}}}|}}{{#if:||{{{6}}}|}}{{#if:||{{{7}}}|}}{{#if:||{{{8}}}|}}{{#if:||{{{9}}}|}}{{#if:||{{{10}}}|}}{{#if:||{{{11}}}|}}{{#if:||{{{12}}}|}}{{#if:||{{{13}}}|}}{{#if:||{{{14}}}|}}{{#if:||{{{15}}}|}}{{#if:||{{{16}}}|}}{{#if:||{{{17}}}|}}{{#if:||{{{18}}}|}}{{#if:||{{{19}}}|}}{{#if:||{{{20}}}|}}
{{Routemap |title=Example 5 |map= ~~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 }} |
{{ {{#ifeq:0|0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | collapsible=0 | legend=0 | width=300px | title=Example 5 | text-width= | map=
~~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.
Dual text sidebar collapsible
Code | Result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{Routemap |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 }} |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
{{Routemap |title=Example 6.2: Only main text cell applied |style=width:380px |text-width=,120,,,120, |map= -startCollapsible commuter terminus! !uKBHFa\\KBHFa~~regional terminus River Boris! !uhKRZWae\WASSERq\hKRZWae~~bridge -endCollapsible station! !uINT\LDER\LSTR commuter terminus! !uKBHFe\\KBHFe~~regional terminus }} |
|
- Apply
|{{SAFESUBST:#if:text-width|text-width=}}
to eliminate the break:- Only 1 value:
right main text+right remark
- 3 values, separated by commas:
right dist./time,right main text+right remark,right-right remark
- 6 values:
Left-left remark,left remark+left main text,left dist./time,right dist./time,right main text+right remark,right-right remark
- If the number of values is not equal to 1, 3 or 6, the entire parameter will be ignored.
- Only 1 value:
- If the text width of right-right remark is smaller than needed, its width definition can be omitted, as in example 6.1.
- If a specific text cell is not used anywhere on the map, that width definition can be omitted, as in example 6.2.
- Define the general table width with the {{SAFESUBST:#ifeq:{{safesubst:#switch: no
|no |n |false |off |0 = | = |¬ = |yes |y |true |on |1 = yes |#default = yes
}}|yes||}}{{{style{{SAFESUBST:#ifeq:{{{2}}}| ||}}}}}{{SAFESUBST:#ifeq:{{safesubst:#switch: no
|no
|n
|false
|off
|0 =
| =
|¬ =
|yes
|y
|true
|on
|1 = yes
|#default = yes
}}|yes||
}} parameter if {{SAFESUBST:#ifeq:{{safesubst:#switch: no
|no |n |false |off |0 = | = |¬ = |yes |y |true |on |1 = yes |#default = yes
}}|yes||}}{{{text-width{{SAFESUBST:#ifeq:{{{2}}}| ||}}}}}{{SAFESUBST:#ifeq:{{safesubst:#switch: no
|no
|n
|false
|off
|0 =
| =
|¬ =
|yes
|y
|true
|on
|1 = yes
|#default = yes
}}|yes||
}} alone cannot prevent a break.
| no | 0 =
| #default = ({{#if:|{{{alt}}}|leer}}
)
}} to correct the icon columns.
Syntax overview
Syntax | Purpose |
---|---|
\ |
Icon separator |
!~ |
Icon overlay |
!@ |
Icon link |
!_ |
Precedes icon stack formatting parameters |
__ |
Precedes icon formatting parameters |
~~ |
Text separator |
! ! |
Separator between icons and left-column text |
key=value,... |
Formatting parameters |
-startCollapsible |
Start of collapsing section |
-endCollapsible |
End of collapsing section |
-colspan |
Start of non-diagram table cell |
-colspan-end |
End of non-diagram table cell |
-colspan-n |
Start of non-diagram table cell; next n lines of code are in that cell (n can be any positive whole number) |
Transition from legacy BS row template to Routemap markup
Conversion policies
Many contributors of the English Route Diagram Template project during the implementation of Routemap have conflicting opinions about the justification of replacing all maps of legacy BS row templates by the Lua-based Routemap. Opponents deem the map markups of Routemap to be too esoteric for editors unfamiliar with Routemap 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 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, 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.
Function convertbs
Copy and paste the following code to any edit area of this wiki, maybe the map page you are working on:
{{#invoke:Routemap|convertbs|<nowiki> </nowiki>}}
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|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|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 }} | ||||||
Copy safe substitution markup for actual usage | ||||||
0|{{{{#if: | {{{{#if: | FULL}}PAGENAME}}}} | title=Demonstration | map=
KBHFa~~0 km~~A station~~Shuttle bus WASSERq\hKRZWae\WASSERq~~ ~~ ~~ ~~
KINTe~~10 km~~B station~~City hub -colspan-2 Not to scale }} |
Embedding into infobox
- 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
{{#switch:p
|c|close =
|e|empty|s|single|v|void
|o|open
|p|pair = <{{#if:|includeonly|includeonly}}{{#if:| {{{attribs}}}}}
}}{{#switch:p
|c|close =
|e|empty|s|single|v|void = />
|o|open = >
|p|pair = {{#ifeq:includeonly|!--||>}}...
}}{{#switch:p
|e|empty|s|single|v|void
|o|open =
|c|close
|p|pair = {{#ifeq:includeonly|!--|-->|</includeonly>}}
}}
tags. Also {{{navbar pos}}} is helpful to locate the {{Navbar}} better.
{{Infobox station | name = {{color box|orange}} Station layout | image = Placeholder.png | image_upright = 0.5 | image_caption = Platform level | opened = {{Start date|1935|05|15|df=y}} | tracks = 2 | route_map = {{routemap|inline=1|navbar=asd|navbar pos=2| KBHFa~~terminus WASSERq\hKRZWae\WASSERq~~ ~~ ~~ ~~Bridge LDER\INT\~~1 km~~station~~transfer for HSR \KBHFe\BUS~~2 km~~terminus~~bus terminal }} }} |
{{#if: |
{{{demospace}}} | Template | template | other
}} }} |
Infobox | Infobox|[[Category:Infobox templates|Template:Remove first word]]}}}} | other | #default =
}}{{#switch: {{#if: |
{{{demospace}}} | main | other
}} }} |
main =
{{#if:|}}{{#if:|}}{{#if:|[[Category:Articles using Infobox station with map_locator|{{#switch:file:=ψ|image=ψ|#default=Routemap}}}}{{#if:{{#if:| {{{2}}} | }} Station layout|{{#ifeq:10|00||}}{{#ifeq:0|0||}}}}{{#if:|{{#ifeq:00|00||}}{{#ifeq:00|00||}}}} |
other | #default =
}}{{#if:{{#if: |
{{#if: | {{{4}}}:{{{5}}}{{#if: | :{{{6}}} }}, }} }}{{#if: 1935 | {{#if: 05 | {{#if: 15 | {{#expr:15}} {{#if:05|{{#switch:{{#if:05 | {{#switch:05 | jan=1 | feb=2 | mar=3 | april=4 | may=5 | jun=6 | jul=7 | aug=8 | sep|sept=9 | oct=10 | nov=11 | dec=12 | {{#ifexpr:05<0 | {{#ifexpr:((05)round 0)!=(05) | {{#expr:12-(((0.5-(05))round 0)mod 12)}} | {{#expr:12-(((11.5-(05))round 0)mod 12)}}
}} |
{{#expr:(((10.5+05)round 0)mod 12)+1}}
}} }} |
Missing required parameter 1=month!
}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}}|{{#if:05|{{#switch:{{#if:05 |
{{#switch:05 | jan=1 | feb=2 | mar=3 | april=4 | may=5 | jun=6 | jul=7 | aug=8 | sep|sept=9 | oct=10 | nov=11 | dec=12 | {{#ifexpr:05<0 | {{#ifexpr:((05)round 0)!=(05) | {{#expr:12-(((0.5-(05))round 0)mod 12)}} | {{#expr:12-(((11.5-(05))round 0)mod 12)}}
}} |
{{#expr:(((10.5+05)round 0)mod 12)+1}}
}} }} |
Missing required parameter 1=month!
}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} {{#expr:15}},}} 1935|{{#if:05|{{#switch:{{#if:05 |
{{#switch:05 | jan=1 | feb=2 | mar=3 | april=4 | may=5 | jun=6 | jul=7 | aug=8 | sep|sept=9 | oct=10 | nov=11 | dec=12 | {{#ifexpr:05<0 | {{#ifexpr:((05)round 0)!=(05) | {{#expr:12-(((0.5-(05))round 0)mod 12)}} | {{#expr:12-(((11.5-(05))round 0)mod 12)}}
}} |
{{#expr:(((10.5+05)round 0)mod 12)+1}}
}} }} |
Missing required parameter 1=month!
}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} 1935}}|1935}}}}{{#if: |
Z|UTC|{{{7}}}}})}} | 1935{{#if: 05 | -05{{#if: 15 | -15 }} }}{{#if: | T{{{4}}}{{#if: | :{{{5}}}{{#if: | :{{{6}}} }} }} }} }}) | }} |
Template data
|={{#ifeq:{{safesubst:#switch: {{{lc}}} |no |n |false |off |0 = no | = no |¬ = no |yes |y |true |on |1 = yes |#default = no
}}|no|S|s}}ee the monthly parameter usage report for {{#if:|[[Template:]]|this template}}.
|None|none=Parameter usage report |for|For=Parameter usage report for {{#if:|[[Template:]]|Template:Routemap}}. |#default=[4]
}}|This is the {{#if:|TemplateData|TemplateData}} documentation for this template used by VisualEditor and other tools; {{#switch:
|={{#ifeq:{{safesubst:#switch: yes |no |n |false |off |0 = no | = no |¬ = no |yes |y |true |on |1 = yes |#default = no
}}|no|S|s}}ee the monthly parameter usage report for {{#if:|[[Template:]]|this template}}.
|None|none=Parameter usage report |for|For=Parameter usage report for {{#if:|[[Template:]]|Template:Routemap}}. |#default=[5]
}}}}
TemplateData for Routemap
{{#if: | {{{demospace}}} | {{#ifeq:Template|Template | template | other }} }}
| template = {{#if:{{#ifeq:Routema|sandbox|1}}{{#ifeq:Routemap|doc|1}}||
}} | other | #default = }} <templatedata> { "description": "Template for displaying diagram composed of icon images and text labels in uniform style.", "params": { "inline": { "label": "Inline state", "type": "string", "required": false, "description": "Remove title bar and border for transclusion in infobox" }, "title": { "label": "Table title", "type": "string", "required": false, "description": "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 color": { "label": "Title font color", "type": "string", "required": false, "default": "#FFF or #252525; depends", "description": "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", "aliases": [ "title-color" ] }, "title bg color": { "label": "Title background color", "type": "string", "required": false, "default": "#27404E", "description": "Background color of the title", "aliases": [ "title-bg" ] }, "collapsible": { "label": "Collapsibility", "type": "string", "required": false, "description": "Whether the whole infobox is collapsible or not" }, "collapse": { "label": "Collapsing state", "type": "string", "required": false, "description": "Collapsing state. Shown by default. Any value will make the table collapse by default", "aliases": [ "collapsed" ] }, "navbar": { "label": "Template name for Navbar", "type": "string", "required": false, "description": "This must exactly match the diagram template page name so the Navbar template will appear and link to the template page", "aliases": [ "tnavbar" ] }, "navbar pos": { "label": "Position of the Navbar", "type": "string", "required": false, "description": "Position of the Navbar template. Float to left in the title bar by default; «1» for top-right corner of the map (just under the title bar); «2» for the middle bottom of the map" }, "legend": { "label": "Legend appearance", "type": "wiki-page-name", "required": false, "default": "Template:Railway line legend", "description": "Alias of the legend link. It can be «bus», «canal», «footpath» or «track». «0» or «no» for no legend at all" }, "legend alt": { "label": "Legend link text", "type": "string", "required": false, "default": "Legend", "description": "Different link name in place of «Legend» if desirable" }, "float": { "label": "Floating state", "type": "string", "required": false, "default": "right", "description": "Floating state of the whole box: «right» by default; optionally «left» or «none»" }, "bg": { "label": "Background color", "type": "string", "required": false, "default": "#F9F9F9", "description": "Background color of the whole map area" }, "style": { "label": "CSS style values", "type": "string", "required": false, "description": "Additional CSS style definition of the whole infobox" }, "top": { "label": "Top note", "type": "string", "required": false, "description": "Space for optional note or infobox above the map", "aliases": [ "on top" ] }, "footnote": { "label": "Bottom note", "type": "string", "required": false, "description": "Space for optional note or infobox below the map", "aliases": [ "bottom" ] }, "text-width": { "label": "Width of map text cell", "type": "string", "required": false, "description": "Extend the width of the map text cell so the collapsible section within the map does not break", "aliases": [ "tw" ] }, "map": { "label": "Map markups", "description": "Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style", "required": true, "type": "string", "aliases": [ "1" ] }, "navbar mini": { "label": "Small navbar", "description": "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»).", "type": "string" } }, "format": "block", "paramOrder": [ "inline", "title", "title color", "title bg color", "collapsible", "collapse", "navbar", "navbar pos", "navbar mini", "legend", "legend alt", "float", "bg", "style", "top", "footnote", "text-width", "map" ] } </templatedata>
{{#if:{{#ifeq:Routema|sandbox|1}}{{#ifeq:Routemap|doc|1}}|| }}
The above documentation is transcluded from Template:Routemap/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |
- Pages with script errors
- Documentation subpages without corresponding pages
- Pages using div col with small parameter
- Lua-based templates
- Templates using TemplateStyles
- Pages with broken file links
- Errors reported by Module String
- Articles using Infobox station with a broken location map
- Articles using Infobox station with Korean name parameters
- Articles using Infobox station with local authority
- Articles using Infobox station with markup inside name
- Articles using Infobox station with links or images inside name
- Articles using Infobox station with markup inside type
- Articles using Infobox station with images inside type
- Pages with no open date in Infobox station
- Templates using TemplateData
- Route diagram templates