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 Jan 2, 2024
1 parent f6406f8 commit 306334e
Show file tree
Hide file tree
Showing 6 changed files with 38 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
1 change: 1 addition & 0 deletions .vale/fixtures/RedHat/EnDashes/testinvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
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
9 changes: 9 additions & 0 deletions .vale/styles/RedHat/EnDashes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
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 or inclusive numbers. Do not use a space before or after the en dash."
action:
name: replace
swap:
(?<=[\d]+)\s-\s(?=[\d]+):
1 change: 1 addition & 0 deletions modules/reference-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* xref:definitions.adoc[]
* xref:donotuse.adoc[]
* xref:ellipses.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 or inclusive 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 306334e

Please sign in to comment.