๐Ÿ‡ฎ๐Ÿ‡ท Iran Proxy | https://www.wikipedia.org/wiki/User:Omegatron/Dash_syntax
Jump to content

User:Omegatron/Dash syntax

From Wikipedia, the free encyclopedia

There have been several proposals for wikicode conventions that allow rendering "real" dashes — like this. Currently, an editor either needs to enter the dash as an HTML entity: —, or has to enter the Unicode character โ€” directly by finding it in the character insert box below the edit window. Both are slow and tedious, and despite the introduction of UTF-8, lots of people are still typing single hyphens - or double hyphens -- to represent dashes. Other types of dashes are even worse; very few people go through the trouble of entering a minus sign, for instance.

This is my proposal for a syntax to cover all the major situations where dashes are desired. If you see a conflict or problem with it, please add to the talk page. The idea behind this proposal is to put a little context parsing into the software, so a dash between two numbers is rendered as an en, but between two characters is left as a hyphen. (Remember, you can always use <nowiki> tags to escape behavior like this or force something else, but, like the other codes used on the site, a good syntax will work as desired in most cases, saving time and effort.)

Syntax

[edit]

Hyphen -

[edit]
  • text-text

En dash โ€“

[edit]
  • 1912-1934
  • text_-_text

Spaced en dash  โ€“ 

[edit]
  • text__-__text

Em dash โ€”

[edit]
  • text--text

Spaced em dash  โ€” 

[edit]
  • text_--_text

Minus sign โˆ’

[edit]
  • _-123
  • 123-_
  • 123_-_123

Not covered

[edit]
  • Minus signs between text variables: a + b โˆ’ c
  • Full dates, linked dates
  • Minus signs inside superscripts for chemical symbols: SO42โˆ’

Examples

[edit]
  • Compound words are sometimes combined into one, but sometimes remain hyphenated: foo-bar.
    • Compound words are sometimes combined into one, but sometimes hyphenated: foo-bar.
  • From 1923-1945, Mr. Foo frequently patronized bars.
    • From 1923โ€“1945, Mr. Foo frequently patronized bars.
  • Foos are timid creatures--one was found hiding underneath a bar for several years -- and should not be approached carelessly.
    • Foos are timid creaturesโ€”one was found hiding underneath a bar for several years โ€” and should not be approached carelessly.
  • Foo's theorem derives a result of -3 from the equation 2 + 5 - 10, barring arithmetic mistakes
    • Foo's theorem derives a result of โˆ’3 from the equation 2 + 5 โˆ’ 10, barring arithmetic mistakes

Other conventions

[edit]

(See this talk page for lots of discussion and variants. The following is a summary of the major proposals.)

TEX and SmartyPants convention

[edit]
  • hyphen = โ€œ-โ€ (one hyphen: โ€œEx-wifeโ€)
  • en dash = โ€œ--โ€ (two hyphens: โ€œ1995--2004โ€)
  • em dash = โ€œ---โ€ (three hyphens: โ€œem dashes---those beautiful thingsโ€)
  • spaced en dash = โ€œ -- โ€ (two hyphens surrounded by spaces: โ€œNovember 1 -- December 26โ€)
  • spaced em dash = โ€œ --- โ€ (three hyphens surrounded by spaces: โ€œem dashes --- those beautiful thingsโ€)

Textile convention

[edit]
  • hyphen = โ€œ-โ€ (one hyphen with no spaces: โ€œEx-wifeโ€)
  • en dash = โ€œ - โ€ (one hyphen surrounded by spaces: โ€œ1995 - 2004โ€)
  • em dash = โ€œ--โ€ (two hyphens: โ€œem dashes--those beautiful thingsโ€)
  • spaced en dash = ??? (can this be typeset at all using the Textile notation?)
  • spaced em dash = โ€œ -- โ€ (two hyphens surrounded by spaces: โ€œem dashes -- those beautiful thingsโ€)
  • hyphen = โ€œ-โ€ (one hyphen with no spaces: โ€œEx-wifeโ€)
  • en dash = โ€œ---โ€ (three hyphens: โ€œ1995---2004โ€)
  • em dash = โ€œ--โ€ (two hyphens: โ€œem dashes--those beautiful thingsโ€)
  • spaced en dash = โ€œ --- โ€? (three hyphens surrounded by spaces: โ€œNovember 1 --- December 26โ€)
  • spaced em dash = โ€œ -- โ€? (two hyphens surrounded by spaces: โ€œem dashes -- those beautiful thingsโ€)