metanorma-iso 2.7.5 → 2.7.7
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.
- checksums.yaml +4 -4
- data/lib/isodoc/iso/index.rb +4 -6
- data/lib/isodoc/iso/iso.amendment.xsl +399 -111
- data/lib/isodoc/iso/iso.international-standard.xsl +399 -111
- data/lib/isodoc/iso/presentation_xml_convert.rb +5 -0
- data/lib/isodoc/iso/presentation_xref.rb +4 -19
- data/lib/isodoc/iso/word_convert.rb +10 -6
- data/lib/isodoc/iso/word_dis_cleanup.rb +1 -1
- data/lib/isodoc/iso/word_dis_convert.rb +0 -2
- data/lib/isodoc/iso/xref.rb +2 -4
- data/lib/isodoc/iso/xref_section.rb +12 -2
- data/lib/metanorma/iso/base.rb +9 -1
- data/lib/metanorma/iso/biblio.rng +22 -23
- data/lib/metanorma/iso/isodoc.rng +37 -116
- data/lib/metanorma/iso/validate.rb +0 -8
- data/lib/metanorma/iso/validate_style.rb +17 -21
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -3
- metadata +3 -31
@@ -105,22 +105,6 @@ module IsoDoc
|
|
105
105
|
locality_span_wrap(ret, opt[:type])
|
106
106
|
end
|
107
107
|
|
108
|
-
=begin
|
109
|
-
def prefix_container(container, linkend, node, target)
|
110
|
-
delim = ", "
|
111
|
-
ref = if @xrefs.anchor(target, :type) == "listitem" &&
|
112
|
-
!@xrefs.anchor(target, :refer_list)
|
113
|
-
delim = " "
|
114
|
-
@xrefs.anchor(container, :label)
|
115
|
-
# 7 a) : Clause 7 a), but Clause 7 List 1 a)
|
116
|
-
else anchor_xref(node, container)
|
117
|
-
end
|
118
|
-
|
119
|
-
ref and linkend = ref + delim + linkend
|
120
|
-
l10n(linkend)
|
121
|
-
end
|
122
|
-
=end
|
123
|
-
|
124
108
|
# 7 a) : Clause 7 a), but Clause 7 List 1 a)
|
125
109
|
def prefix_container(container, linkend, node, target)
|
126
110
|
prefix_container?(container, node) or return linkend
|
@@ -135,10 +119,11 @@ module IsoDoc
|
|
135
119
|
def prefix_container_template(container, node, target)
|
136
120
|
nested_xref = @i18n.nested_xref
|
137
121
|
container_label = anchor_xref(node, container)
|
138
|
-
if @xrefs.anchor(target, :type) == "listitem"
|
139
|
-
!@xrefs.anchor(target, :refer_list)
|
122
|
+
if @xrefs.anchor(target, :type) == "listitem"
|
123
|
+
if !@xrefs.anchor(target, :refer_list)
|
140
124
|
nested_xref = "%1 %2"
|
141
|
-
n = @xrefs.anchor(container, :label) and container_label = n
|
125
|
+
# n = @xrefs.anchor(container, :label) and container_label = n
|
126
|
+
end
|
142
127
|
end
|
143
128
|
[nested_xref, container_label]
|
144
129
|
end
|
@@ -52,18 +52,22 @@ module IsoDoc
|
|
52
52
|
|
53
53
|
def convert(input_filename, file = nil, debug = false,
|
54
54
|
output_filename = nil)
|
55
|
-
|
56
|
-
|
57
|
-
stage = docxml&.at(ns("//bibdata/status/stage"))&.text
|
58
|
-
if @dis &&
|
59
|
-
((/^[4569].$/.match?(stage) && @wordtemplate != "simple") ||
|
60
|
-
(/^[0-3].$/.match?(stage) && @wordtemplate == "dis"))
|
55
|
+
if @dis && use_dis?(input_filename, file)
|
56
|
+
swap_renderer(self, @dis, file, input_filename, debug)
|
61
57
|
@dis.convert(input_filename, file, debug, output_filename)
|
62
58
|
else
|
63
59
|
super
|
64
60
|
end
|
65
61
|
end
|
66
62
|
|
63
|
+
def use_dis?(input_filename, file)
|
64
|
+
file ||= File.read(input_filename, encoding: "utf-8")
|
65
|
+
stage = Nokogiri::XML(file, &:huge)
|
66
|
+
.at(ns("//bibdata/status/stage"))&.text
|
67
|
+
(/^[4569].$/.match?(stage) && @wordtemplate != "simple") ||
|
68
|
+
(/^[0-3].$/.match?(stage) && @wordtemplate == "dis")
|
69
|
+
end
|
70
|
+
|
67
71
|
def make_body(xml, docxml)
|
68
72
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
|
69
73
|
xml.body **body_attr do |body|
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -140,12 +140,10 @@ module IsoDoc
|
|
140
140
|
|
141
141
|
# all li in the ol in lists are consecutively numbered through @start
|
142
142
|
def single_ol_for_xrefs?(lists)
|
143
|
-
|
144
|
-
|
143
|
+
lists.size == 1 and return true
|
145
144
|
start = 0
|
146
145
|
lists.each_with_index do |l, i|
|
147
|
-
|
148
|
-
|
146
|
+
i.zero? and next
|
149
147
|
start += lists[i - 1].xpath(ns("./li")).size
|
150
148
|
return false unless l["start"]&.to_i == start + 1
|
151
149
|
end
|
@@ -58,9 +58,19 @@ module IsoDoc
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def annex_name_anchors1(clause, num, level)
|
62
|
+
ret = { label: num, level: level, subtype: "annex" }
|
63
|
+
ret2 = if level == 2
|
64
|
+
{ xref: l10n("#{@labels['clause']} #{num}"),
|
65
|
+
elem: @labels["clause"] }
|
66
|
+
else
|
67
|
+
{ xref: num }
|
68
|
+
end
|
69
|
+
@anchors[clause["id"]] = ret.merge(ret2)
|
70
|
+
end
|
71
|
+
|
61
72
|
def annex_names1(clause, num, level)
|
62
|
-
|
63
|
-
subtype: "annex" }
|
73
|
+
annex_name_anchors1(clause, num, level)
|
64
74
|
i = Counter.new(0, prefix: "#{num}.")
|
65
75
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
66
76
|
annex_names1(c, i.increment(c).print, level + 1)
|
data/lib/metanorma/iso/base.rb
CHANGED
@@ -79,8 +79,16 @@ module Metanorma
|
|
79
79
|
name
|
80
80
|
end
|
81
81
|
|
82
|
+
DOCUMENT_SCHEMES = [1951, 1972, 1979, 1987, 1989, 2012, 2013, 2024].freeze
|
83
|
+
|
82
84
|
def document_scheme(node)
|
83
|
-
node.attr("document-scheme")
|
85
|
+
r = node.attr("document-scheme") and return r
|
86
|
+
r = node.attr("copyright-year")&.to_i or return "2024"
|
87
|
+
DOCUMENT_SCHEMES.each_index do |i|
|
88
|
+
i.zero? and next
|
89
|
+
r < DOCUMENT_SCHEMES[i] and return DOCUMENT_SCHEMES[i - 1].to_s
|
90
|
+
end
|
91
|
+
"2024"
|
84
92
|
end
|
85
93
|
|
86
94
|
def outputs(node, ret)
|
@@ -95,7 +95,7 @@
|
|
95
95
|
<text/>
|
96
96
|
</element>
|
97
97
|
</define>
|
98
|
-
<define name="
|
98
|
+
<define name="LocalizedStringAttrs">
|
99
99
|
<optional>
|
100
100
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
101
101
|
<attribute name="language"/>
|
@@ -106,6 +106,10 @@
|
|
106
106
|
<optional>
|
107
107
|
<attribute name="script"/>
|
108
108
|
</optional>
|
109
|
+
</define>
|
110
|
+
<define name="LocalizedString1">
|
111
|
+
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
112
|
+
<ref name="LocalizedStringAttrs"/>
|
109
113
|
<text/>
|
110
114
|
</define>
|
111
115
|
<define name="LocalizedString">
|
@@ -142,16 +146,8 @@
|
|
142
146
|
<ref name="LocalizedStringOrXsAny"/>
|
143
147
|
</define>
|
144
148
|
<define name="LocalizedStringOrXsAny1">
|
145
|
-
|
146
|
-
|
147
|
-
<attribute name="language"/>
|
148
|
-
</optional>
|
149
|
-
<optional>
|
150
|
-
<attribute name="locale"/>
|
151
|
-
</optional>
|
152
|
-
<optional>
|
153
|
-
<attribute name="script"/>
|
154
|
-
</optional>
|
149
|
+
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
150
|
+
<ref name="LocalizedStringAttrs"/>
|
155
151
|
<oneOrMore>
|
156
152
|
<choice>
|
157
153
|
<text/>
|
@@ -208,6 +204,7 @@
|
|
208
204
|
</define>
|
209
205
|
<define name="roledescription">
|
210
206
|
<element name="description">
|
207
|
+
<ref name="LocalizedStringAttrs"/>
|
211
208
|
<oneOrMore>
|
212
209
|
<ref name="TextElement"/>
|
213
210
|
</oneOrMore>
|
@@ -335,6 +332,7 @@
|
|
335
332
|
</define>
|
336
333
|
<define name="affiliationdescription">
|
337
334
|
<element name="description">
|
335
|
+
<ref name="LocalizedStringAttrs"/>
|
338
336
|
<oneOrMore>
|
339
337
|
<ref name="TextElement"/>
|
340
338
|
</oneOrMore>
|
@@ -948,6 +946,7 @@
|
|
948
946
|
<optional>
|
949
947
|
<attribute name="type"/>
|
950
948
|
</optional>
|
949
|
+
<ref name="LocalizedStringAttrs"/>
|
951
950
|
<zeroOrMore>
|
952
951
|
<ref name="TextElement"/>
|
953
952
|
</zeroOrMore>
|
@@ -1041,15 +1040,7 @@
|
|
1041
1040
|
<data type="boolean"/>
|
1042
1041
|
</attribute>
|
1043
1042
|
</optional>
|
1044
|
-
<
|
1045
|
-
<attribute name="language"/>
|
1046
|
-
</optional>
|
1047
|
-
<optional>
|
1048
|
-
<attribute name="locale"/>
|
1049
|
-
</optional>
|
1050
|
-
<optional>
|
1051
|
-
<attribute name="script"/>
|
1052
|
-
</optional>
|
1043
|
+
<ref name="LocalizedStringAttrs"/>
|
1053
1044
|
<oneOrMore>
|
1054
1045
|
<ref name="TextElement"/>
|
1055
1046
|
</oneOrMore>
|
@@ -1277,6 +1268,7 @@
|
|
1277
1268
|
<optional>
|
1278
1269
|
<attribute name="type"/>
|
1279
1270
|
</optional>
|
1271
|
+
<ref name="LocalizedStringAttrs"/>
|
1280
1272
|
<oneOrMore>
|
1281
1273
|
<ref name="TextElement"/>
|
1282
1274
|
</oneOrMore>
|
@@ -1284,9 +1276,15 @@
|
|
1284
1276
|
</define>
|
1285
1277
|
<define name="bibabstract">
|
1286
1278
|
<element name="abstract">
|
1287
|
-
<
|
1288
|
-
|
1289
|
-
|
1279
|
+
<ref name="LocalizedStringAttrs"/>
|
1280
|
+
<choice>
|
1281
|
+
<oneOrMore>
|
1282
|
+
<ref name="BasicBlock"/>
|
1283
|
+
</oneOrMore>
|
1284
|
+
<oneOrMore>
|
1285
|
+
<ref name="TextElement"/>
|
1286
|
+
</oneOrMore>
|
1287
|
+
</choice>
|
1290
1288
|
</element>
|
1291
1289
|
</define>
|
1292
1290
|
<define name="copyright">
|
@@ -1391,6 +1389,7 @@
|
|
1391
1389
|
</attribute>
|
1392
1390
|
<optional>
|
1393
1391
|
<element name="description">
|
1392
|
+
<ref name="LocalizedStringAttrs"/>
|
1394
1393
|
<oneOrMore>
|
1395
1394
|
<ref name="TextElement"/>
|
1396
1395
|
</oneOrMore>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.3.
|
20
|
+
<!-- VERSION v1.3.1 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -1346,38 +1346,41 @@
|
|
1346
1346
|
</oneOrMore>
|
1347
1347
|
</element>
|
1348
1348
|
</define>
|
1349
|
+
<define name="Section-Attributes">
|
1350
|
+
<optional>
|
1351
|
+
<attribute name="id">
|
1352
|
+
<data type="ID"/>
|
1353
|
+
</attribute>
|
1354
|
+
</optional>
|
1355
|
+
<optional>
|
1356
|
+
<attribute name="language"/>
|
1357
|
+
</optional>
|
1358
|
+
<optional>
|
1359
|
+
<attribute name="script"/>
|
1360
|
+
</optional>
|
1361
|
+
<optional>
|
1362
|
+
<attribute name="inline-header">
|
1363
|
+
<data type="boolean"/>
|
1364
|
+
</attribute>
|
1365
|
+
</optional>
|
1366
|
+
<optional>
|
1367
|
+
<attribute name="number"/>
|
1368
|
+
</optional>
|
1369
|
+
<optional>
|
1370
|
+
<attribute name="branch-number"/>
|
1371
|
+
</optional>
|
1372
|
+
<optional>
|
1373
|
+
<attribute name="obligation">
|
1374
|
+
<choice>
|
1375
|
+
<value>normative</value>
|
1376
|
+
<value>informative</value>
|
1377
|
+
</choice>
|
1378
|
+
</attribute>
|
1379
|
+
</optional>
|
1380
|
+
</define>
|
1349
1381
|
<define name="reference-clause">
|
1350
1382
|
<element name="clause">
|
1351
|
-
<
|
1352
|
-
<attribute name="id">
|
1353
|
-
<data type="ID"/>
|
1354
|
-
</attribute>
|
1355
|
-
</optional>
|
1356
|
-
<optional>
|
1357
|
-
<attribute name="language"/>
|
1358
|
-
</optional>
|
1359
|
-
<optional>
|
1360
|
-
<attribute name="script"/>
|
1361
|
-
</optional>
|
1362
|
-
<optional>
|
1363
|
-
<attribute name="inline-header">
|
1364
|
-
<data type="boolean"/>
|
1365
|
-
</attribute>
|
1366
|
-
</optional>
|
1367
|
-
<optional>
|
1368
|
-
<attribute name="number"/>
|
1369
|
-
</optional>
|
1370
|
-
<optional>
|
1371
|
-
<attribute name="branch-number"/>
|
1372
|
-
</optional>
|
1373
|
-
<optional>
|
1374
|
-
<attribute name="obligation">
|
1375
|
-
<choice>
|
1376
|
-
<value>normative</value>
|
1377
|
-
<value>informative</value>
|
1378
|
-
</choice>
|
1379
|
-
</attribute>
|
1380
|
-
</optional>
|
1383
|
+
<ref name="Section-Attributes"/>
|
1381
1384
|
<optional>
|
1382
1385
|
<ref name="section-title"/>
|
1383
1386
|
</optional>
|
@@ -1566,36 +1569,7 @@
|
|
1566
1569
|
</element>
|
1567
1570
|
</define>
|
1568
1571
|
<define name="Content-Section">
|
1569
|
-
<
|
1570
|
-
<attribute name="id">
|
1571
|
-
<data type="ID"/>
|
1572
|
-
</attribute>
|
1573
|
-
</optional>
|
1574
|
-
<optional>
|
1575
|
-
<attribute name="language"/>
|
1576
|
-
</optional>
|
1577
|
-
<optional>
|
1578
|
-
<attribute name="script"/>
|
1579
|
-
</optional>
|
1580
|
-
<optional>
|
1581
|
-
<attribute name="inline-header">
|
1582
|
-
<data type="boolean"/>
|
1583
|
-
</attribute>
|
1584
|
-
</optional>
|
1585
|
-
<optional>
|
1586
|
-
<attribute name="obligation">
|
1587
|
-
<choice>
|
1588
|
-
<value>normative</value>
|
1589
|
-
<value>informative</value>
|
1590
|
-
</choice>
|
1591
|
-
</attribute>
|
1592
|
-
</optional>
|
1593
|
-
<optional>
|
1594
|
-
<attribute name="number"/>
|
1595
|
-
</optional>
|
1596
|
-
<optional>
|
1597
|
-
<attribute name="branch-number"/>
|
1598
|
-
</optional>
|
1572
|
+
<ref name="Section-Attributes"/>
|
1599
1573
|
<optional>
|
1600
1574
|
<attribute name="type"/>
|
1601
1575
|
</optional>
|
@@ -1617,39 +1591,10 @@
|
|
1617
1591
|
</element>
|
1618
1592
|
</define>
|
1619
1593
|
<define name="Clause-Section">
|
1620
|
-
<
|
1621
|
-
<attribute name="id">
|
1622
|
-
<data type="ID"/>
|
1623
|
-
</attribute>
|
1624
|
-
</optional>
|
1625
|
-
<optional>
|
1626
|
-
<attribute name="language"/>
|
1627
|
-
</optional>
|
1628
|
-
<optional>
|
1629
|
-
<attribute name="script"/>
|
1630
|
-
</optional>
|
1631
|
-
<optional>
|
1632
|
-
<attribute name="inline-header">
|
1633
|
-
<data type="boolean"/>
|
1634
|
-
</attribute>
|
1635
|
-
</optional>
|
1636
|
-
<optional>
|
1637
|
-
<attribute name="obligation">
|
1638
|
-
<choice>
|
1639
|
-
<value>normative</value>
|
1640
|
-
<value>informative</value>
|
1641
|
-
</choice>
|
1642
|
-
</attribute>
|
1643
|
-
</optional>
|
1594
|
+
<ref name="Section-Attributes"/>
|
1644
1595
|
<optional>
|
1645
1596
|
<attribute name="type"/>
|
1646
1597
|
</optional>
|
1647
|
-
<optional>
|
1648
|
-
<attribute name="number"/>
|
1649
|
-
</optional>
|
1650
|
-
<optional>
|
1651
|
-
<attribute name="branch-number"/>
|
1652
|
-
</optional>
|
1653
1598
|
<optional>
|
1654
1599
|
<ref name="section-title"/>
|
1655
1600
|
</optional>
|
@@ -1730,34 +1675,10 @@
|
|
1730
1675
|
</define>
|
1731
1676
|
<define name="terms">
|
1732
1677
|
<element name="terms">
|
1733
|
-
<
|
1734
|
-
<attribute name="id">
|
1735
|
-
<data type="ID"/>
|
1736
|
-
</attribute>
|
1737
|
-
</optional>
|
1738
|
-
<optional>
|
1739
|
-
<attribute name="language"/>
|
1740
|
-
</optional>
|
1741
|
-
<optional>
|
1742
|
-
<attribute name="script"/>
|
1743
|
-
</optional>
|
1678
|
+
<ref name="Section-Attributes"/>
|
1744
1679
|
<optional>
|
1745
1680
|
<attribute name="type"/>
|
1746
1681
|
</optional>
|
1747
|
-
<optional>
|
1748
|
-
<attribute name="number"/>
|
1749
|
-
</optional>
|
1750
|
-
<optional>
|
1751
|
-
<attribute name="branch-number"/>
|
1752
|
-
</optional>
|
1753
|
-
<optional>
|
1754
|
-
<attribute name="obligation">
|
1755
|
-
<choice>
|
1756
|
-
<value>normative</value>
|
1757
|
-
<value>informative</value>
|
1758
|
-
</choice>
|
1759
|
-
</attribute>
|
1760
|
-
</optional>
|
1761
1682
|
<optional>
|
1762
1683
|
<ref name="section-title"/>
|
1763
1684
|
</optional>
|
@@ -125,13 +125,6 @@ module Metanorma
|
|
125
125
|
"#{@doctype} is not a recognised document type")
|
126
126
|
end
|
127
127
|
|
128
|
-
def script_validate(xmldoc)
|
129
|
-
script = xmldoc&.at("//bibdata/script")&.text
|
130
|
-
%w(Cyrl Latn).include?(script) or
|
131
|
-
@log.add("Document Attributes", nil,
|
132
|
-
"#{script} is not a recognised script")
|
133
|
-
end
|
134
|
-
|
135
128
|
def iteration_validate(xmldoc)
|
136
129
|
iteration = xmldoc&.at("//bibdata/status/iteration")&.text or return
|
137
130
|
/^\d+/.match(iteration) or
|
@@ -141,7 +134,6 @@ module Metanorma
|
|
141
134
|
|
142
135
|
def bibdata_validate(doc)
|
143
136
|
doctype_validate(doc)
|
144
|
-
script_validate(doc)
|
145
137
|
iteration_validate(doc)
|
146
138
|
end
|
147
139
|
|
@@ -6,10 +6,10 @@ module Metanorma
|
|
6
6
|
module ISO
|
7
7
|
class Converter < Standoc::Converter
|
8
8
|
def extract_text(node)
|
9
|
-
return ""
|
10
|
-
|
9
|
+
node.nil? and return ""
|
11
10
|
node1 = Nokogiri::XML.fragment(node.to_s)
|
12
|
-
node1.xpath("
|
11
|
+
node1.xpath(".//link | .//locality | .//localityStack | .//stem")
|
12
|
+
.each(&:remove)
|
13
13
|
ret = ""
|
14
14
|
node1.traverse { |x| ret += x.text if x.text? }
|
15
15
|
HTMLEntities.new.decode(ret)
|
@@ -17,30 +17,26 @@ module Metanorma
|
|
17
17
|
|
18
18
|
# ISO/IEC DIR 2, 12.2
|
19
19
|
def foreword_style(node)
|
20
|
-
|
21
|
-
|
20
|
+
@novalid and return
|
22
21
|
style_no_guidance(node, extract_text(node), "Foreword")
|
23
22
|
end
|
24
23
|
|
25
24
|
# ISO/IEC DIR 2, 14.2
|
26
25
|
def scope_style(node)
|
27
|
-
|
28
|
-
|
26
|
+
@novalid and return
|
29
27
|
style_no_guidance(node, extract_text(node), "Scope")
|
30
28
|
end
|
31
29
|
|
32
30
|
# ISO/IEC DIR 2, 13.2
|
33
31
|
def introduction_style(node)
|
34
|
-
|
35
|
-
|
32
|
+
@novalid and return
|
36
33
|
r = requirement_check(extract_text(node))
|
37
34
|
style_warning(node, "Introduction may contain requirement", r) if r
|
38
35
|
end
|
39
36
|
|
40
37
|
# ISO/IEC DIR 2, 16.5.6
|
41
38
|
def definition_style(node)
|
42
|
-
|
43
|
-
|
39
|
+
@novalid and return
|
44
40
|
r = requirement_check(extract_text(node))
|
45
41
|
style_warning(node, "Definition may contain requirement", r) if r
|
46
42
|
end
|
@@ -48,24 +44,21 @@ module Metanorma
|
|
48
44
|
# ISO/IEC DIR 2, 16.5.7
|
49
45
|
# ISO/IEC DIR 2, 25.5
|
50
46
|
def example_style(node)
|
51
|
-
|
52
|
-
|
47
|
+
@novalid and return
|
53
48
|
style_no_guidance(node, extract_text(node), "Example")
|
54
49
|
style(node, extract_text(node))
|
55
50
|
end
|
56
51
|
|
57
52
|
# ISO/IEC DIR 2, 24.5
|
58
53
|
def note_style(node)
|
59
|
-
|
60
|
-
|
54
|
+
@novalid and return
|
61
55
|
style_no_guidance(node, extract_text(node), "Note")
|
62
56
|
style(node, extract_text(node))
|
63
57
|
end
|
64
58
|
|
65
59
|
# ISO/IEC DIR 2, 26.5
|
66
60
|
def footnote_style(node)
|
67
|
-
|
68
|
-
|
61
|
+
@novalid and return
|
69
62
|
style_no_guidance(node, extract_text(node), "Footnote")
|
70
63
|
style(node, extract_text(node))
|
71
64
|
end
|
@@ -91,7 +84,7 @@ module Metanorma
|
|
91
84
|
|
92
85
|
def style(node, text)
|
93
86
|
@novalid and return
|
94
|
-
style_number(node, text)
|
87
|
+
@novalid_number or style_number(node, text)
|
95
88
|
style_percent(node, text)
|
96
89
|
style_abbrev(node, text)
|
97
90
|
style_units(node, text)
|
@@ -116,6 +109,8 @@ module Metanorma
|
|
116
109
|
def style_ambig_words(node, text)
|
117
110
|
r = ambig_words_check(text) and
|
118
111
|
style_warning(node, "may contain ambiguous provision", r)
|
112
|
+
@lang == "en" and style_regex(/\b(?<num>billions?)\b/i,
|
113
|
+
"ambiguous number", node, text)
|
119
114
|
end
|
120
115
|
|
121
116
|
# ISO/IEC DIR 2, 9.1
|
@@ -124,11 +119,12 @@ module Metanorma
|
|
124
119
|
def style_number(node, text)
|
125
120
|
style_number_grouping(node, text)
|
126
121
|
style_regex(/(?:^|\p{Zs})(?<num>[0-9]+\.[0-9]+)(?!\.[0-9])/i,
|
127
|
-
"possible decimal point", node, text)
|
122
|
+
"possible decimal point: mark up numbers with stem:[]", node, text)
|
128
123
|
@lang == "en" and style_regex(/\b(?<num>billions?)\b/i,
|
129
124
|
"ambiguous number", node, text)
|
130
125
|
style_regex(/(?:^|\p{Zs})(?<num>-[0-9][0-9,.]*)/i,
|
131
126
|
"hyphen instead of minus sign U+2212", node, text)
|
127
|
+
@novalid_number = true
|
132
128
|
end
|
133
129
|
|
134
130
|
def style_number_grouping(node, text)
|
@@ -136,13 +132,13 @@ module Metanorma
|
|
136
132
|
style_two_regex_not_prev(
|
137
133
|
node, text, /^(?<num>-?[0-9]{4,}[,0-9]*)\Z/,
|
138
134
|
%r{\b(ISO|IEC|IEEE|(in|January|February|March|April|May|June|August|September|October|November|December)\b)\Z},
|
139
|
-
"number not broken up in threes"
|
135
|
+
"number not broken up in threes: mark up numbers with stem:[]"
|
140
136
|
)
|
141
137
|
else
|
142
138
|
style_two_regex_not_prev(
|
143
139
|
node, text, /^(?<num>-?(?:[0-9]{5,}[,0-9]*|[03-9]\d\d\d|1[0-8]\d\d|2[1-9]\d\d|20[5-9]\d))\Z/,
|
144
140
|
%r{\b(ISO|IEC|IEEE|\b)\Z},
|
145
|
-
"number not broken up in threes"
|
141
|
+
"number not broken up in threes: mark up numbers with stem:[]"
|
146
142
|
)
|
147
143
|
end
|
148
144
|
end
|
data/metanorma-iso.gemspec
CHANGED
@@ -34,9 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
|
35
35
|
spec.add_dependency "metanorma-standoc", "~> 2.8.4"
|
36
36
|
spec.add_dependency "mnconvert", "~> 1.14"
|
37
|
-
spec.add_dependency "pubid
|
38
|
-
spec.add_dependency "pubid-iec"
|
39
|
-
spec.add_dependency "pubid-iso"
|
37
|
+
spec.add_dependency "pubid"
|
40
38
|
spec.add_dependency "tokenizer", "~> 0.3.0"
|
41
39
|
|
42
40
|
spec.add_development_dependency "debug"
|