metanorma-iso 1.3.24 → 1.3.25
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/.github/workflows/macos.yml +8 -0
- data/.github/workflows/ubuntu.yml +8 -0
- data/.github/workflows/windows.yml +8 -0
- data/lib/asciidoctor/iso/base.rb +5 -0
- data/lib/asciidoctor/iso/biblio.rng +22 -2
- data/lib/asciidoctor/iso/cleanup.rb +9 -0
- data/lib/asciidoctor/iso/front.rb +72 -14
- data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
- data/lib/asciidoctor/iso/isostandard.rng +2 -0
- data/lib/asciidoctor/iso/section.rb +12 -0
- data/lib/asciidoctor/iso/validate.rb +39 -18
- data/lib/isodoc/iso/base_convert.rb +32 -6
- data/lib/isodoc/iso/html/html_iso_titlepage.html +16 -16
- data/lib/isodoc/iso/html/scripts.html +18 -0
- data/lib/isodoc/iso/html/style-human.scss +16 -0
- data/lib/isodoc/iso/html/style-iso.scss +11 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
- data/lib/isodoc/iso/html/wordstyle.scss +31 -4
- data/lib/isodoc/iso/metadata.rb +42 -2
- data/lib/metanorma/iso/processor.rb +6 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/amd_spec.rb +318 -0
- data/spec/asciidoctor-iso/base_spec.rb +12 -10
- data/spec/isodoc/postproc_spec.rb +2 -2
- data/spec/isodoc/ref_spec.rb +2 -2
- data/spec/isodoc/table_spec.rb +21 -21
- data/spec/isodoc/xref_spec.rb +8 -8
- data/spec/spec_helper.rb +11 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 766cfd076caf6c78f48542cc22353664f2ee4667be97659e201643418b4990ad
|
4
|
+
data.tar.gz: 667d8b7ed3ac77f49a88cd74cae0eaa3f097c2d65c3ed4269806351fdc87e07e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35ab4b8f52d75727d867920d7de2bd8696e37e38715dcc3895fe67f821311b6a13ac71e5d3a65096694ce800972e81fce5a881d861b534d911cdfcdf17d6f73f
|
7
|
+
data.tar.gz: 3d11aecb223c66aa9b2cc1c68bd9b6c227b6ea4710b3afa11556ba0351d969efcf8b39911899670aeab7af43ea6b1aeee8ba56196c575fd802fcb250cfb0a622
|
data/.github/workflows/macos.yml
CHANGED
@@ -6,15 +6,23 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/ubuntu.yml
|
11
|
+
- .github/workflows/windows.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-macos:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} macOS
|
13
16
|
runs-on: macos-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Use Ruby
|
@@ -6,15 +6,23 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/windows.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-linux:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
13
16
|
runs-on: ubuntu-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Use Ruby
|
@@ -6,15 +6,23 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/ubuntu.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-windows:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} Windows
|
13
16
|
runs-on: windows-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Use Ruby
|
data/lib/asciidoctor/iso/base.rb
CHANGED
@@ -36,6 +36,11 @@ module Asciidoctor
|
|
36
36
|
IsoDoc::Iso::PdfConvert.new(doc_extract_attributes(node))
|
37
37
|
end
|
38
38
|
|
39
|
+
def init(node)
|
40
|
+
super
|
41
|
+
@amd = %w(amendment technical-corrigendum).include? node.attr("doctype")
|
42
|
+
end
|
43
|
+
|
39
44
|
def document(node)
|
40
45
|
init(node)
|
41
46
|
ret = makexml(node).to_xml(indent: 2)
|
@@ -88,7 +88,7 @@
|
|
88
88
|
<text/>
|
89
89
|
</element>
|
90
90
|
</define>
|
91
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
92
92
|
<optional>
|
93
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
94
94
|
<attribute name="language"/>
|
@@ -98,6 +98,16 @@
|
|
98
98
|
</optional>
|
99
99
|
<text/>
|
100
100
|
</define>
|
101
|
+
<define name="LocalizedString">
|
102
|
+
<choice>
|
103
|
+
<ref name="LocalizedString1"/>
|
104
|
+
<oneOrMore>
|
105
|
+
<element name="variant">
|
106
|
+
<ref name="LocalizedString1"/>
|
107
|
+
</element>
|
108
|
+
</oneOrMore>
|
109
|
+
</choice>
|
110
|
+
</define>
|
101
111
|
<!--
|
102
112
|
Unlike UML, change type to format: type is overloaded
|
103
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -121,7 +131,7 @@
|
|
121
131
|
</optional>
|
122
132
|
<ref name="LocalizedStringOrXsAny"/>
|
123
133
|
</define>
|
124
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
125
135
|
<optional>
|
126
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
127
137
|
<attribute name="language"/>
|
@@ -136,6 +146,16 @@
|
|
136
146
|
</choice>
|
137
147
|
</oneOrMore>
|
138
148
|
</define>
|
149
|
+
<define name="LocalizedStringOrXsAny">
|
150
|
+
<choice>
|
151
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
152
|
+
<oneOrMore>
|
153
|
+
<element name="variant">
|
154
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
155
|
+
</element>
|
156
|
+
</oneOrMore>
|
157
|
+
</choice>
|
158
|
+
</define>
|
139
159
|
<define name="contributor">
|
140
160
|
<element name="contributor">
|
141
161
|
<zeroOrMore>
|
@@ -36,6 +36,7 @@ module Asciidoctor
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def id_prefix(prefix, id)
|
39
|
+
return id.text if @amd # we're just inheriting the prefixes from parent doc
|
39
40
|
prefix.join("/") + ( id.text.match(%{^/}) ? "" : " " ) + id.text
|
40
41
|
end
|
41
42
|
|
@@ -116,6 +117,14 @@ module Asciidoctor
|
|
116
117
|
"#{num.nil? ? abbrid : sprintf("%09d", num.to_i)} :: "\
|
117
118
|
"#{partid} :: #{id&.text} :: #{title}"
|
118
119
|
end
|
120
|
+
|
121
|
+
def sections_cleanup(x)
|
122
|
+
super
|
123
|
+
return unless @amd
|
124
|
+
x.xpath("//*[@inline-header]").each do |h|
|
125
|
+
h.delete('inline-header')
|
126
|
+
end
|
127
|
+
end
|
119
128
|
end
|
120
129
|
end
|
121
130
|
end
|
@@ -33,15 +33,23 @@ module Asciidoctor
|
|
33
33
|
"95": "Withdrawal",
|
34
34
|
}.freeze
|
35
35
|
|
36
|
-
def stage_abbr(stage, substage)
|
36
|
+
def stage_abbr(stage, substage, doctype)
|
37
37
|
return nil if stage.to_i > 60
|
38
38
|
return "PRF" if stage == "60" && substage == "00"
|
39
|
-
STAGE_ABBRS[stage.to_sym]
|
39
|
+
ret = STAGE_ABBRS[stage.to_sym]
|
40
|
+
ret = "DTS" if ret == "DIS" && %w(technical-report technical-specification).include?(doctype)
|
41
|
+
ret = "FDTS" if ret == "FDIS" && %w(technical-report technical-specification).include?(doctype)
|
42
|
+
ret
|
40
43
|
end
|
41
44
|
|
42
|
-
def stage_name(stage, substage)
|
45
|
+
def stage_name(stage, substage, doctype)
|
43
46
|
return "Proof" if stage == "60" && substage == "00"
|
44
|
-
STAGE_NAMES[stage.to_sym]
|
47
|
+
ret = STAGE_NAMES[stage.to_sym]
|
48
|
+
if %w(technical-report technical-specification).include? doctype
|
49
|
+
ret = "Draft technical standard" if ret == "Draft international standard"
|
50
|
+
ret = "Final draft technical standard" if ret == "Final draft international standard"
|
51
|
+
end
|
52
|
+
ret
|
45
53
|
end
|
46
54
|
|
47
55
|
def metadata_id(node, xml)
|
@@ -53,9 +61,8 @@ module Asciidoctor
|
|
53
61
|
end
|
54
62
|
|
55
63
|
def iso_id(node, xml)
|
56
|
-
return unless node.attr("docnumber")
|
57
|
-
|
58
|
-
dn = add_id_parts(node.attr("docnumber"), part, subpart)
|
64
|
+
return unless !@amd && node.attr("docnumber") || @amd && node.attr("updates")
|
65
|
+
dn = iso_id1(node)
|
59
66
|
dn1 = id_stage_prefix(dn, node, false)
|
60
67
|
dn2 = id_stage_prefix(dn, node, true)
|
61
68
|
xml.docidentifier dn1, **attr_code(type: "iso")
|
@@ -63,6 +70,27 @@ module Asciidoctor
|
|
63
70
|
xml.docidentifier id_langsuffix(dn2, node), **attr_code(type: "iso-reference")
|
64
71
|
end
|
65
72
|
|
73
|
+
def iso_id1(node)
|
74
|
+
if @amd
|
75
|
+
dn = node.attr("updates")
|
76
|
+
return add_amd_parts(dn, node)
|
77
|
+
else
|
78
|
+
part, subpart = node&.attr("partnumber")&.split(/-/)
|
79
|
+
dn = add_id_parts(node.attr("docnumber"), part, subpart)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_amd_parts(dn, node)
|
84
|
+
a = node.attr("amendment-number")
|
85
|
+
c = node.attr("corrigendum-number")
|
86
|
+
case node.attr("doctype")
|
87
|
+
when "amendment"
|
88
|
+
"#{dn}/Amd.#{node.attr('amendment-number')}"
|
89
|
+
when "technical corrigendum"
|
90
|
+
"#{dn}/Cor.#{node.attr('corrigendum-number')}"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
66
94
|
def id_langsuffix(dn, node)
|
67
95
|
lang = node.attr("language") || "en"
|
68
96
|
suffix = case lang
|
@@ -77,7 +105,9 @@ module Asciidoctor
|
|
77
105
|
def metadata_ext(node, xml)
|
78
106
|
super
|
79
107
|
structured_id(node, xml)
|
80
|
-
xml.stagename stage_name(get_stage(node), get_substage(node))
|
108
|
+
xml.stagename stage_name(get_stage(node), get_substage(node), node.attr("doctype"))
|
109
|
+
@amd && a = node.attr("updates-document-type") and
|
110
|
+
xml.updates_document_type a
|
81
111
|
end
|
82
112
|
|
83
113
|
def structured_id(node, xml)
|
@@ -85,7 +115,8 @@ module Asciidoctor
|
|
85
115
|
part, subpart = node&.attr("partnumber")&.split(/-/)
|
86
116
|
xml.structuredidentifier do |i|
|
87
117
|
i.project_number node.attr("docnumber"),
|
88
|
-
**attr_code(part: part, subpart: subpart)
|
118
|
+
**attr_code(part: part, subpart: subpart, amendment: node.attr("amendment-number"),
|
119
|
+
corrigendum: node.attr("corrigendum-number"), origyr: node.attr("created-date"))
|
89
120
|
end
|
90
121
|
end
|
91
122
|
|
@@ -97,19 +128,27 @@ module Asciidoctor
|
|
97
128
|
|
98
129
|
def id_stage_abbr(stage, substage, node)
|
99
130
|
IsoDoc::Iso::Metadata.new("en", "Latn", {}).
|
100
|
-
status_abbrev(stage_abbr(stage, substage
|
101
|
-
|
131
|
+
status_abbrev(stage_abbr(stage, substage, node.attr("doctype")),
|
132
|
+
substage, node.attr("iteration"),
|
133
|
+
node.attr("draft"), node.attr("doctype"))
|
102
134
|
end
|
103
135
|
|
104
136
|
def id_stage_prefix(dn, node, force_year)
|
105
137
|
stage = get_stage(node)
|
106
138
|
substage = get_substage(node)
|
139
|
+
typeabbr = get_typeabbr(node)
|
107
140
|
if stage && (stage.to_i < 60)
|
108
141
|
abbr = id_stage_abbr(stage, substage, node)
|
109
|
-
|
142
|
+
unless abbr.nil? || abbr.empty? # prefixes added in cleanup
|
143
|
+
dn = @amd ? dn.sub(/ /, "/#{abbr} ") : "/#{abbr} #{typeabbr}#{dn}"
|
144
|
+
end
|
145
|
+
elsif typeabbr && !@amd
|
146
|
+
dn = "/#{typeabbr}#{dn}"
|
110
147
|
end
|
111
148
|
if force_year || !(stage && (stage.to_i < 60))
|
112
|
-
|
149
|
+
year = @amd ? (node.attr("copyright-year") || node.attr("updated-date").sub(/-.*$/, "")) :
|
150
|
+
node.attr("copyright-year")
|
151
|
+
dn += ":#{year}" if year
|
113
152
|
end
|
114
153
|
dn
|
115
154
|
end
|
@@ -169,11 +208,20 @@ module Asciidoctor
|
|
169
208
|
node.attr("docsubstage") || ( stage == "60" ? "60" : "00" )
|
170
209
|
end
|
171
210
|
|
211
|
+
def get_typeabbr(node)
|
212
|
+
case node.attr("doctype")
|
213
|
+
when "technical-report" then "TR "
|
214
|
+
when "technical-specification" then "TS "
|
215
|
+
else
|
216
|
+
nil
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
172
220
|
def metadata_status(node, xml)
|
173
221
|
stage = get_stage(node)
|
174
222
|
substage = get_substage(node)
|
175
223
|
xml.status do |s|
|
176
|
-
s.stage stage, **attr_code(abbreviation: stage_abbr(stage, substage))
|
224
|
+
s.stage stage, **attr_code(abbreviation: stage_abbr(stage, substage, node.attr("doctype")))
|
177
225
|
s.substage substage
|
178
226
|
node.attr("iteration") && (s.iteration node.attr("iteration"))
|
179
227
|
end
|
@@ -208,12 +256,21 @@ module Asciidoctor
|
|
208
256
|
end
|
209
257
|
end
|
210
258
|
|
259
|
+
def title_amd(node, t, lang, at)
|
260
|
+
return unless node.attr("title-amendment-#{lang}")
|
261
|
+
t.title(**attr_code(at.merge(type: "title-amd"))) do |t1|
|
262
|
+
t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
211
266
|
def title_full(node, t, lang, at)
|
212
267
|
title = node.attr("title-main-#{lang}")
|
213
268
|
intro = node.attr("title-intro-#{lang}")
|
214
269
|
part = node.attr("title-part-#{lang}")
|
270
|
+
amd = node.attr("title-amendment-#{lang}")
|
215
271
|
title = "#{intro} -- #{title}" if intro
|
216
272
|
title = "#{title} -- #{part}" if part
|
273
|
+
title = "#{title} -- #{amd}" if amd && @amd
|
217
274
|
t.title **attr_code(at.merge(type: "main")) do |t1|
|
218
275
|
t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
|
219
276
|
end
|
@@ -226,6 +283,7 @@ module Asciidoctor
|
|
226
283
|
title_intro(node, xml, lang, at)
|
227
284
|
title_main(node, xml, lang, at)
|
228
285
|
title_part(node, xml, lang, at)
|
286
|
+
title_amd(node, xml, lang, at) if @amd
|
229
287
|
end
|
230
288
|
end
|
231
289
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<grammar ns="https://www.metanorma.org/ns/iso" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
|
4
|
+
<include href="isostandard.rng">
|
5
|
+
<start>
|
6
|
+
<ref name="iso-standard"/>
|
7
|
+
</start>
|
8
|
+
<define name="sections">
|
9
|
+
<element name="sections">
|
10
|
+
<oneOrMore>
|
11
|
+
<ref name="clause"/>
|
12
|
+
</oneOrMore>
|
13
|
+
</element>
|
14
|
+
</define>
|
15
|
+
<define name="clause">
|
16
|
+
<element name="clause">
|
17
|
+
<optional>
|
18
|
+
<attribute name="type"/>
|
19
|
+
</optional>
|
20
|
+
<optional>
|
21
|
+
<attribute name="change">
|
22
|
+
<choice>
|
23
|
+
<value>add</value>
|
24
|
+
<value>delete</value>
|
25
|
+
<value>modify</value>
|
26
|
+
</choice>
|
27
|
+
</attribute>
|
28
|
+
</optional>
|
29
|
+
<optional>
|
30
|
+
<attribute name="locality"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="Clause-Section"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
35
|
+
<define name="iso-standard">
|
36
|
+
<element name="iso-standard">
|
37
|
+
<ref name="bibdata"/>
|
38
|
+
<optional>
|
39
|
+
<ref name="boilerplate"/>
|
40
|
+
</optional>
|
41
|
+
<ref name="preface"/>
|
42
|
+
<oneOrMore>
|
43
|
+
<ref name="sections"/>
|
44
|
+
</oneOrMore>
|
45
|
+
</element>
|
46
|
+
</define>
|
47
|
+
<define name="documentnumber">
|
48
|
+
<element name="project-number">
|
49
|
+
<optional>
|
50
|
+
<attribute name="part">
|
51
|
+
<data type="int"/>
|
52
|
+
</attribute>
|
53
|
+
</optional>
|
54
|
+
<optional>
|
55
|
+
<attribute name="subpart">
|
56
|
+
<data type="int"/>
|
57
|
+
</attribute>
|
58
|
+
</optional>
|
59
|
+
<optional>
|
60
|
+
<attribute name="amendment">
|
61
|
+
<data type="int"/>
|
62
|
+
</attribute>
|
63
|
+
</optional>
|
64
|
+
<optional>
|
65
|
+
<attribute name="corrigendum">
|
66
|
+
<data type="int"/>
|
67
|
+
</attribute>
|
68
|
+
</optional>
|
69
|
+
<optional>
|
70
|
+
<attribute name="origyr">
|
71
|
+
<data type="int"/>
|
72
|
+
</attribute>
|
73
|
+
</optional>
|
74
|
+
<text/>
|
75
|
+
</element>
|
76
|
+
</define>
|
77
|
+
<define name="BibDataExtensionType">
|
78
|
+
<ref name="doctype"/>
|
79
|
+
<ref name="editorialgroup"/>
|
80
|
+
<zeroOrMore>
|
81
|
+
<ref name="ics"/>
|
82
|
+
</zeroOrMore>
|
83
|
+
<ref name="structuredidentifier"/>
|
84
|
+
<optional>
|
85
|
+
<ref name="stagename"/>
|
86
|
+
</optional>
|
87
|
+
<optional>
|
88
|
+
<ref name="updates_document_type"/>
|
89
|
+
</optional>
|
90
|
+
</define>
|
91
|
+
</include>
|
92
|
+
<!-- end overrides -->
|
93
|
+
<define name="updates_document_type">
|
94
|
+
<element name="updates-document-type">
|
95
|
+
<ref name="DocumentType"/>
|
96
|
+
</element>
|
97
|
+
</define>
|
98
|
+
</grammar>
|
@@ -263,6 +263,8 @@
|
|
263
263
|
<value>publicly-available-specification</value>
|
264
264
|
<value>international-workshop-agreement</value>
|
265
265
|
<value>guide</value>
|
266
|
+
<value>amendment</value>
|
267
|
+
<value>technical-corrigendum</value>
|
266
268
|
</choice>
|
267
269
|
</define>
|
268
270
|
<define name="structuredidentifier">
|