Template talk:Toolbar
Template:Toolbar has been protected indefinitely because it is a highly-used or visible template. Use {{Edit request}} on this page to request an edit.If you wish an edit to be made to something else, such as rewording the documentation or adding a category, you can edit Template:Toolbar/doc. Please test any changes in the template's /sandbox subpage or in a user subpage, and consider discussing changes at the talk page before implementing them. |
Edit request - fix space before pipe separator
[edit]{{Edit request}}
The template currently does not output the space before each pipe when using separator=pipe
even though MediaWiki:Pipe-separator has a leading space (as evident in the page being formatted as a <pre>
block). This is because the leading space (U+0020) is stripped when the value of each {{int:{{{separator|pipe}}}-separator}}
is passed to each #if
. In contrast, the trailing space is not stripped because the next numbered parameter is concatenated inside of the #if
, so it does not come last in the argument. MediaWiki:Dot-separator is not affected because its leading space is a non-breaking space (U+00A0), but this technique cannot be used in MediaWiki:Pipe-separator because, as noted in the the page's deletion log, it would appear as an extra space before pipes in the MediaWiki UI.
{{Toolbar}} can be fixed to output the leading regular space by adding <nowiki />
before each {{int:{{{separator|pipe}}}-separator}}
. This prevents the spaces from coming first in the #if
arguments. I tested this change by calling the modified {{Toolbar}} template in isolation and as part of {{Copyvio}} (which is where I keep being reminded of the missing space), but I am not familiar enough with templates to be sure that the added <nowiki />
tag does not have unintended side effects in other situations.
{{Toolbar}} with <nowiki/ >
tags added:
<span class="plainlinks {{{class|}}}" style="{{{style|}}}">(<!-- -->{{#if:{{{1|}}}|{{{1}}}}}<!-- -->{{#if:{{{2|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{2}}}}}<!-- -->{{#if:{{{3|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{3}}}}}<!-- -->{{#if:{{{4|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{4}}}}}<!-- -->{{#if:{{{5|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{5}}}}}<!-- -->{{#if:{{{6|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{6}}}}}<!-- -->{{#if:{{{7|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{7}}}}}<!-- -->{{#if:{{{8|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{8}}}}}<!-- -->{{#if:{{{9|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{9}}}}}<!-- -->{{#if:{{{10|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{10}}}}}<!-- -->{{#if:{{{11|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{11}}}}}<!-- -->{{#if:{{{12|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{12}}}}}<!-- -->{{#if:{{{13|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{13}}}}}<!-- -->{{#if:{{{14|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{14}}}}}<!-- -->{{#if:{{{15|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{15}}}}}<!-- -->{{#if:{{{16|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{16}}}}}<!-- -->{{#if:{{{17|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{17}}}}}<!-- -->{{#if:{{{18|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{18}}}}}<!-- -->{{#if:{{{19|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{19}}}}}<!-- -->{{#if:{{{20|}}}|<nowiki />{{int:{{{separator|pipe}}}-separator}}{{{20}}}}}<!-- -->)</span><noinclude> {{documentation}} </noinclude>
For input:
foo {{toolbar| [[User:Example|user]] | [[User talk:Example|talk]] | [[Special:BlockIP/Example|block]] }} bar foo {{toolbar| [[User:Example|user]] | [[User talk:Example|talk]] | [[Special:BlockIP/Example|block]] | separator=dot }} bar
the output of the current template and modified template (expanded and with comments removed because I placed the modified template in my sandbox) are:
Current:
Modified: