metanorma-iso 3.0.2 → 3.0.4
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/html/style-human.css +7 -0
- data/lib/isodoc/iso/html/style-iso.css +7 -0
- data/lib/isodoc/iso/i18n-en.yaml +55 -0
- data/lib/isodoc/iso/i18n-fr.yaml +25 -0
- data/lib/isodoc/iso/iso.amendment.xsl +325 -93
- data/lib/isodoc/iso/iso.international-standard.xsl +325 -93
- data/lib/isodoc/iso/presentation_bibdata.rb +10 -2
- data/lib/isodoc/iso/presentation_section.rb +138 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +17 -130
- data/lib/isodoc/iso/word_convert.rb +5 -16
- data/lib/isodoc/iso/xref.rb +0 -6
- data/lib/metanorma/iso/basicdoc.rng +48 -35
- data/lib/metanorma/iso/biblio-standoc.rng +37 -7
- data/lib/metanorma/iso/biblio.rng +30 -18
- data/lib/metanorma/iso/cleanup.rb +2 -2
- data/lib/metanorma/iso/front.rb +1 -6
- data/lib/metanorma/iso/isodoc.rng +126 -80
- data/lib/metanorma/iso/isostandard-amd.rng +4 -7
- data/lib/metanorma/iso/isostandard.rng +6 -149
- data/lib/metanorma/iso/relaton-iso.rng +35 -34
- data/lib/metanorma/iso/reqt.rng +7 -6
- data/lib/metanorma/iso/validate.rb +8 -11
- data/lib/metanorma/iso/validate_requirements.rb +9 -6
- data/lib/metanorma/iso/validate_style.rb +12 -11
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +3 -2
@@ -69,8 +69,16 @@ module IsoDoc
|
|
69
69
|
i18n.get.dig("stage_dict", stage.text).is_a?(Hash) or
|
70
70
|
return hash_translate(bib, i18n.get["stage_dict"],
|
71
71
|
"./status/stage", lang)
|
72
|
-
|
73
|
-
|
72
|
+
bibdata_i18n_stage1(stage, type, lang, i18n)
|
73
|
+
end
|
74
|
+
|
75
|
+
def bibdata_i18n_stage1(stage, type, lang, i18n)
|
76
|
+
stagetype = i18n.get.dig("stage_dict", stage.text, type&.text) or return
|
77
|
+
h = i18n.get.dig("stage_draft_variants", stagetype) and h.each do |k, v|
|
78
|
+
tag_translate(stage, lang, v)
|
79
|
+
stage.next["type"] = k
|
80
|
+
end
|
81
|
+
tag_translate(stage, lang, stagetype)
|
74
82
|
end
|
75
83
|
end
|
76
84
|
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
4
|
+
def comments(docxml)
|
5
|
+
warning_for_missing_metadata(docxml)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def warning_for_missing_metadata(docxml)
|
10
|
+
@meta.get[:unpublished] or return
|
11
|
+
ret = warning_for_missing_metadata_create(docxml)
|
12
|
+
ret.empty? and return
|
13
|
+
warning_for_missing_metadata_post(docxml, ret)
|
14
|
+
end
|
15
|
+
|
16
|
+
def warning_for_missing_metadata_create(docxml)
|
17
|
+
ret = ""
|
18
|
+
docxml.at(ns("//bibdata/ext//secretariat")) or
|
19
|
+
ret += "<p>Secretariat is missing.</p>"
|
20
|
+
docxml.at(ns("//bibdata/ext//editorialgroup")) or
|
21
|
+
ret += "<p>Editorial groups are missing.</p>"
|
22
|
+
docxml.at(ns("//bibdata/date[@type = 'published' or @type = 'issued' " \
|
23
|
+
"or @type = 'created']")) ||
|
24
|
+
docxml.at(ns("//bibdata/version/revision-date")) or
|
25
|
+
ret += "<p>Document date is missing.</p>"
|
26
|
+
ret
|
27
|
+
end
|
28
|
+
|
29
|
+
def warning_for_missing_metadata_post(docxml, ret)
|
30
|
+
from = docxml.at(ns("//sections/*/@id"))&.text or return
|
31
|
+
id = UUIDTools::UUID.random_create
|
32
|
+
ret = <<~REVIEW
|
33
|
+
<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}' from='#{from}' to='#{from}'>
|
34
|
+
<p><strong>Metadata warnings:</strong></p> #{ret}
|
35
|
+
</review>
|
36
|
+
REVIEW
|
37
|
+
unless ins = docxml.at(ns("//review-container"))
|
38
|
+
docxml.root << "<review-container></review-container>"
|
39
|
+
ins = docxml.at(ns("//review-container"))
|
40
|
+
end
|
41
|
+
ins.add_first_child ret
|
42
|
+
end
|
43
|
+
|
44
|
+
# Redo Amendment annex titles as numbered
|
45
|
+
def annex(isoxml)
|
46
|
+
amd?(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
47
|
+
super
|
48
|
+
amd?(isoxml) and @suppressheadingnumbers = true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Redo Amendment annex subclause titles as numbered
|
52
|
+
def clause(docxml)
|
53
|
+
super
|
54
|
+
docxml.xpath(ns("//annex//appendix")).each { |f| clause1(f) }
|
55
|
+
amd?(docxml) or return
|
56
|
+
@suppressheadingnumbers = @oldsuppressheadingnumbers
|
57
|
+
docxml.xpath(ns("//annex//clause | //annex//appendix")).each do |f|
|
58
|
+
f.xpath(ns("./fmt-title | ./fmt-xref-label")).each(&:remove)
|
59
|
+
clause1(f)
|
60
|
+
end
|
61
|
+
@suppressheadingnumbers = true
|
62
|
+
end
|
63
|
+
|
64
|
+
def clause1(node)
|
65
|
+
!node.at(ns("./title")) &&
|
66
|
+
!%w(sections preface bibliography).include?(node.parent.name) and
|
67
|
+
node["inline-header"] = "true"
|
68
|
+
super
|
69
|
+
clause1_section_prefix(node)
|
70
|
+
end
|
71
|
+
|
72
|
+
def clause1_section_prefix(node)
|
73
|
+
if node["type"] == "section" &&
|
74
|
+
c = node.at(ns("./fmt-title//span[@class = 'fmt-caption-delim']"))
|
75
|
+
c.add_first_child(":")
|
76
|
+
t = node.at(ns("./fmt-title"))
|
77
|
+
# French l10n needs tab to be treated as space
|
78
|
+
t.replace @i18n.l10n(to_xml(t).gsub("<tab/>", "<tab> </tab>"))
|
79
|
+
.gsub(%r{<tab>[^<]+</tab>}, "<tab/>")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def toc_title(docxml)
|
84
|
+
%w(amendment technical-corrigendum).include?(@doctype) and return
|
85
|
+
super
|
86
|
+
end
|
87
|
+
|
88
|
+
def middle_title(docxml)
|
89
|
+
@meta.get[:doctitlemain].nil? || @meta.get[:doctitlemain].empty? and
|
90
|
+
return
|
91
|
+
s = docxml.at(ns("//sections")) or return
|
92
|
+
ret = "#{middle_title_main}#{middle_title_amd}"
|
93
|
+
s.add_first_child ret
|
94
|
+
end
|
95
|
+
|
96
|
+
def middle_title_main
|
97
|
+
ret = "<span class='boldtitle'>#{@meta.get[:doctitleintro]}"
|
98
|
+
@meta.get[:doctitleintro] && @meta.get[:doctitlemain] and
|
99
|
+
ret += " — "
|
100
|
+
ret += @meta.get[:doctitlemain]
|
101
|
+
@meta.get[:doctitlemain] && @meta.get[:doctitlepart] and
|
102
|
+
ret += " — "
|
103
|
+
ret += "</span>#{middle_title_part}"
|
104
|
+
"<p class='zzSTDTitle1'>#{ret}</p>"
|
105
|
+
end
|
106
|
+
|
107
|
+
def middle_title_part
|
108
|
+
ret = ""
|
109
|
+
if a = @meta.get[:doctitlepart]
|
110
|
+
b = @meta.get[:doctitlepartlabel] and
|
111
|
+
ret += "<span class='nonboldtitle'>#{b}:</span> "
|
112
|
+
ret += "<span class='boldtitle'>#{a}</span>"
|
113
|
+
end
|
114
|
+
ret
|
115
|
+
end
|
116
|
+
|
117
|
+
def middle_title_amd
|
118
|
+
ret = ""
|
119
|
+
if a = @meta.get[:doctitleamdlabel]
|
120
|
+
ret += "<p class='zzSTDTitle2'>#{a}"
|
121
|
+
a = @meta.get[:doctitleamd] and ret += ": #{a}"
|
122
|
+
ret += "</p>"
|
123
|
+
end
|
124
|
+
a = @meta.get[:doctitlecorrlabel] and
|
125
|
+
ret += "<p class='zzSTDTitle2'>#{a}</p>"
|
126
|
+
ret
|
127
|
+
end
|
128
|
+
|
129
|
+
def move_norm_ref_to_sections(docxml)
|
130
|
+
amd?(docxml) or super
|
131
|
+
end
|
132
|
+
|
133
|
+
def enable_indexsect
|
134
|
+
true
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -2,6 +2,7 @@ require_relative "init"
|
|
2
2
|
require "isodoc"
|
3
3
|
require_relative "presentation_xref"
|
4
4
|
require_relative "presentation_bibdata"
|
5
|
+
require_relative "presentation_section"
|
5
6
|
require_relative "presentation_terms"
|
6
7
|
require_relative "../../relaton/render/general"
|
7
8
|
|
@@ -22,39 +23,6 @@ module IsoDoc
|
|
22
23
|
super
|
23
24
|
end
|
24
25
|
|
25
|
-
def section(docxml)
|
26
|
-
super
|
27
|
-
warning_for_missing_metadata(docxml)
|
28
|
-
end
|
29
|
-
|
30
|
-
def warning_for_missing_metadata(docxml)
|
31
|
-
@meta.get[:unpublished] or return
|
32
|
-
ret = warning_for_missing_metadata_create(docxml)
|
33
|
-
ret.empty? and return
|
34
|
-
warning_for_missing_metadata_post(docxml, ret)
|
35
|
-
end
|
36
|
-
|
37
|
-
def warning_for_missing_metadata_create(docxml)
|
38
|
-
ret = ""
|
39
|
-
docxml.at(ns("//bibdata/ext//secretariat")) or
|
40
|
-
ret += "<p>Secretariat is missing.</p>"
|
41
|
-
docxml.at(ns("//bibdata/ext//editorialgroup")) or
|
42
|
-
ret += "<p>Editorial groups are missing.</p>"
|
43
|
-
docxml.at(ns("//bibdata/date[@type = 'published' or @type = 'issued' " \
|
44
|
-
"or @type = 'created']")) ||
|
45
|
-
docxml.at(ns("//bibdata/version/revision-date")) or
|
46
|
-
ret += "<p>Document date is missing.</p>"
|
47
|
-
ret
|
48
|
-
end
|
49
|
-
|
50
|
-
def warning_for_missing_metadata_post(docxml, ret)
|
51
|
-
id = UUIDTools::UUID.random_create
|
52
|
-
ret = "<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}'>" \
|
53
|
-
"<p><strong>Metadata warnings:<strong></p> #{ret}</review>"
|
54
|
-
ins = docxml.at(ns("//sections//fmt-title")) or return
|
55
|
-
ins.add_first_child ret
|
56
|
-
end
|
57
|
-
|
58
26
|
def block(docxml)
|
59
27
|
amend docxml
|
60
28
|
figure docxml
|
@@ -79,26 +47,6 @@ module IsoDoc
|
|
79
47
|
note docxml
|
80
48
|
end
|
81
49
|
|
82
|
-
# Redo Amendment annex titles as numbered
|
83
|
-
def annex(isoxml)
|
84
|
-
amd?(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
85
|
-
super
|
86
|
-
amd?(isoxml) and @suppressheadingnumbers = true
|
87
|
-
end
|
88
|
-
|
89
|
-
# Redo Amendment annex subclause titles as numbered
|
90
|
-
def clause(docxml)
|
91
|
-
super
|
92
|
-
docxml.xpath(ns("//annex//appendix")).each { |f| clause1(f) }
|
93
|
-
amd?(docxml) or return
|
94
|
-
@suppressheadingnumbers = @oldsuppressheadingnumbers
|
95
|
-
docxml.xpath(ns("//annex//clause | //annex//appendix")).each do |f|
|
96
|
-
f.xpath(ns("./fmt-title | ./fmt-xref-label")).each(&:remove)
|
97
|
-
clause1(f)
|
98
|
-
end
|
99
|
-
@suppressheadingnumbers = true
|
100
|
-
end
|
101
|
-
|
102
50
|
def subfigure_delim
|
103
51
|
"<span class='fmt-label-delim'>)</span>"
|
104
52
|
end
|
@@ -123,25 +71,6 @@ module IsoDoc
|
|
123
71
|
end
|
124
72
|
end
|
125
73
|
|
126
|
-
def clause1(node)
|
127
|
-
!node.at(ns("./title")) &&
|
128
|
-
!%w(sections preface bibliography).include?(node.parent.name) and
|
129
|
-
node["inline-header"] = "true"
|
130
|
-
super
|
131
|
-
clause1_section_prefix(node)
|
132
|
-
end
|
133
|
-
|
134
|
-
def clause1_section_prefix(node)
|
135
|
-
if node["type"] == "section" &&
|
136
|
-
c = node.at(ns("./fmt-title//span[@class = 'fmt-caption-delim']"))
|
137
|
-
c.add_first_child(":")
|
138
|
-
t = node.at(ns("./fmt-title"))
|
139
|
-
# French l10n needs tab to be treated as space
|
140
|
-
t.replace @i18n.l10n(to_xml(t).gsub("<tab/>", "<tab> </tab>"))
|
141
|
-
.gsub(%r{<tab>[^<]+</tab>}, "<tab/>")
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
74
|
def admonition1(elem)
|
146
75
|
super
|
147
76
|
admonition_outside_clauses(elem)
|
@@ -166,12 +95,7 @@ module IsoDoc
|
|
166
95
|
|
167
96
|
def ol_depth(node)
|
168
97
|
depth = node.ancestors(@iso_class ? "ol" : "ul, ol").size + 1
|
169
|
-
|
170
|
-
type = :arabic if [2, 7].include? depth
|
171
|
-
type = :roman if [3, 8].include? depth
|
172
|
-
type = :alphabet_upper if [4, 9].include? depth
|
173
|
-
type = :roman_upper if [5, 10].include? depth
|
174
|
-
type
|
98
|
+
@counter.ol_type(node, depth)
|
175
99
|
end
|
176
100
|
|
177
101
|
def note1(elem)
|
@@ -231,56 +155,6 @@ module IsoDoc
|
|
231
155
|
super
|
232
156
|
end
|
233
157
|
|
234
|
-
def toc_title(docxml)
|
235
|
-
%w(amendment technical-corrigendum).include?(@doctype) and return
|
236
|
-
super
|
237
|
-
end
|
238
|
-
|
239
|
-
def middle_title(docxml)
|
240
|
-
@meta.get[:doctitlemain].nil? || @meta.get[:doctitlemain].empty? and
|
241
|
-
return
|
242
|
-
s = docxml.at(ns("//sections")) or return
|
243
|
-
ret = "#{middle_title_main}#{middle_title_amd}"
|
244
|
-
s.add_first_child ret
|
245
|
-
end
|
246
|
-
|
247
|
-
def middle_title_main
|
248
|
-
ret = "<span class='boldtitle'>#{@meta.get[:doctitleintro]}"
|
249
|
-
@meta.get[:doctitleintro] && @meta.get[:doctitlemain] and
|
250
|
-
ret += " — "
|
251
|
-
ret += @meta.get[:doctitlemain]
|
252
|
-
@meta.get[:doctitlemain] && @meta.get[:doctitlepart] and
|
253
|
-
ret += " — "
|
254
|
-
ret += "</span>#{middle_title_part}"
|
255
|
-
"<p class='zzSTDTitle1'>#{ret}</p>"
|
256
|
-
end
|
257
|
-
|
258
|
-
def middle_title_part
|
259
|
-
ret = ""
|
260
|
-
if a = @meta.get[:doctitlepart]
|
261
|
-
b = @meta.get[:doctitlepartlabel] and
|
262
|
-
ret += "<span class='nonboldtitle'>#{b}:</span> "
|
263
|
-
ret += "<span class='boldtitle'>#{a}</span>"
|
264
|
-
end
|
265
|
-
ret
|
266
|
-
end
|
267
|
-
|
268
|
-
def middle_title_amd
|
269
|
-
ret = ""
|
270
|
-
if a = @meta.get[:doctitleamdlabel]
|
271
|
-
ret += "<p class='zzSTDTitle2'>#{a}"
|
272
|
-
a = @meta.get[:doctitleamd] and ret += ": #{a}"
|
273
|
-
ret += "</p>"
|
274
|
-
end
|
275
|
-
a = @meta.get[:doctitlecorrlabel] and
|
276
|
-
ret += "<p class='zzSTDTitle2'>#{a}</p>"
|
277
|
-
ret
|
278
|
-
end
|
279
|
-
|
280
|
-
def move_norm_ref_to_sections(docxml)
|
281
|
-
amd?(docxml) or super
|
282
|
-
end
|
283
|
-
|
284
158
|
def twitter_cldr_localiser_symbols
|
285
159
|
{ group: " ", fraction_group: " ",
|
286
160
|
fraction_group_digits: 3 }
|
@@ -305,8 +179,21 @@ module IsoDoc
|
|
305
179
|
end
|
306
180
|
end
|
307
181
|
|
308
|
-
def
|
309
|
-
|
182
|
+
def ul_label_list(_elem)
|
183
|
+
if @docscheme == "1951"
|
184
|
+
%w(–)
|
185
|
+
else
|
186
|
+
%w(—)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def ol_label_template(_elem)
|
191
|
+
ret = super
|
192
|
+
@docscheme == "1951" and
|
193
|
+
ret[:alphabet] = <<~SPAN.strip
|
194
|
+
<span class="fmt-label-delim">(</span>%<span class="fmt-label-delim">)</span>
|
195
|
+
SPAN
|
196
|
+
ret
|
310
197
|
end
|
311
198
|
|
312
199
|
def fn_ref_label(fnote)
|
@@ -21,9 +21,8 @@ module IsoDoc
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def font_choice(options)
|
24
|
-
|
25
|
-
|
26
|
-
end
|
24
|
+
options[:script] == "Hans" and return '"Source Han Sans",serif'
|
25
|
+
'"Cambria",serif'
|
27
26
|
end
|
28
27
|
|
29
28
|
def default_fonts(options)
|
@@ -55,8 +54,7 @@ module IsoDoc
|
|
55
54
|
if @dis && use_dis?(input_filename, file)
|
56
55
|
swap_renderer(self, @dis, file, input_filename, debug)
|
57
56
|
@dis.convert(input_filename, file, debug, output_filename)
|
58
|
-
else
|
59
|
-
super
|
57
|
+
else super
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
@@ -90,17 +88,14 @@ module IsoDoc
|
|
90
88
|
|
91
89
|
def colophon_section(_isoxml, out)
|
92
90
|
stage = @meta.get[:stage_int]
|
93
|
-
|
94
|
-
|
91
|
+
!stage.nil? && stage < 60 and return
|
95
92
|
br(out, "left")
|
96
93
|
out.div class: "colophon" do |div|
|
97
94
|
end
|
98
95
|
end
|
99
96
|
|
100
97
|
def indexsect_section(isoxml, out)
|
101
|
-
isoxml.xpath(ns("//indexsect")).each
|
102
|
-
indexsect(i, out)
|
103
|
-
end
|
98
|
+
isoxml.xpath(ns("//indexsect")).each { |i| indexsect(i, out) }
|
104
99
|
end
|
105
100
|
|
106
101
|
def indexsect(elem, out)
|
@@ -131,12 +126,6 @@ module IsoDoc
|
|
131
126
|
TOC
|
132
127
|
end
|
133
128
|
|
134
|
-
# KILL
|
135
|
-
def footnote_reference_format(link)
|
136
|
-
link.children =
|
137
|
-
"<span class='MsoFootnoteReference'>#{to_xml(link.children)}</span>)"
|
138
|
-
end
|
139
|
-
|
140
129
|
def bibliography_attrs
|
141
130
|
{ class: "BiblioTitle" }
|
142
131
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -382,33 +382,7 @@ in a document (e.g. sourcecode annotations)</a:documentation>
|
|
382
382
|
<a:documentation>Block intended to capture reviewer comments about some text in the document</a:documentation>
|
383
383
|
<element name="review">
|
384
384
|
<ref name="RequiredId"/>
|
385
|
-
<
|
386
|
-
<a:documentation>The party who has offered the comment</a:documentation>
|
387
|
-
</attribute>
|
388
|
-
<optional>
|
389
|
-
<attribute name="type">
|
390
|
-
<a:documentation>The type of reviewer comment</a:documentation>
|
391
|
-
</attribute>
|
392
|
-
</optional>
|
393
|
-
<optional>
|
394
|
-
<attribute name="date">
|
395
|
-
<a:documentation>The date when the comment was made</a:documentation>
|
396
|
-
<data type="dateTime"/>
|
397
|
-
</attribute>
|
398
|
-
</optional>
|
399
|
-
<optional>
|
400
|
-
<attribute name="from">
|
401
|
-
<a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
|
402
|
-
If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
|
403
|
-
<data type="IDREF"/>
|
404
|
-
</attribute>
|
405
|
-
</optional>
|
406
|
-
<optional>
|
407
|
-
<attribute name="to">
|
408
|
-
<a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
|
409
|
-
<data type="IDREF"/>
|
410
|
-
</attribute>
|
411
|
-
</optional>
|
385
|
+
<ref name="ReviewAttributes"/>
|
412
386
|
<oneOrMore>
|
413
387
|
<ref name="paragraph">
|
414
388
|
<a:documentation>Reviewer comments content</a:documentation>
|
@@ -416,6 +390,35 @@ If not provided, the comment applies in the vicinity of the place it has been in
|
|
416
390
|
</oneOrMore>
|
417
391
|
</element>
|
418
392
|
</define>
|
393
|
+
<define name="ReviewAttributes">
|
394
|
+
<attribute name="reviewer">
|
395
|
+
<a:documentation>The party who has offered the comment</a:documentation>
|
396
|
+
</attribute>
|
397
|
+
<optional>
|
398
|
+
<attribute name="type">
|
399
|
+
<a:documentation>The type of reviewer comment</a:documentation>
|
400
|
+
</attribute>
|
401
|
+
</optional>
|
402
|
+
<optional>
|
403
|
+
<attribute name="date">
|
404
|
+
<a:documentation>The date when the comment was made</a:documentation>
|
405
|
+
<data type="dateTime"/>
|
406
|
+
</attribute>
|
407
|
+
</optional>
|
408
|
+
<optional>
|
409
|
+
<attribute name="from">
|
410
|
+
<a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
|
411
|
+
If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
|
412
|
+
<data type="IDREF"/>
|
413
|
+
</attribute>
|
414
|
+
</optional>
|
415
|
+
<optional>
|
416
|
+
<attribute name="to">
|
417
|
+
<a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
|
418
|
+
<data type="IDREF"/>
|
419
|
+
</attribute>
|
420
|
+
</optional>
|
421
|
+
</define>
|
419
422
|
<define name="NumberingAttributes">
|
420
423
|
<optional>
|
421
424
|
<attribute name="unnumbered">
|
@@ -857,6 +860,7 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
|
|
857
860
|
<define name="tr">
|
858
861
|
<a:documentation>Sequence of cells to be displayed as a row in a table</a:documentation>
|
859
862
|
<element name="tr">
|
863
|
+
<ref name="TrAttributes"/>
|
860
864
|
<oneOrMore>
|
861
865
|
<choice>
|
862
866
|
<ref name="td">
|
@@ -869,6 +873,9 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
|
|
869
873
|
</oneOrMore>
|
870
874
|
</element>
|
871
875
|
</define>
|
876
|
+
<define name="TrAttributes">
|
877
|
+
<empty/>
|
878
|
+
</define>
|
872
879
|
<define name="tr-no-id">
|
873
880
|
<a:documentation>Sequence of cells to be displayed as a row in a table: optional ID attributes recursively (for use in Relaton, metadata)</a:documentation>
|
874
881
|
<element name="tr">
|
@@ -1694,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
|
|
1694
1701
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
|
1695
1702
|
The target of a footnote is the location it is embedded in within the text</a:documentation>
|
1696
1703
|
<element name="fn">
|
1697
|
-
<
|
1698
|
-
|
1699
|
-
</attribute>
|
1700
|
-
<oneOrMore>
|
1701
|
-
<ref name="paragraph">
|
1702
|
-
<a:documentation>The content of the footnote</a:documentation>
|
1703
|
-
</ref>
|
1704
|
-
</oneOrMore>
|
1704
|
+
<ref name="FnAttributes"/>
|
1705
|
+
<ref name="FnBody"/>
|
1705
1706
|
</element>
|
1706
1707
|
</define>
|
1708
|
+
<define name="FnBody">
|
1709
|
+
<oneOrMore>
|
1710
|
+
<ref name="paragraph">
|
1711
|
+
<a:documentation>The content of the footnote</a:documentation>
|
1712
|
+
</ref>
|
1713
|
+
</oneOrMore>
|
1714
|
+
</define>
|
1715
|
+
<define name="FnAttributes">
|
1716
|
+
<attribute name="reference">
|
1717
|
+
<a:documentation>The number of the footnote, used to identify it visually</a:documentation>
|
1718
|
+
</attribute>
|
1719
|
+
</define>
|
1707
1720
|
<define name="callout">
|
1708
1721
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
|
1709
1722
|
<element name="callout">
|
@@ -1,13 +1,14 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
|
3
|
-
<!--
|
4
|
-
Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
|
5
|
-
of relaton
|
6
|
-
|
7
|
-
Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
|
8
|
-
(SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
|
9
|
-
-->
|
10
3
|
<include href="biblio.rng">
|
4
|
+
<!-- ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix -->
|
5
|
+
<!--
|
6
|
+
Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
|
7
|
+
of relaton
|
8
|
+
|
9
|
+
Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
|
10
|
+
(SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
|
11
|
+
-->
|
11
12
|
<define name="BibData">
|
12
13
|
<a:documentation>The bibliographic description of a standardisation document</a:documentation>
|
13
14
|
<ref name="StandardBibliographicItem"/>
|
@@ -91,6 +92,9 @@ a standards definition organization</a:documentation>
|
|
91
92
|
<a:documentation>Representation of the identifier for the standardisation document, giving its individual semantic components</a:documentation>
|
92
93
|
</ref>
|
93
94
|
</zeroOrMore>
|
95
|
+
<ref name="DocumentImages">
|
96
|
+
<a:documentation>Coverpage and other images to be rendered with document</a:documentation>
|
97
|
+
</ref>
|
94
98
|
</define>
|
95
99
|
<define name="doctype">
|
96
100
|
<a:documentation>Classification of the standardisation document</a:documentation>
|
@@ -268,6 +272,32 @@ and not those document components</a:documentation>
|
|
268
272
|
</optional>
|
269
273
|
</element>
|
270
274
|
</define>
|
275
|
+
<define name="DocumentImages">
|
276
|
+
<zeroOrMore>
|
277
|
+
<element name="coverpage-image">
|
278
|
+
<a:documentation>Images to be displayed on the coverpage of the document</a:documentation>
|
279
|
+
<ref name="image-no-id"/>
|
280
|
+
</element>
|
281
|
+
</zeroOrMore>
|
282
|
+
<zeroOrMore>
|
283
|
+
<element name="innercoverpage-image">
|
284
|
+
<a:documentation>Images to be displayed on the inner coverpage of the document</a:documentation>
|
285
|
+
<ref name="image-no-id"/>
|
286
|
+
</element>
|
287
|
+
</zeroOrMore>
|
288
|
+
<zeroOrMore>
|
289
|
+
<element name="tocside-image">
|
290
|
+
<a:documentation>Images to be displayed on the Table of Contents page of the document</a:documentation>
|
291
|
+
<ref name="image-no-id"/>
|
292
|
+
</element>
|
293
|
+
</zeroOrMore>
|
294
|
+
<zeroOrMore>
|
295
|
+
<element name="backpage-image">
|
296
|
+
<a:documentation>Images to be displayed on the backpage of the document</a:documentation>
|
297
|
+
<ref name="image-no-id"/>
|
298
|
+
</element>
|
299
|
+
</zeroOrMore>
|
300
|
+
</define>
|
271
301
|
<define name="StandardBibliographicItem">
|
272
302
|
<ref name="BibliographicItem"/>
|
273
303
|
<zeroOrMore>
|
@@ -1,23 +1,25 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!--
|
3
|
-
instantiations of this grammar may replace leaf strings
|
4
|
-
with more elaborated types; e.g. title (text) replaced with
|
5
|
-
title-main, title-intro, title-part; type replaced with
|
6
|
-
enum.
|
7
|
-
|
8
|
-
some renaming at leaf nodes is permissible
|
9
|
-
|
10
|
-
obligations can change both from optional to mandatory,
|
11
|
-
and from mandatory to optional; optional elements may
|
12
|
-
be omitted; freely positioned alternatives may be replaced
|
13
|
-
with strict ordering
|
14
|
-
|
15
|
-
DO NOT introduce a namespace here. We do not want a distinct namespace
|
16
|
-
for these elements, and a distinct namespace for any grammar inheriting
|
17
|
-
these elements; we just want one namespace for any child grammars
|
18
|
-
of this.
|
19
|
-
-->
|
20
2
|
<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">
|
3
|
+
<!--
|
4
|
+
ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
|
5
|
+
|
6
|
+
Instantiations of this grammar may replace leaf strings
|
7
|
+
with more elaborated types; e.g. title (text) replaced with
|
8
|
+
title-main, title-intro, title-part; type replaced with
|
9
|
+
enum.
|
10
|
+
|
11
|
+
Some renaming at leaf nodes is permissible
|
12
|
+
|
13
|
+
Obligations can change both from optional to mandatory,
|
14
|
+
and from mandatory to optional; optional elements may
|
15
|
+
be omitted; freely positioned alternatives may be replaced
|
16
|
+
with strict ordering
|
17
|
+
|
18
|
+
DO NOT introduce a namespace here. We do not want a distinct namespace
|
19
|
+
for these elements, and a distinct namespace for any grammar inheriting
|
20
|
+
these elements; we just want one namespace for any child grammars
|
21
|
+
of this.
|
22
|
+
-->
|
21
23
|
<!--
|
22
24
|
https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
|
23
25
|
iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
|
@@ -1241,6 +1243,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
|
|
1241
1243
|
</define>
|
1242
1244
|
<define name="formattedref">
|
1243
1245
|
<element name="formattedref">
|
1246
|
+
<optional>
|
1247
|
+
<attribute name="format">
|
1248
|
+
<a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
|
1249
|
+
</attribute>
|
1250
|
+
</optional>
|
1244
1251
|
<oneOrMore>
|
1245
1252
|
<ref name="TextElement"/>
|
1246
1253
|
</oneOrMore>
|
@@ -1812,6 +1819,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
|
|
1812
1819
|
<a:documentation>Abstract of bibliographic item</a:documentation>
|
1813
1820
|
<element name="abstract">
|
1814
1821
|
<ref name="LocalizedStringAttributes"/>
|
1822
|
+
<optional>
|
1823
|
+
<attribute name="format">
|
1824
|
+
<a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
|
1825
|
+
</attribute>
|
1826
|
+
</optional>
|
1815
1827
|
<choice>
|
1816
1828
|
<oneOrMore>
|
1817
1829
|
<ref name="BasicBlockNoId">
|
@@ -43,8 +43,8 @@ module Metanorma
|
|
43
43
|
|
44
44
|
TERM_CLAUSE =
|
45
45
|
"//sections/terms | " \
|
46
|
-
"//sections
|
47
|
-
"//sections//clause[
|
46
|
+
"//sections//terms[not(preceding-sibling::clause)] | " \
|
47
|
+
"//sections//clause[@type = 'terms'][not(descendant::definitions)] | " \
|
48
48
|
"//sections/clause[not(@type = 'terms')][not(descendant::definitions)]//terms".freeze
|
49
49
|
|
50
50
|
def sections_cleanup(xml)
|