Esta ye la subpáxina de documentación pa Plantía:Routemap. Contién información d'usu, categoríes y otros conteníos que nun formen parte del módulu. ATENCIÓN: Los interwikis yá nun s'añaden equí, sinón en Wikidata, nel menú de la izquierda.
Esta plantía basada en Lua sustituye a les plantíes de Wikipedia:Route diagram template antigües basaes en funciones d'analís {{BS-map}} (y les obsoletes {{Railway line header}}, {{BS-header}} y {{BS-table}}) porque los diagrames creaos por
{{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 =}}
Marcáu de los parámetros de mapa
El marcáu pa componer el diagrama nel parámetru |map= ye distintu de les plantíes basaes en {{BSrow}}. Les principales diferencies son los separadores en cada filera. Les subplantíes nun son necesaries, porque una filera nueva de la tabla créase simplemente con un retornu de carru (llinia nueva).
{{RoutemapAñadir equí otros parámetros como |títulu=.|mapa=El marcáu del mapa va equí}}
Básicu
Exemplu 1.1
exCONTg
ENDExa
CONTgq\KRZu\CONTfq
BHF
\ABZgl\CONTfq
CONTf
\
Nome
Muestra
HTML
RGB
HSV
\
Nome
Muestra
HTML
RGB
HSV
Los iconos sepárense con backslash \.
Cada grupu d'iconos ta centráu na so filera. L'iconu ensin nome (al principiu de la filera 5 del diagrama) puede usase como espaciador.
L'ID de cada iconu puede vese nel tooltip. Pasa'l punteru pelos iconos pa velos.
Testu de la barra llateral
Nome
Muestra
HTML
RGB
HSV
\
Nome
Muestra
HTML
RGB
HSV
\
Nome
Muestra
HTML
RGB
HSV
~~
Nome
Muestra
HTML
RGB
HSV
~~
Nome
Muestra
HTML
RGB
HSV
~~
Nome
Muestra
HTML
RGB
HSV
~~
Nome
Muestra
HTML
RGB
HSV
o
Nome
Muestra
HTML
RGB
HSV
\
Nome
Muestra
HTML
RGB
HSV
\
Nome
Muestra
HTML
RGB
HSV
~~
Nome
Muestra
HTML
RGB
HSV
Nome
Muestra
HTML
RGB
HSV
{{Routemap|title=Example 1.2|map=KBHFa~~terminusWASSERq\hKRZWae\WASSERq~~ ~~ ~~ ~~BridgeLDER\INT\~~1 km~~station~~transfer for HSR\KBHFe\BUS~~2 km~~terminus~~bus terminal}}
Example 1.2
terminus
Bridge
1 km
station
transfer for HSR
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.
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
Example 2.2
bg=#007CC3
1
2
3
color=red,bold=yes
A
C
E
align=l,b=1,fontsize=cmt
B
D
F
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=orbgcolor=
Any X11 color name, RGB hex triplet o other valid values of the CSS background property
Row background is colored
color=orcolour=
Any X11 color name o RGB hex triplet
Text cells in a row are colored
b=orbold=
1, yes, yortrue
Text cells in a row are emboldened
i=, it=oritalic=
1, yes, yortrue
Text cells in a row are italicized
align=
No o invalid value
Text in cells is centered horizontally and vertically
lorleft
Text in cells is aligned to the left
rorright
Text in cells is aligned to the right
a, tortop
Text in cells is aligned to the top
e, borbottom
Text in cells is aligned to the bottom
la, tl, c4, nw, top-leftortopleft
Text in cells is aligned to the top-left corner
ra, tr, c1, ne, top-rightortopright
Text in cells is aligned to the top-right corner
le, bl, c3, sw, bottom-leftorbottomleft
Text in cells is aligned to the bottom-left corner
re, br, c2, se, bottom-rightorbottomright
Text in cells is aligned to the bottom-right corner
fontsize=
No value
Text in cells is 10px high (example)
infoormain
Text in cells is the same size as the large sidebar text (second column from center)
cmtorcomment
Text in cells is the same size as the small sidebar text (other columns)
Text in cells is a different size (percentages are relative to the large sidebar text)
Individual cells/icons
!_bg=purple\*
Nome
Muestra
HTML
RGB
HSV
__align=l!~*
Nome
Muestra
HTML
RGB
HSV
__align=r,b=yes
Parameters for a single icon o text cell (e.g. BHF, *Text) are preceded by two underscores (__).
Parameters for the contents of a table cell (a stack of overlaid objects, o a single icon o 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.
Nome
Muestra
HTML
RGB
HSV
Icon, text box and overlay stack parameters
Parameter name
Values
Result
bg=, background=orbgcolor=
Any X11 color name, RGB hex triplet o other valid values of the CSS background property
Background is colored This should not be used with overlays above icons.
color=orcolour=
Any X11 color name o RGB hex triplet
All the text of a cell, o the text of an individual text box, is colored
b=orbold=
1, yes, yortrue
Boldfaced text
i=, it=oritalic=
1, yes, yortrue
Italicized text
align=
No o invalid value
Text is aligned per parameters of its parent (default: centered vertically and horizontally)
lorleft
Text is aligned to… (vertical / horizontal) "Inherit" indicates that the cell will inherit its parent's value for that axis.
{{Routemap|title=Example 3.2:<br/>Mixed odd and even rows|tw=70|map=-startCollapsible-collapsedd\KBHFa\d~~terminushKRZWae~~ ~~ ~~bridge-endCollapsible-BS2+l\BS2+r~~junction}}
Example 3.2: Mixed odd and even rows
terminus
bridge
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 in mobile view, and increase text-width if it breaks.
The icon number of the first row of collapsible section must be equal to o greater than the icon number of the widest non-collapsible row.
As in example 3.2, use half-width empty icon Plantía:Bsq 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~~ ~~ ~~viaducthSTRe@f-endCollapsible-LDER\INT\~~ ~~station~~transfer for HSR\KBHFe\BUS~~ ~~terminus~~bus terminal}}
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
{{Routemap|title=Example 6.1: All text cells applied|style=width:540px|text-width=65,150,30,30,120,|map=~~km! !~~km~~-startCollapsiblecommuter terminus~~0! !uKBHFa\leer\KBHFa~~0~~regional terminusRiver Boris~~ ~~! !uhKRZWae\WASSERq\hKRZWae~~ ~~ ~~bridge-endCollapsibletransfer for HSR~~station~~1! !uINT\LDER\LSTRcommuter terminus~~2! !uKBHFe\\KBHFe~~2~~regional terminus}}
Example 6.1: All text cells applied
km
km
commuter terminus
0
0
regional terminus
River Boris
bridge
transfer for HSR
station
1
commuter terminus
2
2
regional terminus
{{Routemap|map-title=Example 6.2: Only main text cell applied|style=width:380px|text-width=,120,,,120,|map=-startCollapsiblecommuter terminus! !uKBHFa\\KBHFa~~regional terminusRiver Boris! !uhKRZWae\WASSERq\hKRZWae~~bridge-endCollapsiblestation! !uINT\LDER\LSTRcommuter terminus! !uKBHFe\\KBHFe~~regional terminus}}
Example 6.2: Only main text cell applied
commuter terminus
regional terminus
River Boris
bridge
station
commuter terminus
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 number of values is not equal to 1, 3 o 6, the entire parameter will be ignored.
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 Plantía:Param parameter if Plantía:Param alone cannot prevent a break.
If the empty icon cell of the collapsible row is being squashed, use empty icon Plantía:Bsq to correct the icon columns.
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 o separate text editor such as Notepad o 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 o 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 Plantía: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, o 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|WBRÜCKE|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|WBRÜCKE|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|WBRÜCKE|WASSERq||||{{BSsplit|Suburb|Capital}}}}{{BS|KINTe|10 km|B station|City hub}}{{BS-colspan}}----Not to scale}}
Copy safe substitution markup for actual usage
Demonstration
Lleenda
0 km
A station
Shuttle bus
Plantía:BSsplit
10 km
B station
City hub
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 <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~~terminusWASSERq\hKRZWae\WASSERq~~ ~~ ~~ ~~BridgeLDER\INT\~~1 km~~station~~transfer for HSR\KBHFe\BUS~~2 km~~terminus~~bus terminal}}}}
Plantía:Infobox station
Template data
Esta ye la documentación de TemplateData pa esta plantía qu'usen VisualEditor y otres ferramientes; ver l'informe mensual d'errores pa esta plantía.
TemplateData pa Routemap
Template for displaying diagram composed of icon images and text labels in uniform style.
Parámetros de la plantía
Esta plantía prefier dar formatu en bloque a los parámetros.
Parámetru
Descripción
Triba
Estáu
Inline state
inline
Remove title bar and border for transclusion in infobox
Cadena
opcional
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
Cadena
opcional
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
Predetermináu
#FFF or #252525; depends
Cadena
opcional
Title background color
title bg colortitle-bg
Background color of the title
Predetermináu
#27404E
Cadena
opcional
Collapsibility
collapsible
Whether the whole infobox is collapsible or not
Cadena
opcional
Collapsing state
collapsecollapsed
Collapsing state. Shown by default. Any value will make the table collapse by default
Cadena
opcional
Template name for Navbar
navbartnavbar
Type the diagram template page name so the Navbar template will appear and link to the template page
Cadena
opcional
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
Cadena
opcional
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»).
Cadena
opcional
Legend appearance
legend
Alias of the legend link. It can be «bus», «canal», «footpath» or «track». «0» or «no» for no legend at all
Predetermináu
Template:Railway line legend
Páxina
opcional
Legend link text
legend alt
Different link name in place of «Legend» if desirable
Predetermináu
Legend
Cadena
opcional
Floating state
float
Floating state of the whole box: «right» by default; optionally «left» or «none»
Predetermináu
right
Cadena
opcional
Background color
bg
Background color of the whole map area
Predetermináu
#F9F9F9
Cadena
opcional
CSS style values
style
Additional CSS style definition of the whole infobox
Cadena
opcional
Top note
topon top
Space for optional note or infobox above the map
Cadena
opcional
Bottom note
footnotebottom
Space for optional note or infobox below the map
Cadena
opcional
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
Cadena
opcional
Map markups
map1
Map data which uses specific markup/separators to load icon image and arrange the text in the uniform style