Template:Routemap/doc
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:Wikipedia:Route diagram templates because diagrams created by {{Routemap}} load faster.
Usage
[edit]{{Routemap
| navbar =
| navbar pos =
| navbar mini =
| title =
| title color =
| title bg =
| inline =
| collapsible =
| collapse =
| float =
| bg =
| style =
| text-width =
| legend =
| legend alt =
| top =
| map =
| bottom =
| footnote =
}}
Markup for map parameter
[edit]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
Add other parameters like |title=
here.
|map=
Map markup goes here!
}}
Basic
[edit]Example 1.1 | |||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
icon ID\icon ID\icon ID
- 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
[edit]icon ID\icon ID\icon ID~~dist./time~~main text~~remark~~right remark
or
icon ID\icon ID\icon ID~~main text
{{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
}}
|
|
- 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
[edit]*text\d*text\cd*text~~main text
{{Routemap
|title=Example 1.3
|map=
ENDEa~~ ~~ ~~Reversing siding
SPLa
cPLT\vSTR\cPLT~~Station
d*1\cPLT\vSTR\cPLT\d*2~~ ~~ ~~Platform numbers
cPLT\vSTR\cPLT
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 | 1⁄4 | 1⁄2 | 3⁄4 | 1 | 2 | 4 | 6 | 8 |
Icon overlay, icon link, background color and colspan
[edit]{{Routemap
|title=Example 2.1
|map=
-colspan-1
Icon overlay
uSTRq!~STR2!~BHF!~lHUB
-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.
- 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
[edit]Rows
[edit]Example 2.2 | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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 (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
[edit]icon!_bg=purple\*text__align=l!~*more text__align=r,b=yes
- Parameters for all of a stack of multiple overlaid icons and/or text boxes (or a single icon or text box with no overlays) are separated to the left by an exclamation mark and an underscore (
!_
). This must go after the link (if any). - Parameters for part of a stack of multiple overlaid items are separated to the left by two underscores (
__
). - For the last overlaid item in a stack, the individual item parameters (if any) must go before 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=
can override those of the row parameters.
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
|
Text is emboldened | ||
i= , it= or italic=
|
1 , yes , y or true
|
Text is italicized | ||
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 (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
[edit]{{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
}}
|
|
{{Routemap
|title=Example 3.2: Mixed odd and even rows
|tw=70
|map=
-startCollapsible-collapsed
d\KBHFa\d~~terminus
hWASSER~~ ~~ ~~ ~~bridge
-endCollapsible-
BS2+l\BS2+r~~junction
}}
|
|
- 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 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.
- Changing "collapsed" to "nil" will change the default state of the collapible section to uncollapsed.
Collapsible replacement
[edit]{{Routemap
|title=Example 4.1
|text-width=150
|map=
KBHFa~~terminus
-startCollapsible-collapsed-replace
\LSTR\~~dispensable section
\hSTRa@g\
WASSERq\hKRZW\WASSERq~~ ~~ ~~ ~~bridge
hSTRe@f
-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
}}
|
|
- 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
(
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
[edit]For larger and more complicated diagrams, it often helps to have a text sidebar on the left as well as the right.
left-left remark~~left remark~~left main text~~left dist./time! !icon ID~~right dist./time~~right main text~~right remark~~right-right remark
or
left main text! !icon ID~~right main text
{{Routemap
|title=Example 5
|map=
commuter terminus! !uKBHFa\\KBHFa~~regional terminus
River Boris~~ ~~ ~~! !uhKRZW\WASSERq\hKRZW~~ ~~ ~~ ~~bridge
transfer for HSR~~station~~1 km! !uINT\LDER\LSTR
commuter terminus~~2 km! !uKBHFe\\KBHFe~~2 km~~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
[edit]{{Routemap
|title=Example 6.1: All text cells applied
|style=width:540px
|text-width=65,150,30,30,120,
|map=
-startCollapsible
commuter terminus! !uKBHFa\leer\KBHFa~~regional terminus
River Boris~~ ~~ ~~! !uhKRZW\WASSERq\hKRZW~~ ~~ ~~ ~~bridge
-endCollapsible
transfer for HSR~~station~~1 km! !uINT\LDER\LSTR
commuter terminus~~2 km! !uKBHFe\\KBHFe~~2 km~~regional terminus
}}
|
|
{{Routemap
|map-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! !uhKRZW\WASSERq\hKRZW~~bridge
-endCollapsible
station! !uINT\LDER\LSTR
commuter terminus! !uKBHFe\\KBHFe~~regional terminus
}}
|
|
- Apply
|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 amount of values does not equal to 1, 3 or 6, the whole parameter will be ignored.
- Only 1 value:
- If the text width of right-right remark is shorter to some degree, its width definition can be omitted, as in example 6.1.
- If the entire map never uses a specific text cell, that width definition can be omitted, as in example 6.2.
- Define the general table width in {{{style}}} parameter as well if {{{text-width}}} alone is ineffective to prevent the break.
- If the empty icon cell of the collapsible row is being squashed, use empty icon
(
leer
) to fixate the icon columns.
Template data
[edit]Template for displaying diagram composed of icon images and text labels in uniform style.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Inline state | inline | Remove title bar and border for transclusion in infobox | String | optional |
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 | String | optional |
Title font color | title color title-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
| String | optional |
Title background color | title bg color title-bg | Background color of the title
| String | optional |
Collapsibility | collapsible | Whether the whole infobox is collapsible or not | String | optional |
Collapsing state | collapse collapsed | Collapsing state. Shown by default. Any value will make the table collapse by default | String | optional |
Template name for Navbar | navbar tnavbar | Type the diagram template page name so the Navbar template will appear and link to the template page | String | optional |
Position of the Navbar | navbar pos | 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 | String | optional |
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»). | String | optional |
Legend appearance | legend | Alias of the legend link. It can be «bus», «canal», «footpath» or «track». «0» or «no» for no legend at all
| Page name | optional |
Legend link text | legend alt | Different link name in place of «Legend» if desirable
| String | optional |
Floating state | float | Floating state of the whole box: «right» by default; optionally «left» or «none»
| String | optional |
Background color | bg | Background color of the whole map area
| String | optional |
CSS style values | style | Additional CSS style definition of the whole infobox | String | optional |
Top note | top on top | Space for optional note or infobox above the map | String | optional |
Bottom note | footnote bottom | Space for optional note or infobox below the map | String | optional |
Width of map text cell | text-width tw | Extend the width of the map text cell so the collapsible section within the map does not break | String | optional |
Map markups | map 1 | Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style | String | required |