metanorma-iso 3.5.44 → 3.5.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Metanorma
4
- module Iso
5
- module Validation
6
- module Rules
7
- # Style warnings for wrong indefinite articles before
8
- # initialisms (ISO House Style): initialisms pronounced
9
- # letter-wise take "an" ("an ISO standard", "an XML file"),
10
- # not "a".
11
- #
12
- # The list below is closed and conservative: only initialisms
13
- # whose English pronunciation begins with a letter name
14
- # ("gee", "you", "ess", ...) are flagged, so "a GPS", "a UN",
15
- # "a SQL" and friends are reported. The reverse direction
16
- # ("an RFC", "an SAP" read as a word) and acronyms pronounced
17
- # as words (RAM, NATO) are intentionally out of scope.
18
- class StyleAbbrevArticlesRule < StyleRule
19
- code "ISO_63"
20
-
21
- policy category: "Grammar > A or an",
22
- rule: "use 'an' before an abbreviated term beginning with a vowel sound ('an ISO standard', 'an XML file')",
23
- source: :house_style, mn_category: :style
24
-
25
- # Consonant-letter-name initialisms (PDF "pee", JPG "jay",
26
- # GPS "jee", UN "you") take "a" and are NOT listed; the list
27
- # is strictly vowel-letter-name initialisms.
28
- LETTER_PRONOUNCED = %w[
29
- GPS UN URN ERP HR SQL API ISO HTML XML RGB RPG SAP
30
- RPM RSA SLA UML URL
31
- ].freeze
32
-
33
- A_ARTICLE_REGEX =
34
- /\ba\s+(?:#{LETTER_PRONOUNCED.join("|")})\b/.freeze
35
-
36
- def scan_text(node, text)
37
- findings_for_matches(
38
- node, text, A_ARTICLE_REGEX,
39
- "wrong article '%s': this initialism is pronounced " \
40
- "letter-wise — use 'an'"
41
- )
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end