Template:Dash/doc: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{dochead}} | {{dochead}}{{substitute|no}}{{clear}}{{lua}} | ||
This template converts a sequence separated by commas and spaces into one separated by dashes. | This template is designed to illustrate chains of intervals (fifths especially) without having to manually type out the entities such as <code>&mdash;</code> or <code>&ndash;</code>. It also allows the insertion of spaces in between the dashes and elements in order to reduce clutter. It converts a sequence separated by commas and spaces into one separated by dashes. | ||
=== Parameters === | === Parameters === | ||
; <code>{{ | ; <code><nowiki>{{{1}}}</nowiki></code> | ||
: Accepts one unnamed parameter, which is the list to be converted. | : Accepts one unnamed parameter, which is the list to be converted. | ||
Line 21: | Line 21: | ||
For the primary separator, separate items by <code>,</code> followed by one or more spaces (if no secondary separator is specified, any combination of commas and whitespaces of any length will be treated as a single separator, as long as it ends in one or more whitespaces). An additional separator can be invoked by separating items using two commas (<code>,,</code>) followed by one or more spaces. | For the primary separator, separate items by <code>,</code> followed by one or more spaces (if no secondary separator is specified, any combination of commas and whitespaces of any length will be treated as a single separator, as long as it ends in one or more whitespaces). An additional separator can be invoked by separating items using two commas (<code>,,</code>) followed by one or more spaces. | ||
==== Commas ==== | |||
'''Note:''' Comma characters that are not part of a separator must be escaped as <code>&#44;</code>. | |||
=== Usage === | === Usage === | ||
Line 27: | Line 30: | ||
To adjust spacing between list elements and dashes, use the <code>spaces</code> parameter (defaults to the regular space character). | To adjust spacing between list elements and dashes, use the <code>spaces</code> parameter (defaults to the regular space character). | ||
{| class="wikitable center-all" | {| class="wikitable center-all" | ||
|- | |||
! You type !! You get | ! You type !! You get | ||
|- | |- | ||
| <code>s | | <code><nowiki>s=</nowiki></code> || rowspan="2" | Regular space | ||
|- | |- | ||
| <code>s | | <code><nowiki>s=space</nowiki></code> | ||
|- | |- | ||
| <code>s | | <code><nowiki>s=thin</nowiki></code> || Thin space (U+2009 <span style="font-size: 10px;">THIN SPACE</span>) | ||
|- | |- | ||
| <code>s | | <code><nowiki>s=hair</nowiki></code> || Hair space (U+200A <span style="font-size: 10px;">HAIR SPACE</span>) | ||
|- | |- | ||
| <code>s | | <code><nowiki>s=nbsp</nowiki></code> || Non-breaking space (U+00A0 <span style="font-size: 10px;">NO-BREAK SPACE</span>) | ||
|- | |- | ||
| <code>s | | <code><nowiki>s=nnbsp</nowiki></code> || Narrow non-breaking space (U+202F <span style="font-size: 10px;">NARROW NO-BREAK SPACE</span>) | ||
|} | |} | ||
Line 45: | Line 49: | ||
{| class="wikitable center-all" | {| class="wikitable center-all" | ||
|- | |||
! You type !! You get | ! You type !! You get | ||
|- | |- | ||
| <code>d | | <code><nowiki>d=</nowiki></code> || rowspan="2" | Regular hyphen (U+002D - <span style="font-size: 10px;">HYPHEN-MINUS</span>) | ||
|- | |- | ||
| <code>d | | <code><nowiki>d=short</nowiki></code> | ||
|- | |- | ||
| <code>d | | <code><nowiki>d=long</nowiki></code> || Em dash (U+2014 — <span style="font-size: 10px;">EM DASH</span>) | ||
|- | |- | ||
| <code>d | | <code><nowiki>d=med</nowiki></code> || En dash (U+2013 – <span style="font-size: 10px;">EN DASH</span>) | ||
|- | |- | ||
| <code>d | | <code><nowiki>d=larr</nowiki></code> || Left arrow (U+2190 ← <span style="font-size: 10px;">LEFTWARDS ARROW</span>) | ||
|- | |- | ||
| <code>d | | <code><nowiki>d=rarr</nowiki></code> || Right arrow (U+2192 → <span style="font-size: 10px;">RIGHTWARDS ARROW</span>) | ||
|} | |} | ||
Line 63: | Line 68: | ||
There are two special cases that are supported, in the case of chains of intervals: | There are two special cases that are supported, in the case of chains of intervals: | ||
; <code>d=iarr</code> | ; <code><nowiki>d=iarr</nowiki></code> | ||
: Sets the primary separator to the right arrow (<code>→</code>) and the secondary separator to the left arrow (<code>←</code>). | : Sets the primary separator to the right arrow (<code>→</code>) and the secondary separator to the left arrow (<code>←</code>). | ||
; <code>d=oarr</code> | ; <code><nowiki>d=oarr</nowiki></code> | ||
: Sets the primary separator to the left arrow (<code>←</code>) and the secondary separator to the right arrow (<code>→</code>). | : Sets the primary separator to the left arrow (<code>←</code>) and the secondary separator to the right arrow (<code>→</code>). | ||
=== Examples === | === Examples === | ||
{| class="wikitable center-all" | {| class="wikitable center-all" | ||
|- | |||
! You type !! You get | ! You type !! You get | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=space|d=long}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=space|d=long}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=thin|d=long}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=thin|d=long}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=hair|d=long}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=hair|d=long}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=space|d=med}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=space|d=medium}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=thin|d=med}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=thin|d=medium}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=hair|d=med}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=hair|d=medium}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=space|d=}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=space|d=}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=thin|d=}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=thin|d=}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|A, B, C, D, E, F, G, H|s=hair|d=}}</nowiki></code> || {{{{ROOTPAGENAME}}|A, B, C, D, E, F, G, H|s=hair|d=}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=iarr}}</nowiki></code> || {{{{ROOTPAGENAME}}|F, C, G, D, A,, E,, B,, F♯|s=hair|d=iarr}} | ||
|- | |- | ||
| <code>{{ | | <code><nowiki>{{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=oarr}}</nowiki></code> || {{{{ROOTPAGENAME}}|F, C, G, D, A,, E,, B,, F♯|s=hair|d=oarr}} | ||
|} | |} | ||