Difference between revisions of "Template:Spaced en dash/doc"

From Timelines
Jump to: navigation, search
(per move)
(+)
 
(53 intermediate revisions by 32 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
+
{{Documentation subpage}} __NOTOC__
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
+
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
__NOTOC__
+
{{COinS safe|n}}
This is the '''spaced ndash''' template, it looks like this " &ndash; ".  
+
{{High-use|27,000+}}
 +
{{Template shortcuts |snd|spnd|sndash|spndash}}
 +
This is the '''spaced en dash''' template; it renders like this (without the quote marks): " &ndash; "  
 +
It works similarly to the HTML markup sequence <code>'''&amp;nbsp;&amp;ndash;'''&nbsp;</code> i.e. a [[non-breaking space]] (which will not line-break and will not collapse together with normal spaces that come before the template), a short dash (known as an [[Dash#En dash|en dash]]), and a normal space (which ''will'' line-break and ''will'' collapse together with normal spaces that come after the template).
 +
Among other uses, this template may be used in lists to provide something stronger than a [[Template:·|bold middot]] "'''&middot;'''" or a [[Template:•|bullet]] "&bull;", but shorter than an [[Dash#Em dash|em dash]] "&mdash;". For horizontal lists, use {{tl|flatlist}} or <code>class="hlist"</code> instead (see [[WP:HLIST]]) Here, the recommended usage is to use ''no'' space before the template and one space after the template, like this:
 +
::<nowiki>[[Salt]]{{spaced en dash}} [[Pepper]]</nowiki>
 +
:This will render one space on each side of the dash, like this:
 +
::[[Salt]] &ndash; [[Black pepper|Pepper]]
 +
:A line break will come ''after'' one of the dashes, not before, when the spacing is used as suggested, like this:
 +
::[[Salt]] &ndash; [[Black pepper|Pepper]] &ndash;
 +
::[[Curry]] &ndash; [[Saffron]]
  
It works similarly to the HTML markup sequence "<code>'''&amp;nbsp;&amp;ndash;'''&nbsp;</code>". That is, a [[non-breaking space]], a short dash (known as an [[Dash#En dash|en dash]]) and a normal space.
+
{{t|snd}}} is a handy synonym.
 
 
{{tn|}} and {{tl|endash}} redirect here and can be used as alternative names for this template.
 
 
 
This template is used when you want something stronger than a [[Template:·|bold middot]] "'''&middot;'''" or a [[Template:•|bullet]] "&bull;", but shorter than an [[Template:Mdash|mdash]] "&mdash;". (An en dash is half the width of an [[Dash#Em dash|em dash]].)
 
 
 
For horizontal lists use {{tl|Flatlist}} or  <code>class="hlist"</code> instead (see [[WP:HLIST]]).
 
 
 
== Normal usage ==
 
 
 
The recommended usage is to use ''no'' space before the template
 
and one space after the template, like this:
 
<nowiki>[[Salt]]{{spaced ndash}}[[Pepper]]</nowiki>
 
 
 
It will render one space on each side of the dash, like this:
 
:[[Salt]] &ndash; [[Black pepper|Pepper]]
 
 
 
If it line breaks then the line break will come ''after'' the dash, not before, like this:
 
:[[Salt]] &ndash;
 
:[[Black pepper|Pepper]]
 
 
 
If it line breaks then the line break will come ''after'' one of the dashes, not before, like this:
 
:[[Salt]] &ndash; [[Black pepper|Pepper]] &ndash;
 
:[[Curry]] &ndash; [[Saffron]]
 
 
{| class="wikitable" style="border: none; background: none;"
 
{| class="wikitable" style="border: none; background: none;"
|Colspan=2 |<center>Here's an example of how it's used</center>
+
|Colspan=2 |<center>Here's an example of use for lists</center>
 
|-
 
|-
|| Template Spaced ndash is not really intended to be used in article text; it's intended for use in other templates, tables, lists and other equivalent things, in order to include a separator between items such as in infoboxes. It's also to be consistent so that the article editor can use their choice of '''<nowiki>{{</nowiki>bull}}''', '''<nowiki>{{</nowiki>dot}}''', '''<nowiki>{{</nowiki>mdash}}''', '''<nowiki>{{</nowiki>middot}}''', or  '''<nowiki>{{</nowiki>spaced ndash}}''' and not have to insert the {{bull}}, {{dot}}, {{mdash}}, {{middot}}, or {{ndash}} symbol, they can use any of these as a simple macro. The idea being that if you have a table with a list of items, you can insert a spaced short dash (or the other symbols) between items that will appear correct, in that the items always have just one separator between them, and when a list crawls to the next line, the dash hangs onto the prior item instead of rolling over to the next line. Notice on the end of this box, the symbol hangs on the end of the last item that will fit on the line indicating that additional items follow on the next line as part of this list, but the item only stays on the line if the item and the dash will fit.  See the column on the right.  In code it's ''' Item1<nowiki>{{</nowiki>spaced ndash}} Item2<nowiki>{{</nowiki>spaced ndash}} Item3<nowiki>{{</nowiki>spaced ndash}} Item4<nowiki>{{</nowiki>spaced ndash}} Item5<nowiki>{{</nowiki>spaced ndash}}''' etc. (with some smaller items squeezed in to show that the list doesn't have to be the same number of items per line) but in the box they all fold perfectly once it runs out of space on the line to fit the next item and the dash following.
+
|| One use of template "spaced en dash" is within other templates, tables, lists, and similar things to provide a separator between items. It is also to be consistent so that the article editor can use their choice of '''<nowiki>{{</nowiki>bull}}''', '''<nowiki>{{</nowiki>dot}}''', '''<nowiki>{{</nowiki>middot}}''', or  '''<nowiki>{{</nowiki>spaced en dash}}''' and not have to insert the {{bull}}, {{dot}}, {{middot}}, or {{spaced en dash}} symbol, they can use any of these as a simple macro. The idea being that if you have a table with a list of items, you can insert a spaced short dash (or the other symbols) between items that will appear correct, in that the items always have just one separator between them, and when a list crawls to the next line, the dash hangs onto the prior item instead of rolling over to the next line. Notice on the end of this box, the symbol hangs on the end of the last item that will fit on the line indicating that additional items follow on the next line as part of this list, but the item only stays on the line if the item and the dash will fit.  See the column on the right.  In code it is ''' Item1<nowiki>{{</nowiki>spaced en dash}} Item2<nowiki>{{</nowiki>spaced en dash}} Item3<nowiki>{{</nowiki>spaced en dash}} Item4<nowiki>{{</nowiki>spaced en dash}} Item5<nowiki>{{</nowiki>spaced en dash}}''' etc. (with some smaller items squeezed in to show that the list does not have to be the same number of items per line) but in the box they all fold perfectly once it runs out of space on the line to fit the next item and the dash following.
| <p>Normally, in a real box these items would be links, but this is an example.</p> Item1{{spaced ndash}} A{{spaced ndash}} B{{spaced ndash}} Item2{{spaced ndash}} Item3{{spaced ndash}} Item4{{spaced ndash}} Item5{{spaced ndash}} extra item{{spaced ndash}} E{{spaced ndash}} 1{{spaced ndash}} 2{{spaced ndash}} 3{{spaced ndash}} 4{{spaced ndash}} 5{{spaced ndash}} 6{{spaced ndash}} 7{{spaced ndash}} {{nobr|item that won't attach to prior line unless it fits in the remaining space{{spaced ndash}}}} Q{{spaced ndash}} A slightly longer item{{spaced ndash}} KK{{spaced ndash}} An obviously really even longer item that the dash will hang at its end{{spaced ndash}} Item6{{spaced ndash}} C{{spaced ndash}} Item7{{spaced ndash}} Item8{{spaced ndash}} Item9{{spaced ndash}} Item10{{spaced ndash}} Item11{{spaced ndash}} Item12{{spaced ndash}} D{{spaced ndash}} Item13{{spaced ndash}} Item14{{spaced ndash}} Item15{{spaced ndash}} Item16{{spaced ndash}} Item17{{spaced ndash}} Item18 <p>The space on the end makes sure the dash doesn't touch the edge of the box, either</p>
+
| <p>Normally, in a real box these items would be links, but this is an example.</p> Item1{{spaced en dash}} A{{spaced en dash}} B{{spaced en dash}} Item2{{spaced en dash}} Item3{{spaced en dash}} Item4{{spaced en dash}} Item5{{spaced en dash}} extra item{{spaced en dash}} E{{spaced en dash}} 1{{spaced en dash}} 2{{spaced en dash}} 3{{spaced en dash}} 4{{spaced en dash}} 5{{spaced en dash}} 6{{spaced en dash}} 7{{spaced en dash}} {{nowrap|item that won't attach to prior line unless it fits in the remaining space{{spaced en dash}}}} Q{{spaced en dash}} A slightly longer item{{spaced en dash}} KK{{spaced en dash}} An obviously really even longer item that the dash will hang at its end{{spaced en dash}} Item6{{spaced en dash}} C{{spaced en dash}} Item7{{spaced en dash}} Item8{{spaced en dash}} Item9{{spaced en dash}} Item10{{spaced en dash}} Item11{{spaced en dash}} Item12{{spaced en dash}} D{{spaced en dash}} Item13{{spaced en dash}} Item14{{spaced en dash}} Item15{{spaced en dash}} Item16{{spaced en dash}} Item17{{spaced en dash}} Item18 <p>The space on the end makes sure the dash doesn't touch the edge of the box, either</p>
 
|}
 
|}
 
== Incorrect usage ==
 
 
If the template is used slightly wrong it will in some cases still behave well. For instance if there are no or several spaces after the template. Like these examples:
 
 
<nowiki>[[Salt]]{{spaced ndash}}[[Pepper]]</nowiki>
 
<nowiki>[[Salt]]{{spaced ndash}}  [[Pepper]]</nowiki>
 
 
Both of them will render exactly as before, with just one space on each side of the dash, like this:
 
:[[Salt]] &ndash; [[Black pepper|Pepper]]
 
 
And it will still only line break ''after'' the dash, like this:
 
:[[Salt]] &ndash;
 
:[[Black pepper|Pepper]]
 
 
But putting one or more spaces before the template will cause problems, like these examples:
 
<nowiki>[[Salt]] {{spaced ndash}}[[Pepper]]</nowiki>
 
<nowiki>[[Salt]]  {{spaced ndash}}[[Pepper]]</nowiki>
 
<nowiki>[[Salt]] {{spaced ndash}} [[Pepper]]</nowiki>
 
<nowiki>[[Salt]]  {{spaced ndash}}  [[Pepper]]</nowiki>
 
 
Then it will render with ''two'' spaces before the dash, and one after, like this:
 
:[[Salt]] &nbsp;&ndash; [[Black pepper|Pepper]]
 
 
And if it line breaks it might break ''before'' the dash, like this:
 
:[[Salt]]
 
:&nbsp;&ndash; [[Black pepper|Pepper]]
 
 
Also, this template should ''not'' routinely be used in regular article text and certainly not where an [[em dash]] would be more appropriate. As a rule, this template should not be used between clauses of a sentence.
 
 
Because Wikipedia suppresses the contents of templates in tool tip preview when the user hovers the pointer over a Wikilink, one should avoid using the Ndash template in an article's lead section. Using the template will cause a confusing blank space to appear in the tool tip preview instead of the expected en dash character.  Instead, use <code><nowiki>&amp;nbsp;&amp;ndash; </nowiki></code> or <code><nowiki>&amp;nbsp;– </nowiki></code>, and be sure to add the trailing space.
 
 
== Technical details ==
 
 
The space before the dash is a [[non-breaking space]]. That means it will not line break and will not collapse together with normal spaces that come before the template.
 
 
The space after the dash is a normal space. That means it wraps (allows line breaks) and it will collapse together with normal spaces that come after the template to form one single space.
 
 
 
== Dot sizes ==
 
== Dot sizes ==
 
{{Dot size}}
 
{{Dot size}}
 
 
== See also ==
 
== See also ==
 
+
* {{tn|·}}, which produces a spaced bold [[interpunct]] ("middot"): "{{·}}"
There are several other templates with similar functionality:
+
* {{tn|•}}, which produces a spaced bullet-point: "{{•}}"
 
+
* {{tn|\}}, which produces a spaced (forward-)slash: "{{\}}"
* {{tn|·}} – Bold middot "'''&middot;'''"
+
* {{tl|en dash}}, which produces an (unspaced) [[en dash]].
* {{tn|•}} – Bullet "&bull;"
+
* {{tl|em dash}}, which produces an (unspaced) [[em dash]].
* &amp;minus; – Minus "&minus;" is a mathematical symbol
 
* {{tl|mdash}} – Mdash "&mdash;" is an [[Dash#Em dash|em dash]], a longer dash
 
 
 
 
<includeonly>
 
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
+
[[Category:Inline spacing templates]]
[[Category:Wikipedia formatting and function templates|{{PAGENAME}}]]
+
[[Category:Typing-aid templates|En dash, spaced]]
 
+
[[Category:Wikipedia character-substitution templates]]
<!-- ADD INTERWIKIS BELOW THIS LINE -->
 
[[as:Template:Ndash]]
 
[[et:Mall:Ndash]]
 
[[ka:თარგი:Ndash]]
 
[[ru:Шаблон:ndash]]
 
[[sl:Predloga:Ndash]]
 
[[tr:Şablon:&ndash;]]
 
 
 
 
</includeonly>
 
</includeonly>

Latest revision as of 20:46, 21 January 2017

This is the spaced en dash template; it renders like this (without the quote marks): " – " It works similarly to the HTML markup sequence &nbsp;&ndash;  i.e. a non-breaking space (which will not line-break and will not collapse together with normal spaces that come before the template), a short dash (known as an en dash), and a normal space (which will line-break and will collapse together with normal spaces that come after the template). Among other uses, this template may be used in lists to provide something stronger than a bold middot "·" or a bullet "•", but shorter than an em dash "—". For horizontal lists, use {{flatlist}} or class="hlist" instead (see WP:HLIST) Here, the recommended usage is to use no space before the template and one space after the template, like this:

[[Salt]]{{spaced en dash}} [[Pepper]]
This will render one space on each side of the dash, like this:
SaltPepper
A line break will come after one of the dashes, not before, when the spacing is used as suggested, like this:
SaltPepper
CurrySaffron

{{snd}}} is a handy synonym.

Here's an example of use for lists
One use of template "spaced en dash" is within other templates, tables, lists, and similar things to provide a separator between items. It is also to be consistent so that the article editor can use their choice of {{bull}}, {{dot}}, {{middot}}, or {{spaced en dash}} and not have to insert the  • ,  · ,  · , or  – symbol, they can use any of these as a simple macro. The idea being that if you have a table with a list of items, you can insert a spaced short dash (or the other symbols) between items that will appear correct, in that the items always have just one separator between them, and when a list crawls to the next line, the dash hangs onto the prior item instead of rolling over to the next line. Notice on the end of this box, the symbol hangs on the end of the last item that will fit on the line indicating that additional items follow on the next line as part of this list, but the item only stays on the line if the item and the dash will fit. See the column on the right. In code it is Item1{{spaced en dash}} Item2{{spaced en dash}} Item3{{spaced en dash}} Item4{{spaced en dash}} Item5{{spaced en dash}} etc. (with some smaller items squeezed in to show that the list does not have to be the same number of items per line) but in the box they all fold perfectly once it runs out of space on the line to fit the next item and the dash following.

Normally, in a real box these items would be links, but this is an example.

Item1 – A – B – Item2 – Item3 – Item4 – Item5 – extra item – E – 1 – 2 – 3 – 4 – 5 – 6 – 7 – item that won't attach to prior line unless it fits in the remaining space – Q – A slightly longer item – KK – An obviously really even longer item that the dash will hang at its end – Item6 – C – Item7 – Item8 – Item9 – Item10 – Item11 – Item12 – D – Item13 – Item14 – Item15 – Item16 – Item17 – Item18

The space on the end makes sure the dash doesn't touch the edge of the box, either

Dot sizes

· middot
· bold {{middot}}
small bullet
{{bullet}}
bold bullet
{{en dash}}
{{em dash}}

See also

  • {{·}}, which produces a spaced bold interpunct ("middot"): " · "
  • {{•}}, which produces a spaced bullet-point: " • "
  • {{\}}, which produces a spaced (forward-)slash: " / "
  • {{en dash}}, which produces an (unspaced) en dash.
  • {{em dash}}, which produces an (unspaced) em dash.