metanorma-iec 2.6.2 → 2.6.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/iec/html/htmlstyle.css +7 -0
- data/lib/isodoc/iec/iec.international-standard.xsl +313 -78
- data/lib/isodoc/iec/presentation_terms.rb +20 -75
- data/lib/isodoc/iec/presentation_xml_convert.rb +5 -1
- data/lib/isodoc/iec/word_convert.rb +2 -3
- data/lib/metanorma/iec/basicdoc.rng +48 -35
- data/lib/metanorma/iec/biblio-standoc.rng +37 -7
- data/lib/metanorma/iec/biblio.rng +30 -18
- data/lib/metanorma/iec/converter.rb +2 -5
- data/lib/metanorma/iec/front.rb +1 -5
- data/lib/metanorma/iec/iec.rng +2 -47
- data/lib/metanorma/iec/isodoc.rng +126 -80
- data/lib/metanorma/iec/isostandard.rng +6 -149
- data/lib/metanorma/iec/relaton-iec.rng +62 -46
- data/lib/metanorma/iec/reqt.rng +7 -6
- data/lib/metanorma/iec/version.rb +1 -1
- metadata +2 -2
@@ -4,11 +4,11 @@ module IsoDoc
|
|
4
4
|
def termclause1(elem)
|
5
5
|
@is_iev or return clause1(elem)
|
6
6
|
@suppressheadingnumbers || elem["unnumbered"] or
|
7
|
-
|
7
|
+
lbl = @xrefs.anchor(elem["id"], :label, true)
|
8
8
|
if lbl
|
9
|
-
|
9
|
+
prefix_name(elem, { caption: " " }, "#{lbl}#{clausedelim}", "title")
|
10
10
|
else
|
11
|
-
|
11
|
+
prefix_name(elem, {}, nil, "title")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -46,8 +46,8 @@ module IsoDoc
|
|
46
46
|
|
47
47
|
def termdomain(elem, fmt_defn)
|
48
48
|
if @is_iev
|
49
|
-
#d = elem.at(ns("./domain")) or return
|
50
|
-
#d["hidden"] = true
|
49
|
+
# d = elem.at(ns("./domain")) or return
|
50
|
+
# d["hidden"] = true
|
51
51
|
else super
|
52
52
|
end
|
53
53
|
end
|
@@ -60,19 +60,21 @@ module IsoDoc
|
|
60
60
|
end
|
61
61
|
# renumber
|
62
62
|
@xrefs.parse_inclusions(clauses: true).parse docxml
|
63
|
-
docxml.xpath(ns("//term/fmt-name | //term/fmt-xref-label"))
|
63
|
+
docxml.xpath(ns("//term/fmt-name | //term/fmt-xref-label"))
|
64
|
+
.each(&:remove)
|
64
65
|
term(docxml)
|
65
66
|
end
|
66
67
|
|
67
68
|
def merge_fr_into_en_term1(en_term, fr_term)
|
68
69
|
dl = en_term&.at(ns("./dl[@type = 'other-lang']"))&.remove
|
69
|
-
#en_term << fr_term.remove.children
|
70
|
+
# en_term << fr_term.remove.children
|
70
71
|
dup = semx_fmt_dup(fr_term)
|
71
72
|
dup.xpath(ns("./fmt-name | ./fmt-xref-label")).each(&:remove)
|
72
73
|
en_term << dup
|
73
74
|
fr_term.xpath(ns(".//fmt-name | .//fmt-xref-label | " \
|
74
75
|
".//fmt-preferred | .//fmt-admitted | .//fmt-deprecates | " \
|
75
|
-
".//fmt-definition | .//fmt-related | .//fmt-termsource"))
|
76
|
+
".//fmt-definition | .//fmt-related | .//fmt-termsource"))
|
77
|
+
.each(&:remove)
|
76
78
|
fr_term["unnumbered"] = "true"
|
77
79
|
en_term << dl if dl
|
78
80
|
en_term["language"] = "en,fr"
|
@@ -89,28 +91,15 @@ module IsoDoc
|
|
89
91
|
def remove_otherlang_designations(docxml)
|
90
92
|
@is_iev or return
|
91
93
|
docxml.xpath(ns("//term")).each do |t|
|
92
|
-
remove_otherlang_designations1(t,
|
94
|
+
remove_otherlang_designations1(t,
|
95
|
+
t["language"]&.split(",") || %w(en fr))
|
93
96
|
end
|
94
97
|
end
|
95
98
|
|
96
|
-
# KILL
|
97
99
|
def extract_otherlang_designations(term, lgs)
|
98
100
|
term.xpath(ns(".//preferred/expression[@language]"))
|
99
101
|
.each_with_object([]) do |d, m|
|
100
102
|
lg = d["language"]
|
101
|
-
d.delete("language")
|
102
|
-
lgs.include?(lg) and next
|
103
|
-
p = d.parent
|
104
|
-
designation_annotate(p, p.at(ns("./name")))
|
105
|
-
m << { lang: lg, script: Metanorma::Utils.default_script(lg),
|
106
|
-
designation: to_xml(l10n_recursive(p.remove, lg)).strip }
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def extract_otherlang_designations(term, lgs)
|
111
|
-
term.xpath(ns(".//preferred/expression[@language]"))
|
112
|
-
.each_with_object([]) do |d, m|
|
113
|
-
lg = d["language"]
|
114
103
|
lgs.include?(lg) and next
|
115
104
|
p = semx_fmt_dup(d.parent)
|
116
105
|
e = p.at(ns("./expression"))
|
@@ -156,52 +145,32 @@ module IsoDoc
|
|
156
145
|
end
|
157
146
|
|
158
147
|
def remove_otherlang_designations1(term, lgs)
|
159
|
-
term.xpath(ns(".//fmt-preferred/p/semx[@element = 'preferred']"))
|
148
|
+
term.xpath(ns(".//fmt-preferred/p/semx[@element = 'preferred']"))
|
149
|
+
.each do |s|
|
160
150
|
p = semx_orig(s, term)
|
161
151
|
lg = p.at(ns("./expression/@language"))&.text or next
|
162
152
|
lgs.include?(lg) and next
|
163
153
|
s.parent.remove
|
164
|
-
|
154
|
+
end
|
165
155
|
end
|
166
156
|
|
167
157
|
def related(docxml)
|
168
|
-
#docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
|
169
158
|
super
|
170
159
|
docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
|
171
160
|
end
|
172
161
|
|
173
|
-
# KILL
|
174
|
-
def move_related(term)
|
175
|
-
defn = term.at(ns("./definition")) or return
|
176
|
-
term.xpath(ns("./related")).reverse_each do |r|
|
177
|
-
defn.next = r.remove
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
162
|
def move_related(term)
|
182
163
|
defn = term.at(ns("./fmt-definition")) or return
|
183
164
|
rel = term.at(ns("./fmt-related")) or return
|
184
165
|
defn << rel.children
|
185
166
|
end
|
186
167
|
|
187
|
-
# KILL
|
188
168
|
def related1(node)
|
189
169
|
lg = node.at("./ancestor::xmlns:term/@language")&.text
|
190
170
|
@i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
|
191
|
-
p = node.at(ns("./preferred"))
|
192
|
-
ref = node.at(ns("./xref | ./eref | ./termref"))
|
193
|
-
label = @i18n.relatedterms[node["type"]].upcase
|
194
|
-
node.replace(l10n("<p>#{label}: " \
|
195
|
-
"#{to_xml(p.children)} (#{to_xml(ref)})</p>"))
|
196
|
-
@i18n = @i18n_lg["default"]
|
197
|
-
end
|
198
|
-
|
199
|
-
def related1(node)
|
200
|
-
lg = node.at("./ancestor::xmlns:term/@language")&.text
|
201
|
-
@i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
|
202
171
|
p, ref, orig = related1_prep(node)
|
203
|
-
|
204
|
-
node.children =(l10n("<p>#{label}: " \
|
172
|
+
label = @i18n.relatedterms[orig["type"]].upcase
|
173
|
+
node.children = (l10n("<p>#{label}: " \
|
205
174
|
"#{to_xml(p)} (#{Common::to_xml(ref)})</p>"))
|
206
175
|
@i18n = @i18n_lg["default"]
|
207
176
|
end
|
@@ -213,31 +182,13 @@ module IsoDoc
|
|
213
182
|
@i18n = @i18n_lg["default"]
|
214
183
|
end
|
215
184
|
|
216
|
-
# KILL
|
217
|
-
def termsource1xx(node)
|
218
|
-
lg = node&.at("./ancestor::xmlns:term/@language")&.text
|
219
|
-
@i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
|
220
|
-
if @is_iev then termsource1_iev(node)
|
221
|
-
else super
|
222
|
-
end
|
223
|
-
@i18n = @i18n_lg["default"]
|
224
|
-
end
|
225
|
-
|
226
|
-
# KILL
|
227
|
-
def termsource1_iev(elem)
|
228
|
-
while elem&.next_element&.name == "termsource"
|
229
|
-
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
230
|
-
end
|
231
|
-
elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
|
232
|
-
end
|
233
|
-
|
234
185
|
def termsource_label(elem, sources)
|
235
186
|
@is_iev or return super
|
236
187
|
lg = elem&.at("./ancestor::xmlns:term/@language")&.text
|
237
188
|
@i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
|
238
|
-
|
239
|
-
|
240
|
-
|
189
|
+
elem.replace(l10n("#{@i18n.source}: #{sources}"))
|
190
|
+
@i18n = @i18n_lg["default"]
|
191
|
+
end
|
241
192
|
|
242
193
|
def termexample(docxml)
|
243
194
|
docxml.xpath(ns("//termexample")).each do |f|
|
@@ -247,7 +198,6 @@ module IsoDoc
|
|
247
198
|
|
248
199
|
def termexample1(elem)
|
249
200
|
lg = elem&.at("./ancestor::xmlns:term/@language")&.text
|
250
|
-
#require "debug"; binding.b
|
251
201
|
@i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
|
252
202
|
example1(elem)
|
253
203
|
@i18n = @i18n_lg["default"]
|
@@ -263,11 +213,6 @@ module IsoDoc
|
|
263
213
|
@i18n = @i18n_lg["default"]
|
264
214
|
ret
|
265
215
|
end
|
266
|
-
|
267
|
-
def term1(elem)
|
268
|
-
#require 'debug'; binding.b
|
269
|
-
super
|
270
|
-
end
|
271
216
|
end
|
272
217
|
end
|
273
218
|
end
|
@@ -71,7 +71,7 @@ module IsoDoc
|
|
71
71
|
ins = elem.at(ns("./title")) || elem.children.first.before(" ").previous
|
72
72
|
ins.next = <<~CLAUSE
|
73
73
|
<clause type='boilerplate_legal'>#{to_xml(boilerplate.children)}</clause>
|
74
|
-
|
74
|
+
CLAUSE
|
75
75
|
end
|
76
76
|
|
77
77
|
def insert_middle_title(docxml)
|
@@ -124,6 +124,10 @@ module IsoDoc
|
|
124
124
|
s.add_first_child ret
|
125
125
|
end
|
126
126
|
|
127
|
+
def ul_label_list(_elem)
|
128
|
+
%w(• — o)
|
129
|
+
end
|
130
|
+
|
127
131
|
include Init
|
128
132
|
end
|
129
133
|
end
|
@@ -104,9 +104,8 @@ module IsoDoc
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def tr_parse(node, out, ord, totalrows, header)
|
107
|
-
|
108
|
-
|
109
|
-
out.tr do |r|
|
107
|
+
bordered = table_bordered?(node)
|
108
|
+
out.tr **attr_code(style: node["style"]) do |r|
|
110
109
|
node.elements.each do |td|
|
111
110
|
attrs = make_tr_attr(td, ord, totalrows - 1, header, bordered)
|
112
111
|
attrs[:class] = "TABLE-col-heading" if header
|
@@ -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">
|
@@ -45,10 +45,8 @@ module Metanorma
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
|
50
|
-
schema_validate(formattedstr_strip(doc.dup),
|
51
|
-
File.join(File.dirname(__FILE__), "iec.rng"))
|
48
|
+
def schema_file
|
49
|
+
"iec.rng"
|
52
50
|
end
|
53
51
|
|
54
52
|
def html_converter(node)
|
@@ -157,7 +155,6 @@ module Metanorma
|
|
157
155
|
end
|
158
156
|
|
159
157
|
# TODO remove when I adopt pubid-iec
|
160
|
-
#
|
161
158
|
def get_id_prefix(xmldoc)
|
162
159
|
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
|
163
160
|
"/organization").each_with_object([]) do |x, prefix|
|
data/lib/metanorma/iec/front.rb
CHANGED
@@ -157,13 +157,9 @@ module Metanorma
|
|
157
157
|
@log.add("Document Attributes", nil, err)
|
158
158
|
end
|
159
159
|
|
160
|
-
def metadata_subdoctype(node, xml)
|
161
|
-
super
|
162
|
-
a = node.attr("function") and xml.function a
|
163
|
-
end
|
164
|
-
|
165
160
|
def metadata_ext(node, xml)
|
166
161
|
super
|
162
|
+
a = node.attr("function") and xml.function a
|
167
163
|
a = node.attr("accessibility-color-inside") and
|
168
164
|
xml.accessibility_color_inside a
|
169
165
|
a = node.attr("cen-processing") and xml.cen_processing a
|
data/lib/metanorma/iec/iec.rng
CHANGED
@@ -1,25 +1,10 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar ns='https://www.metanorma.org/ns/standoc' xmlns="http://relaxng.org/ns/structure/1.0"
|
3
|
-
<!--
|
4
|
-
VERSION v1.2.1
|
5
|
-
default namespace = "https://www.metanorma.com/ns/iec"
|
6
|
-
-->
|
2
|
+
<grammar ns='https://www.metanorma.org/ns/standoc' xmlns="http://relaxng.org/ns/structure/1.0">
|
7
3
|
<include href="relaton-iec.rng"/>
|
8
4
|
<include href="isostandard.rng">
|
9
5
|
<define name="term">
|
10
6
|
<element name="term">
|
11
|
-
<
|
12
|
-
<attribute name="id">
|
13
|
-
<data type="ID"/>
|
14
|
-
</attribute>
|
15
|
-
</optional>
|
16
|
-
<optional>
|
17
|
-
<attribute name="language"/>
|
18
|
-
</optional>
|
19
|
-
<optional>
|
20
|
-
<attribute name="script"/>
|
21
|
-
</optional>
|
22
|
-
<ref name="BlockAttributes"/>
|
7
|
+
<ref name="TermAttributes"/>
|
23
8
|
<oneOrMore>
|
24
9
|
<ref name="preferred"/>
|
25
10
|
</oneOrMore>
|
@@ -47,36 +32,6 @@
|
|
47
32
|
</zeroOrMore>
|
48
33
|
</element>
|
49
34
|
</define>
|
50
|
-
<!--
|
51
|
-
We display the Normative References between scope and terms; but to keep the
|
52
|
-
grammar simple, we keep the references together
|
53
|
-
-->
|
54
|
-
<define name="standard-document">
|
55
|
-
<element name="metanorma">
|
56
|
-
<ref name="Root-Attributes"/>
|
57
|
-
<ref name="bibdata"/>
|
58
|
-
<zeroOrMore>
|
59
|
-
<ref name="termdocsource"/>
|
60
|
-
</zeroOrMore>
|
61
|
-
<optional>
|
62
|
-
<ref name="misccontainer"/>
|
63
|
-
</optional>
|
64
|
-
<optional>
|
65
|
-
<ref name="boilerplate"/>
|
66
|
-
</optional>
|
67
|
-
<ref name="preface"/>
|
68
|
-
<oneOrMore>
|
69
|
-
<ref name="sections"/>
|
70
|
-
</oneOrMore>
|
71
|
-
<zeroOrMore>
|
72
|
-
<ref name="annex"/>
|
73
|
-
</zeroOrMore>
|
74
|
-
<ref name="bibliography"/>
|
75
|
-
<zeroOrMore>
|
76
|
-
<ref name="indexsect"/>
|
77
|
-
</zeroOrMore>
|
78
|
-
</element>
|
79
|
-
</define>
|
80
35
|
</include>
|
81
36
|
</grammar>
|
82
37
|
<!-- end overrides -->
|