metanorma-iso 2.7.4 → 2.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iso/i18n-en.yaml +2 -0
- data/lib/isodoc/iso/i18n-fr.yaml +2 -0
- data/lib/isodoc/iso/i18n-ru.yaml +2 -0
- data/lib/isodoc/iso/index.rb +4 -6
- data/lib/isodoc/iso/iso.amendment.xsl +929 -171
- data/lib/isodoc/iso/iso.international-standard.xsl +929 -171
- data/lib/isodoc/iso/presentation_xml_convert.rb +9 -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 +7 -11
- data/lib/isodoc/iso/xref_section.rb +23 -2
- data/lib/metanorma/iso/base.rb +9 -1
- data/lib/metanorma/iso/biblio.rng +24 -8
- data/lib/metanorma/iso/boilerplate-fr.adoc +1 -1
- data/lib/metanorma/iso/boilerplate-ru.adoc +1 -1
- data/lib/metanorma/iso/boilerplate.adoc +1 -1
- data/lib/metanorma/iso/cleanup.rb +8 -112
- data/lib/metanorma/iso/cleanup_biblio.rb +120 -0
- data/lib/metanorma/iso/front_id.rb +5 -5
- data/lib/metanorma/iso/isodoc.rng +67 -55
- 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 +4 -31
@@ -156,44 +156,7 @@
|
|
156
156
|
</define>
|
157
157
|
<define name="xref">
|
158
158
|
<element name="xref">
|
159
|
-
<
|
160
|
-
<data type="string">
|
161
|
-
<param name="pattern">\i\c*|\c+#\c+</param>
|
162
|
-
</data>
|
163
|
-
</attribute>
|
164
|
-
<optional>
|
165
|
-
<attribute name="to">
|
166
|
-
<data type="string">
|
167
|
-
<param name="pattern">\i\c*|\c+#\c+</param>
|
168
|
-
</data>
|
169
|
-
</attribute>
|
170
|
-
</optional>
|
171
|
-
<optional>
|
172
|
-
<attribute name="type">
|
173
|
-
<ref name="ReferenceFormat"/>
|
174
|
-
</attribute>
|
175
|
-
</optional>
|
176
|
-
<optional>
|
177
|
-
<attribute name="alt"/>
|
178
|
-
</optional>
|
179
|
-
<optional>
|
180
|
-
<attribute name="case">
|
181
|
-
<choice>
|
182
|
-
<value>capital</value>
|
183
|
-
<value>lowercase</value>
|
184
|
-
</choice>
|
185
|
-
</attribute>
|
186
|
-
</optional>
|
187
|
-
<optional>
|
188
|
-
<attribute name="droploc">
|
189
|
-
<data type="boolean"/>
|
190
|
-
</attribute>
|
191
|
-
</optional>
|
192
|
-
<optional>
|
193
|
-
<attribute name="style">
|
194
|
-
<ref name="XrefStyleType"/>
|
195
|
-
</attribute>
|
196
|
-
</optional>
|
159
|
+
<ref name="XrefAttributes"/>
|
197
160
|
<ref name="XrefBody"/>
|
198
161
|
</element>
|
199
162
|
</define>
|
@@ -407,23 +370,7 @@
|
|
407
370
|
</define>
|
408
371
|
<define name="figure">
|
409
372
|
<element name="figure">
|
410
|
-
<
|
411
|
-
<data type="ID"/>
|
412
|
-
</attribute>
|
413
|
-
<optional>
|
414
|
-
<attribute name="unnumbered">
|
415
|
-
<data type="boolean"/>
|
416
|
-
</attribute>
|
417
|
-
</optional>
|
418
|
-
<optional>
|
419
|
-
<attribute name="number"/>
|
420
|
-
</optional>
|
421
|
-
<optional>
|
422
|
-
<attribute name="subsequence"/>
|
423
|
-
</optional>
|
424
|
-
<optional>
|
425
|
-
<attribute name="class"/>
|
426
|
-
</optional>
|
373
|
+
<ref name="FigureAttributes"/>
|
427
374
|
<ref name="BlockAttributes"/>
|
428
375
|
<optional>
|
429
376
|
<ref name="tname"/>
|
@@ -2450,6 +2397,49 @@
|
|
2450
2397
|
</zeroOrMore>
|
2451
2398
|
</element>
|
2452
2399
|
</define>
|
2400
|
+
<define name="XrefAttributes">
|
2401
|
+
<attribute name="target">
|
2402
|
+
<data type="string">
|
2403
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
2404
|
+
</data>
|
2405
|
+
</attribute>
|
2406
|
+
<optional>
|
2407
|
+
<attribute name="to">
|
2408
|
+
<data type="string">
|
2409
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
2410
|
+
</data>
|
2411
|
+
</attribute>
|
2412
|
+
</optional>
|
2413
|
+
<optional>
|
2414
|
+
<attribute name="type">
|
2415
|
+
<ref name="ReferenceFormat"/>
|
2416
|
+
</attribute>
|
2417
|
+
</optional>
|
2418
|
+
<optional>
|
2419
|
+
<attribute name="alt"/>
|
2420
|
+
</optional>
|
2421
|
+
<optional>
|
2422
|
+
<attribute name="case">
|
2423
|
+
<choice>
|
2424
|
+
<value>capital</value>
|
2425
|
+
<value>lowercase</value>
|
2426
|
+
</choice>
|
2427
|
+
</attribute>
|
2428
|
+
</optional>
|
2429
|
+
<optional>
|
2430
|
+
<attribute name="droploc">
|
2431
|
+
<data type="boolean"/>
|
2432
|
+
</attribute>
|
2433
|
+
</optional>
|
2434
|
+
<optional>
|
2435
|
+
<attribute name="style">
|
2436
|
+
<ref name="XrefStyleType"/>
|
2437
|
+
</attribute>
|
2438
|
+
</optional>
|
2439
|
+
<optional>
|
2440
|
+
<attribute name="label"/>
|
2441
|
+
</optional>
|
2442
|
+
</define>
|
2453
2443
|
<define name="XrefBody">
|
2454
2444
|
<zeroOrMore>
|
2455
2445
|
<ref name="XrefTarget"/>
|
@@ -2528,6 +2518,28 @@
|
|
2528
2518
|
<attribute name="columns"/>
|
2529
2519
|
</optional>
|
2530
2520
|
</define>
|
2521
|
+
<define name="FigureAttributes">
|
2522
|
+
<attribute name="id">
|
2523
|
+
<data type="ID"/>
|
2524
|
+
</attribute>
|
2525
|
+
<optional>
|
2526
|
+
<attribute name="unnumbered">
|
2527
|
+
<data type="boolean"/>
|
2528
|
+
</attribute>
|
2529
|
+
</optional>
|
2530
|
+
<optional>
|
2531
|
+
<attribute name="number"/>
|
2532
|
+
</optional>
|
2533
|
+
<optional>
|
2534
|
+
<attribute name="subsequence"/>
|
2535
|
+
</optional>
|
2536
|
+
<optional>
|
2537
|
+
<attribute name="class"/>
|
2538
|
+
</optional>
|
2539
|
+
<optional>
|
2540
|
+
<attribute name="width"/>
|
2541
|
+
</optional>
|
2542
|
+
</define>
|
2531
2543
|
<start>
|
2532
2544
|
<ref name="standard-document"/>
|
2533
2545
|
</start>
|
@@ -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"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -39,35 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.14'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: pubid
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pubid-iec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pubid-iso
|
42
|
+
name: pubid
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
72
44
|
requirements:
|
73
45
|
- - ">="
|
@@ -375,6 +347,7 @@ files:
|
|
375
347
|
- lib/metanorma/iso/boilerplate-ru.adoc
|
376
348
|
- lib/metanorma/iso/boilerplate.adoc
|
377
349
|
- lib/metanorma/iso/cleanup.rb
|
350
|
+
- lib/metanorma/iso/cleanup_biblio.rb
|
378
351
|
- lib/metanorma/iso/converter.rb
|
379
352
|
- lib/metanorma/iso/front.rb
|
380
353
|
- lib/metanorma/iso/front_contributor.rb
|