Template:Dash

From Xenharmonic Wiki
Revision as of 02:12, 12 May 2024 by ArrowHead294 (talk | contribs) (Created page with)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This template converts a sequence separated by spaces into one separated by dashes.

Documentation

This template should not be substituted.

This template is designed to illustrate chains of intervals (fifths especially) without having to manually type out the entities such as — or –. 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

{{{1}}}
Accepts one unnamed parameter, which is the list to be converted.
s
Specifies what space to be used. Can be set to the standard space, thin space, or hair ("extra thin") space.
d
Specifies what dash to use, with options for short, medium, and long dashes, plus left and right arrows.
d2
Second separator for bidirectional lists.

Note: If you pass in all unnamed parameters, the second will be used to determine the dash instead of the space if only two parameters are invoked. If three or four are specified, the second parameter will determine the space while the third (and fourth, if passed) will determine the dash.

Dual separators

This template currently has options for two different separators.

For the primary separator, separate items by , 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 (,,) followed by one or more spaces.

Commas

Note: Comma characters that are not part of a separator must be escaped as ,.

Usage

The list to be converted is passed as one unnamed argument, using a comma and one or more spaces (, ) as the separator.

To adjust spacing between list elements and dashes, use the spaces parameter (defaults to the regular space character).

You type You get
s= Regular space
s=space
s=thin Thin space (U+2009 THIN SPACE)
s=hair Hair space (U+200A HAIR SPACE)
s=nbsp Non-breaking space (U+00A0 NO-BREAK SPACE)
s=nnbsp Narrow non-breaking space (U+202F NARROW NO-BREAK SPACE)

The dash used can be the regular hyphen-minus, an em dash, or an en dash. This is done with the sep parameter.

You type You get
d= Regular hyphen (U+002D - HYPHEN-MINUS)
d=short
d=long Em dash (U+2014 — EM DASH)
d=med En dash (U+2013 – EN DASH)
d=larr Left arrow (U+2190 ← LEFTWARDS ARROW)
d=rarr Right arrow (U+2192 → RIGHTWARDS ARROW)

Bidirectional arrows

There are two special cases that are supported, in the case of chains of intervals:

d=iarr
Sets the primary separator to the right arrow () and the secondary separator to the left arrow ().
d=oarr
Sets the primary separator to the left arrow () and the secondary separator to the right arrow ().

Examples

You type You get
{{dash|A, B, C, D, E, F, G, H|s=space|d=long}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=thin|d=long}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=hair|d=long}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=space|d=med}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=thin|d=med}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=hair|d=med}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=space|d=}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=thin|d=}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|A, B, C, D, E, F, G, H|s=hair|d=}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=iarr}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).
{{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=oarr}} Lua error in Module:Dash at line 48: attempt to index local 'in_str' (a nil value).

See also

  • Module:Dash – the module that actually implements the functionality.