Skip to content

Commit

Permalink
Adding en dash rule
Browse files Browse the repository at this point in the history
  • Loading branch information
aireilly committed Sep 16, 2024
1 parent 42d061f commit 17ba453
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .vale/fixtures/RedHat/EnDashes/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Vale configuration file to test the `EnDashes` rule
StylesPath = ../../../styles
MinAlertLevel = suggestion
[*.adoc]
RedHat.EnDashes = YES
3 changes: 3 additions & 0 deletions .vale/fixtures/RedHat/EnDashes/testinvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
50 - 100 px
50-100 px
50 – 100 px
4 changes: 4 additions & 0 deletions .vale/fixtures/RedHat/EnDashes/testvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
numbers 12–15
pages 100–107
X'41'–X'FE'
September–December
11 changes: 11 additions & 0 deletions .vale/styles/RedHat/EnDashes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
extends: substitution
level: warning
link: https://redhat-documentation.github.io/vale-at-red-hat/docs/main/reference-guide/endashes/
message: "Use an en dash to show a range of numbers. Do not use a space before or after the en dash."
nonword: true
action:
name: replace
swap:
(\d+)\s?-\s?(\d+): $1–$2
(\d+)\s–\s(\d+): $1–$2
1 change: 1 addition & 0 deletions modules/reference-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* xref:donotuseterms.adoc[]
* xref:ellipses.adoc[]
* xref:emdashes.adoc[]
* xref:endashes.adoc[]
* xref:headingpunctuation.adoc[]
* xref:headings.adoc[]
* xref:hyphens.adoc[]
Expand Down
18 changes: 18 additions & 0 deletions modules/reference-guide/pages/endashes.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
:navtitle: Endashes
:keywords: reference, rule, endashes

= En dashes

Use an link:https://www.compart.com/en/unicode/U+2013[En dash] (`–`) to show a range of numbers.
Do not use spaces before or after the En dash.

[NOTE]
====
An link:https://www.compart.com/en/unicode/U+2014[Em dash] (`-`) is not the same as an En dash.
The Em dash works like a comma, a colon, or parenthesis.
====

.Additional resources

* link:{ibmsg-url-print}[{ibmsg-print} - En dashes, p.48]
* link:{ibmsg-url}?topic=punctuation-dashes#showing-ranges-with-en-dashes[{ibmsg} - Showing ranges with en dashes]

0 comments on commit 17ba453

Please sign in to comment.