Template:Dash/doc: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 41: | Line 41: | ||
{| class="wikitable center-all" | {| class="wikitable center-all" | ||
! You | ! You type !! You get | ||
! You get | |||
|- | |- | ||
| <code>d=</code> | | <code>d{{=}}</code> || rowspan="2" | Regular hyphen (U+002D - <span style="font-size: 10px;">HYPHEN-MINUS</span>) | ||
| rowspan="2" | Regular hyphen (U+002D - <span style="font-size: 10px;">HYPHEN-MINUS</span>) | |||
|- | |- | ||
| <code>d=short</code> | | <code>d{{=}}short</code> | ||
|- | |- | ||
| <code>d=long</code> | | <code>d{{=}}long</code> || Em dash (U+2014 — <span style="font-size: 10px;">EM DASH</span>) | ||
| Em dash (U+2014 — <span style="font-size: 10px;">EM DASH</span>) | |||
|- | |- | ||
| <code>d=med</code> | | <code>d{{=}}med</code> || En dash (U+2013 – <span style="font-size: 10px;">EN DASH</span>) | ||
| En dash (U+2013 – <span style="font-size: 10px;">EN DASH</span>) | |||
|- | |- | ||
| <code>d=larr</code> | | <code>d{{=}}larr</code> || Left arrow (U+2190 ← <span style="font-size: 10px;">LEFTWARDS ARROW</span>) | ||
| Left arrow (U+2190 ← <span style="font-size: 10px;">LEFTWARDS ARROW</span>) | |||
|- | |- | ||
| <code>d=rarr</code> | | <code>d{{=}}rarr</code> || Right arrow (U+2192 → <span style="font-size: 10px;">RIGHTWARDS ARROW</span>) | ||
| Right arrow (U+2192 → <span style="font-size: 10px;">RIGHTWARDS ARROW</span>) | |||
|} | |} | ||
| Line 73: | Line 67: | ||
=== Examples === | === Examples === | ||
{| class="wikitable center-all" | {| class="wikitable center-all" | ||
! You type | ! You type !! You get | ||
! You get | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=space{{pipe}}d=long{{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=space{{pipe}}d=long{{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=space|d=long}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=space|d=long}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=thin{{pipe}}d=long{{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=thin{{pipe}}d=long{{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=thin|d=long}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=thin|d=long}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=hair{{pipe}}d=long{{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=hair{{pipe}}d=long{{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=hair|d=long}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=hair|d=long}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=space{{pipe}}d=med{{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=space{{pipe}}d=med{{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=space|d=medium}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=space|d=medium}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=thin{{pipe}}d=med{{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=thin{{pipe}}d=med{{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=thin|d=medium}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=thin|d=medium}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=hair{{pipe}}d=med{{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=hair{{pipe}}d=med{{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=hair|d=medium}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=hair|d=medium}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=space{{pipe}}d={{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=space{{pipe}}d={{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=space|d=}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=space|d=}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=thin{{pipe}}d={{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=thin{{pipe}}d={{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=thin|d=}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=thin|d=}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=hair{{pipe}}d={{))}}</code> | | <code>{{((}}dash{{pipe}}A, B, C, D, E, F, G, H{{pipe}}s=hair{{pipe}}d={{))}}</code> || {{dash|A, B, C, D, E, F, G, H|s=hair|d=}} | ||
| {{dash|A, B, C, D, E, F, G, H|s=hair|d=}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}F, C, G, D, A,, E,, B,, F♯{{pipe}}s=hair{{pipe}}d=iarr{{))}}</code> | | <code>{{((}}dash{{pipe}}F, C, G, D, A,, E,, B,, F♯{{pipe}}s=hair{{pipe}}d=iarr{{))}}</code> || {{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=iarr}} | ||
| {{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=iarr}} | |||
|- | |- | ||
| <code>{{((}}dash{{pipe}}F, C, G, D, A,, E,, B,, F♯{{pipe}}s=hair{{pipe}}d=oarr{{))}}</code> | | <code>{{((}}dash{{pipe}}F, C, G, D, A,, E,, B,, F♯{{pipe}}s=hair{{pipe}}d=oarr{{))}}</code> || {{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=oarr}} | ||
| {{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=oarr}} | |||
|} | |} | ||
=== See also === | === See also === | ||
* {{modlink}} | * {{modlink}} | ||
Revision as of 19:43, 10 July 2024
- This template is implemented by the Lua module Module:Dash.
- This template invokes the following functions: dashes from Dash.
This template 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 dash separator for bidirectional lists.
Dual separators
This template currently supports up to two different separators. For the primary separator, separate items by , followed by one or more spaces. An additional separator can be invoked by separating items using two commas (,,) followed by one or more spaces.
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}} |
A — B — C — D — E — F — G — H |
{{dash|A, B, C, D, E, F, G, H|s=thin|d=long}} |
A — B — C — D — E — F — G — H |
{{dash|A, B, C, D, E, F, G, H|s=hair|d=long}} |
A — B — C — D — E — F — G — H |
{{dash|A, B, C, D, E, F, G, H|s=space|d=med}} |
A – B – C – D – E – F – G – H |
{{dash|A, B, C, D, E, F, G, H|s=thin|d=med}} |
A – B – C – D – E – F – G – H |
{{dash|A, B, C, D, E, F, G, H|s=hair|d=med}} |
A – B – C – D – E – F – G – H |
{{dash|A, B, C, D, E, F, G, H|s=space|d=}} |
A - B - C - D - E - F - G - H |
{{dash|A, B, C, D, E, F, G, H|s=thin|d=}} |
A - B - C - D - E - F - G - H |
{{dash|A, B, C, D, E, F, G, H|s=hair|d=}} |
A - B - C - D - E - F - G - H |
{{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=iarr}} |
F → C → G → D → A ← E ← B ← F♯ |
{{dash|F, C, G, D, A,, E,, B,, F♯|s=hair|d=oarr}} |
F ← C ← G ← D ← A → E → B → F♯ |