From 853fe7f95851e77fb9cf7cac10e315cb6d603e75 Mon Sep 17 00:00:00 2001 From: aireilly Date: Tue, 12 Dec 2023 15:32:33 +0000 Subject: [PATCH] Adding en dash rule --- .vale/fixtures/RedHat/EnDashes/.vale.ini | 5 +++++ .../fixtures/RedHat/EnDashes/testinvalid.adoc | 3 +++ .vale/fixtures/RedHat/EnDashes/testvalid.adoc | 4 ++++ .vale/styles/RedHat/EnDashes.yml | 11 +++++++++++ modules/reference-guide/nav.adoc | 1 + modules/reference-guide/pages/endashes.adoc | 18 ++++++++++++++++++ 6 files changed, 42 insertions(+) create mode 100644 .vale/fixtures/RedHat/EnDashes/.vale.ini create mode 100644 .vale/fixtures/RedHat/EnDashes/testinvalid.adoc create mode 100644 .vale/fixtures/RedHat/EnDashes/testvalid.adoc create mode 100644 .vale/styles/RedHat/EnDashes.yml create mode 100644 modules/reference-guide/pages/endashes.adoc diff --git a/.vale/fixtures/RedHat/EnDashes/.vale.ini b/.vale/fixtures/RedHat/EnDashes/.vale.ini new file mode 100644 index 000000000..ddc1e2b80 --- /dev/null +++ b/.vale/fixtures/RedHat/EnDashes/.vale.ini @@ -0,0 +1,5 @@ +; Vale configuration file to test the `EnDashes` rule +StylesPath = ../../../styles +MinAlertLevel = suggestion +[*.adoc] +RedHat.EnDashes = YES diff --git a/.vale/fixtures/RedHat/EnDashes/testinvalid.adoc b/.vale/fixtures/RedHat/EnDashes/testinvalid.adoc new file mode 100644 index 000000000..bd787d1c0 --- /dev/null +++ b/.vale/fixtures/RedHat/EnDashes/testinvalid.adoc @@ -0,0 +1,3 @@ +50 - 100 px +50-100 px +50 – 100 px diff --git a/.vale/fixtures/RedHat/EnDashes/testvalid.adoc b/.vale/fixtures/RedHat/EnDashes/testvalid.adoc new file mode 100644 index 000000000..d9d66d356 --- /dev/null +++ b/.vale/fixtures/RedHat/EnDashes/testvalid.adoc @@ -0,0 +1,4 @@ +numbers 12–15 +pages 100–107 +X'41'–X'FE' +September–December diff --git a/.vale/styles/RedHat/EnDashes.yml b/.vale/styles/RedHat/EnDashes.yml new file mode 100644 index 000000000..0cd9765f2 --- /dev/null +++ b/.vale/styles/RedHat/EnDashes.yml @@ -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 or inclusive 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 diff --git a/modules/reference-guide/nav.adoc b/modules/reference-guide/nav.adoc index 0ecdd0449..a63805531 100644 --- a/modules/reference-guide/nav.adoc +++ b/modules/reference-guide/nav.adoc @@ -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[] diff --git a/modules/reference-guide/pages/endashes.adoc b/modules/reference-guide/pages/endashes.adoc new file mode 100644 index 000000000..a04442c03 --- /dev/null +++ b/modules/reference-guide/pages/endashes.adoc @@ -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]