Template talk:Longdash

Latest comment: 7 hours ago by Yodin in topic Parameters

ndash edit

The link to ndash leads to nowhere. Tromaster (talk) 23:45, 31 August 2016 (UTC)Reply

Use correct character? edit

This template is currently using a box-drawing character. It might look like a long dash, but it's not. It's also not supported by all devices. There are other more appropriate characters to choose from, such as the Horizontal Bar: U+2015 . However, as the purpose of this template is to indicate abbreviation by use of a very long dash, I'd suggest following the guidelines at Wikipedia:Dash#Redaction and using two em dashes, or maybe the {{bar|2}} (——) template. Any thoughts? Sam Wilson 01:22, 2 November 2016 (UTC)Reply

It's also commonly used to indicate speech left hanging by an interruption; e.g. two such uses on Page:The Soft Side (New York, The Macmillan Company, 1900).djvu/11. It's important to me that the template yield something that looks like a single long dash, and in every font. As long as that criterion is met, then I don't mind what characters are used. Hesperian 05:28, 2 November 2016 (UTC)Reply
Good point. But actually the reason that I've noticed this is that the box-building character currently in use doesn't display correctly on Kobo ereaders. Whereas the double-dash hack of {{bar|2}} does work (although it has a slight variation of height along its length due to the strike-through having a different weight to the dash itself). I'm not bothered enough to change it, especially if there's any disagreement, but I think it's something to be aware of. Sam Wilson 05:38, 2 November 2016 (UTC)Reply
(e/c) I use {{bar|2}} for the interrupted speech dash, and a longer one for things like "Lord M———y was robbed the other day." I haven't found any browser or font issues with it across several devices. Because of my use of it I know that other editors are also doing so, so I recommend that this template use it as well—for consistency at least. Beeswaxcandle (talk) 05:41, 2 November 2016 (UTC)Reply
@Beeswaxcandle: Yes, that's my approach too. In addition, wrapping the associated parts of word in {{nowrap}}, e.g. "Lord {{nowrap|M{{bar|3}}y}} was robbed". Sam Wilson 05:55, 2 November 2016 (UTC)Reply


There is actually a unicode character called the "THREE-EM DASH". Cool, hey! And here it is: ⸻. I bet London to a brick it didn't display for you.

What would be super is if we could use this character, but specify a fallback substitution, such as three em-dashes, if the intended character is unsupported by any of the reader's installed browser fonts. Unicode does in fact support character fallback substitutions, but they're hard-coded, there's no defined substitution for the THREE-EM DASH, and there doesn't seem to be a way for us to define one. Damn!

Hesperian 06:18, 2 November 2016 (UTC)Reply


How about this, stolen from en.wikipedia's {{long dash}}: ———
The code is
<span style="letter-spacing:-.25em;">———</span>
Hesperian 06:33, 2 November 2016 (UTC)Reply
That sounds like a good idea. I've had a play on Template:Bar/sandbox; have a look at Template:Bar/testcases. —Sam Wilson 06:57, 7 November 2016 (UTC)Reply


I implemented it but took the last dash out of the span so that any succeeding character isn't affected by the letter spacing. It's the difference between

What the f———?

and

What the f———?

Hesperian 01:27, 8 November 2016 (UTC)Reply

That's a great idea. Thanks for fixing. :-) I think I'll swich to using this now, instead of {{bar|2}}. Sam Wilson 04:34, 8 November 2016 (UTC)Reply

According to Unicode 6.1+ (see w:Supplemental Punctuation), "⸺" "2M" U+2E3A "TWO-EM DASH" is the "omission dash" and "⸻" "3M" U+2E3B "THREE-EM DASH" is for use in bibliographies to replace repeated instances of an authors name. According to w:Template:Long dash (Template:Long dash (Q25969656)), it is to be used for bibliographies and thus should be the "THREE-EM DASH", however here s:Template:Longdash (Template:Longdash (Q30525777) ) it is to be used as an omission dash and thus should be "TWO-EM DASH". I am considering whether I shouldn't just ignore these templates and instead modify {{--}} (Template:Em dash (Q6582719)) to take a parameter and use a #switch to render either U+2014, U+2E3A, or U+2E3B. —Uzume (talk) 07:15, 11 May 2023 (UTC)Reply

Parameters edit

It would be good to have parameters for this, to avoid having to use {{nowrap}} separately, and to allow a different number of em dashes, to match the original source (I've come across quite a few works which use two em dashes rather than three). So for example:

  • {{longdash|B|."}} would be the same as {{nowrap|B{{longdash}}."}}
  • {{longdash|B|."|2}} would be the same as the above, but would be two em dashes, rather than three

As there aren't any parameters at the moment, this wouldn't break any existing uses. If no one objects I'll make a sandbox version. --YodinT 03:32, 26 March 2024 (UTC)Reply

That's a good idea, I think that something like this would be enough.
Edit: other version with longer code but no useless nowraps thereAlien333 (what I did & why I did it wrong) 09:31, 5 May 2024 (UTC)Reply
Thanks! I've added your version to Template:Longdash/sandbox, and tested it out at Template:Longdash/testcases; and it's working just as expected. I'm still not completely sure about the order of parameters though; do you think the number of dashes should be the first parameter or last? --YodinT 11:32, 5 May 2024 (UTC)Reply
For the order of the parameters, it depends on the relation of this to {{bar}}. Once we do a variable-length horizontal bar, it's more or less the same. This template would even be better in some aspects[1].
If we assume that this is replacing it and will often be used with variable length, I'd put it first, but else I'd put it last with an alias, like length (that's what I did in my version).
Anyhow, we'll get a third opinion anyway if we want to change it as it's protected.
  1. differences:
    • this has nowrap
    • code is cleaner
    • behaviour with unexpected inputs, bar gives nothing for 0 and errors for negatives, this gives one emdash both for 0 and negatives.

Alien333 (what I did & why I did it wrong) 12:07, 5 May 2024 (UTC)Reply

That makes sense! I've added an edit request now. --YodinT 16:01, 5 May 2024 (UTC)Reply