metanorma-iec 2.3.8 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iec/iec.international-standard.xsl +63 -12
- data/lib/metanorma/iec/basicdoc.rng +94 -8
- data/lib/metanorma/iec/biblio-standoc.rng +44 -1
- data/lib/metanorma/iec/biblio.rng +11 -0
- data/lib/metanorma/iec/converter.rb +8 -0
- data/lib/metanorma/iec/front.rb +123 -169
- data/lib/metanorma/iec/isodoc.rng +13 -64
- data/lib/metanorma/iec/reqt.rng +0 -16
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b329047e60d24ccacf88f54b8b6cfa17d7eed313b4badcf010edd7c68428d513
|
4
|
+
data.tar.gz: bfb37bf61f2b60538271615b357f765254dfe11d37c8521d311957c3d04418b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516a7f7d89fb06ec86ad7d70e376c708fb623535a97e9f9441abde946b0889d98728f5e99df2fcb8951b4eaf273c47d1ebbd3a6dd34980536293aaa1e1dce29b
|
7
|
+
data.tar.gz: 316c640b39a4a56827d3e836e0d3ddbb752d4f7138b38d8730f62d515529c9d954921684ba9942b6012412f84d06f505d74c51509936d07d2761d63f1dca9e0b
|
@@ -3930,7 +3930,9 @@
|
|
3930
3930
|
</xsl:template> <!-- license-statement/p -->
|
3931
3931
|
|
3932
3932
|
<xsl:template match="*[local-name()='legal-statement']">
|
3933
|
+
<xsl:param name="isLegacy">false</xsl:param>
|
3933
3934
|
<fo:block xsl:use-attribute-sets="legal-statement-style">
|
3935
|
+
|
3934
3936
|
<xsl:apply-templates/>
|
3935
3937
|
</fo:block>
|
3936
3938
|
</xsl:template> <!-- legal-statement -->
|
@@ -6282,13 +6284,14 @@
|
|
6282
6284
|
<!-- ================= -->
|
6283
6285
|
<!-- Added,deleted text -->
|
6284
6286
|
<!-- ================= -->
|
6285
|
-
<xsl:template match="*[local-name()='add']" name="tag_add">
|
6287
|
+
<xsl:template match="*[local-name()='add'] | *[local-name() = 'change-open-tag'] | *[local-name() = 'change-close-tag']" name="tag_add">
|
6286
6288
|
<xsl:param name="skip">true</xsl:param>
|
6287
6289
|
<xsl:param name="block">false</xsl:param>
|
6288
6290
|
<xsl:param name="type"/>
|
6289
6291
|
<xsl:param name="text-align"/>
|
6290
6292
|
<xsl:choose>
|
6291
|
-
<xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start
|
6293
|
+
<xsl:when test="starts-with(., $ace_tag) or local-name() = 'change-open-tag' or local-name() = 'change-close-tag'"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start, or
|
6294
|
+
<change-open-tag>A<sub>1</sub></change-open-tag>, <change-close-tag>A<sub>1</sub></change-close-tag> -->
|
6292
6295
|
<xsl:choose>
|
6293
6296
|
<xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
|
6294
6297
|
<xsl:otherwise>
|
@@ -6296,12 +6299,32 @@
|
|
6296
6299
|
<xsl:call-template name="insertTag">
|
6297
6300
|
<xsl:with-param name="type">
|
6298
6301
|
<xsl:choose>
|
6302
|
+
<xsl:when test="local-name() = 'change-open-tag'">start</xsl:when>
|
6303
|
+
<xsl:when test="local-name() = 'change-close-tag'">end</xsl:when>
|
6299
6304
|
<xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
|
6300
6305
|
<xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
|
6301
6306
|
</xsl:choose>
|
6302
6307
|
</xsl:with-param>
|
6303
|
-
<xsl:with-param name="kind"
|
6304
|
-
|
6308
|
+
<xsl:with-param name="kind">
|
6309
|
+
<xsl:choose>
|
6310
|
+
<xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
|
6311
|
+
<xsl:value-of select="text()"/>
|
6312
|
+
</xsl:when>
|
6313
|
+
<xsl:otherwise>
|
6314
|
+
<xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
|
6315
|
+
</xsl:otherwise>
|
6316
|
+
</xsl:choose>
|
6317
|
+
</xsl:with-param>
|
6318
|
+
<xsl:with-param name="value">
|
6319
|
+
<xsl:choose>
|
6320
|
+
<xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
|
6321
|
+
<xsl:value-of select="*[local-name() = 'sub']"/>
|
6322
|
+
</xsl:when>
|
6323
|
+
<xsl:otherwise>
|
6324
|
+
<xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
|
6325
|
+
</xsl:otherwise>
|
6326
|
+
</xsl:choose>
|
6327
|
+
</xsl:with-param>
|
6305
6328
|
</xsl:call-template>
|
6306
6329
|
</xsl:variable>
|
6307
6330
|
<xsl:choose>
|
@@ -8580,11 +8603,17 @@
|
|
8580
8603
|
</xsl:when>
|
8581
8604
|
<xsl:otherwise>
|
8582
8605
|
|
8606
|
+
<xsl:variable name="image_class" select="ancestor::*[local-name() = 'image']/@class"/>
|
8607
|
+
<xsl:variable name="ancestor_table_cell" select="normalize-space(ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"/>
|
8608
|
+
|
8583
8609
|
<xsl:variable name="element">
|
8584
8610
|
<xsl:choose>
|
8585
8611
|
<xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
|
8586
8612
|
<fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
|
8587
8613
|
</xsl:when>
|
8614
|
+
<xsl:when test="not(ancestor::*[local-name() = 'figure'])">
|
8615
|
+
<fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
|
8616
|
+
</xsl:when>
|
8588
8617
|
<xsl:otherwise>
|
8589
8618
|
<fo:block xsl:use-attribute-sets="image-style">
|
8590
8619
|
<xsl:if test="ancestor::*[local-name() = 'dt']">
|
@@ -8600,10 +8629,24 @@
|
|
8600
8629
|
<xsl:copy-of select="@*"/>
|
8601
8630
|
<!-- <fo:block xsl:use-attribute-sets="image-style"> -->
|
8602
8631
|
<fo:instream-foreign-object fox:alt-text="{$alt-text}">
|
8603
|
-
|
8604
|
-
|
8605
|
-
|
8606
|
-
|
8632
|
+
|
8633
|
+
<xsl:choose>
|
8634
|
+
<xsl:when test="$image_class = 'corrigenda-tag'">
|
8635
|
+
<xsl:attribute name="fox:alt-text">CorrigendaTag</xsl:attribute>
|
8636
|
+
<xsl:attribute name="baseline-shift">-10%</xsl:attribute>
|
8637
|
+
<xsl:if test="$ancestor_table_cell = 'true'">
|
8638
|
+
<xsl:attribute name="baseline-shift">-25%</xsl:attribute>
|
8639
|
+
</xsl:if>
|
8640
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8641
|
+
</xsl:when>
|
8642
|
+
<xsl:otherwise>
|
8643
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
8644
|
+
<xsl:attribute name="width">100%</xsl:attribute>
|
8645
|
+
</xsl:if>
|
8646
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
8647
|
+
</xsl:otherwise>
|
8648
|
+
</xsl:choose>
|
8649
|
+
|
8607
8650
|
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8608
8651
|
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
|
8609
8652
|
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
|
@@ -10794,14 +10837,16 @@
|
|
10794
10837
|
|
10795
10838
|
<xsl:template match="*[local-name() = 'annex']">
|
10796
10839
|
<fo:block break-after="page"/>
|
10797
|
-
<fo:block
|
10840
|
+
<fo:block>
|
10798
10841
|
|
10799
10842
|
<xsl:call-template name="setBlockSpanAll"/>
|
10800
10843
|
|
10801
10844
|
<xsl:call-template name="refine_annex_style"/>
|
10802
10845
|
|
10803
10846
|
</fo:block>
|
10804
|
-
<
|
10847
|
+
<fo:block id="{@id}">
|
10848
|
+
<xsl:apply-templates/>
|
10849
|
+
</fo:block>
|
10805
10850
|
</xsl:template>
|
10806
10851
|
|
10807
10852
|
<xsl:template name="refine_annex_style">
|
@@ -10821,13 +10866,19 @@
|
|
10821
10866
|
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10822
10867
|
</xsl:when>
|
10823
10868
|
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
10824
|
-
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
10869
|
+
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
10870
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10871
|
+
</xsl:when>
|
10872
|
+
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
|
10825
10873
|
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10826
10874
|
</xsl:when>
|
10827
10875
|
</xsl:choose>
|
10828
10876
|
|
10829
10877
|
</xsl:template>
|
10830
10878
|
|
10879
|
+
<!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
|
10880
|
+
<xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
|
10881
|
+
|
10831
10882
|
<xsl:template match="*[local-name() = 'name']/text()">
|
10832
10883
|
<!-- 0xA0 to space replacement -->
|
10833
10884
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -12440,7 +12491,7 @@
|
|
12440
12491
|
|
12441
12492
|
<xsl:template name="printEdition">
|
12442
12493
|
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
12443
|
-
|
12494
|
+
|
12444
12495
|
<xsl:choose>
|
12445
12496
|
<xsl:when test="$edition_i18n != ''">
|
12446
12497
|
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
@@ -95,8 +95,89 @@
|
|
95
95
|
<ref name="pagebreak"/>
|
96
96
|
<ref name="hr"/>
|
97
97
|
<ref name="bookmark"/>
|
98
|
+
<ref name="amend"/>
|
98
99
|
</choice>
|
99
100
|
</define>
|
101
|
+
<define name="amend">
|
102
|
+
<element name="amend">
|
103
|
+
<ref name="AmendType"/>
|
104
|
+
</element>
|
105
|
+
</define>
|
106
|
+
<define name="AmendType">
|
107
|
+
<optional>
|
108
|
+
<attribute name="id">
|
109
|
+
<data type="ID"/>
|
110
|
+
</attribute>
|
111
|
+
</optional>
|
112
|
+
<attribute name="change">
|
113
|
+
<choice>
|
114
|
+
<value>add</value>
|
115
|
+
<value>modify</value>
|
116
|
+
<value>delete</value>
|
117
|
+
<value>replace</value>
|
118
|
+
</choice>
|
119
|
+
</attribute>
|
120
|
+
<optional>
|
121
|
+
<attribute name="path"/>
|
122
|
+
</optional>
|
123
|
+
<optional>
|
124
|
+
<attribute name="path_end"/>
|
125
|
+
</optional>
|
126
|
+
<optional>
|
127
|
+
<attribute name="title"/>
|
128
|
+
</optional>
|
129
|
+
<optional>
|
130
|
+
<element name="location">
|
131
|
+
<zeroOrMore>
|
132
|
+
<choice>
|
133
|
+
<ref name="locality"/>
|
134
|
+
<ref name="localityStack"/>
|
135
|
+
</choice>
|
136
|
+
</zeroOrMore>
|
137
|
+
</element>
|
138
|
+
</optional>
|
139
|
+
<optional>
|
140
|
+
<element name="description">
|
141
|
+
<zeroOrMore>
|
142
|
+
<ref name="BasicBlock"/>
|
143
|
+
</zeroOrMore>
|
144
|
+
</element>
|
145
|
+
</optional>
|
146
|
+
<optional>
|
147
|
+
<element name="newcontent">
|
148
|
+
<optional>
|
149
|
+
<attribute name="id">
|
150
|
+
<data type="ID"/>
|
151
|
+
</attribute>
|
152
|
+
</optional>
|
153
|
+
<zeroOrMore>
|
154
|
+
<ref name="BasicBlock"/>
|
155
|
+
</zeroOrMore>
|
156
|
+
</element>
|
157
|
+
</optional>
|
158
|
+
<zeroOrMore>
|
159
|
+
<ref name="classification"/>
|
160
|
+
</zeroOrMore>
|
161
|
+
<zeroOrMore>
|
162
|
+
<ref name="contributor"/>
|
163
|
+
</zeroOrMore>
|
164
|
+
</define>
|
165
|
+
<define name="classification">
|
166
|
+
<element name="classification">
|
167
|
+
<ref name="classification_tag"/>
|
168
|
+
<ref name="classification_value"/>
|
169
|
+
</element>
|
170
|
+
</define>
|
171
|
+
<define name="classification_tag">
|
172
|
+
<element name="tag">
|
173
|
+
<text/>
|
174
|
+
</element>
|
175
|
+
</define>
|
176
|
+
<define name="classification_value">
|
177
|
+
<element name="value">
|
178
|
+
<text/>
|
179
|
+
</element>
|
180
|
+
</define>
|
100
181
|
<define name="paragraph">
|
101
182
|
<element name="p">
|
102
183
|
<ref name="ParagraphType"/>
|
@@ -163,6 +244,9 @@
|
|
163
244
|
<data type="ID"/>
|
164
245
|
</attribute>
|
165
246
|
<attribute name="reviewer"/>
|
247
|
+
<optional>
|
248
|
+
<attribute name="type"/>
|
249
|
+
</optional>
|
166
250
|
<optional>
|
167
251
|
<attribute name="date">
|
168
252
|
<data type="dateTime"/>
|
@@ -939,18 +1023,12 @@
|
|
939
1023
|
</optional>
|
940
1024
|
<optional>
|
941
1025
|
<attribute name="width">
|
942
|
-
<
|
943
|
-
<data type="int"/>
|
944
|
-
<value>auto</value>
|
945
|
-
</choice>
|
1026
|
+
<ref name="ImageSize"/>
|
946
1027
|
</attribute>
|
947
1028
|
</optional>
|
948
1029
|
<optional>
|
949
1030
|
<attribute name="height">
|
950
|
-
<
|
951
|
-
<data type="int"/>
|
952
|
-
<value>auto</value>
|
953
|
-
</choice>
|
1031
|
+
<ref name="ImageSize"/>
|
954
1032
|
</attribute>
|
955
1033
|
</optional>
|
956
1034
|
<optional>
|
@@ -965,6 +1043,14 @@
|
|
965
1043
|
</attribute>
|
966
1044
|
</optional>
|
967
1045
|
</define>
|
1046
|
+
<define name="ImageSize">
|
1047
|
+
<choice>
|
1048
|
+
<data type="string">
|
1049
|
+
<param name="pattern">\d+([.]\d+)?(%?)</param>
|
1050
|
+
</data>
|
1051
|
+
<value>auto</value>
|
1052
|
+
</choice>
|
1053
|
+
</define>
|
968
1054
|
<define name="video">
|
969
1055
|
<element name="video">
|
970
1056
|
<attribute name="id">
|
@@ -9,11 +9,42 @@
|
|
9
9
|
-->
|
10
10
|
<include href="biblio.rng">
|
11
11
|
<define name="BibData">
|
12
|
-
<ref name="
|
12
|
+
<ref name="StandardBibliographicItem"/>
|
13
13
|
<optional>
|
14
14
|
<ref name="ext"/>
|
15
15
|
</optional>
|
16
16
|
</define>
|
17
|
+
<define name="docrelation">
|
18
|
+
<element name="relation">
|
19
|
+
<attribute name="type">
|
20
|
+
<ref name="DocRelationType"/>
|
21
|
+
</attribute>
|
22
|
+
<optional>
|
23
|
+
<element name="description">
|
24
|
+
<ref name="FormattedString"/>
|
25
|
+
</element>
|
26
|
+
</optional>
|
27
|
+
<element name="bibitem">
|
28
|
+
<ref name="StandardReducedBibliographicItem"/>
|
29
|
+
</element>
|
30
|
+
<choice>
|
31
|
+
<zeroOrMore>
|
32
|
+
<ref name="locality"/>
|
33
|
+
</zeroOrMore>
|
34
|
+
<zeroOrMore>
|
35
|
+
<ref name="localityStack"/>
|
36
|
+
</zeroOrMore>
|
37
|
+
</choice>
|
38
|
+
<choice>
|
39
|
+
<zeroOrMore>
|
40
|
+
<ref name="sourceLocality"/>
|
41
|
+
</zeroOrMore>
|
42
|
+
<zeroOrMore>
|
43
|
+
<ref name="sourceLocalityStack"/>
|
44
|
+
</zeroOrMore>
|
45
|
+
</choice>
|
46
|
+
</element>
|
47
|
+
</define>
|
17
48
|
</include>
|
18
49
|
<define name="ext">
|
19
50
|
<element name="ext">
|
@@ -161,4 +192,16 @@
|
|
161
192
|
</optional>
|
162
193
|
</element>
|
163
194
|
</define>
|
195
|
+
<define name="StandardBibliographicItem">
|
196
|
+
<ref name="BibliographicItem"/>
|
197
|
+
<zeroOrMore>
|
198
|
+
<ref name="amend"/>
|
199
|
+
</zeroOrMore>
|
200
|
+
</define>
|
201
|
+
<define name="StandardReducedBibliographicItem">
|
202
|
+
<ref name="ReducedBibliographicItem"/>
|
203
|
+
<zeroOrMore>
|
204
|
+
<ref name="amend"/>
|
205
|
+
</zeroOrMore>
|
206
|
+
</define>
|
164
207
|
</grammar>
|
@@ -241,6 +241,9 @@
|
|
241
241
|
</element>
|
242
242
|
</define>
|
243
243
|
<define name="FullNameType">
|
244
|
+
<optional>
|
245
|
+
<ref name="name_abbreviation"/>
|
246
|
+
</optional>
|
244
247
|
<choice>
|
245
248
|
<group>
|
246
249
|
<zeroOrMore>
|
@@ -266,6 +269,11 @@
|
|
266
269
|
<ref name="variantname"/>
|
267
270
|
</zeroOrMore>
|
268
271
|
</define>
|
272
|
+
<define name="name_abbreviation">
|
273
|
+
<element name="abbreviation">
|
274
|
+
<ref name="LocalizedString"/>
|
275
|
+
</element>
|
276
|
+
</define>
|
269
277
|
<define name="prefix">
|
270
278
|
<element name="prefix">
|
271
279
|
<ref name="LocalizedString"/>
|
@@ -870,6 +878,9 @@
|
|
870
878
|
<optional>
|
871
879
|
<ref name="validity"/>
|
872
880
|
</optional>
|
881
|
+
<optional>
|
882
|
+
<ref name="depiction"/>
|
883
|
+
</optional>
|
873
884
|
</define>
|
874
885
|
<define name="btitle">
|
875
886
|
<element name="title">
|
@@ -28,6 +28,10 @@ module Metanorma
|
|
28
28
|
File.join(@libdir, "iec_intro_#{lang}.xml")
|
29
29
|
end
|
30
30
|
|
31
|
+
def id_prefix(_prefix, id)
|
32
|
+
id.text
|
33
|
+
end
|
34
|
+
|
31
35
|
def doctype_validate(xmldoc)
|
32
36
|
%w(international-standard technical-specification technical-report
|
33
37
|
publicly-available-specification international-workshop-agreement
|
@@ -150,6 +154,10 @@ module Metanorma
|
|
150
154
|
end
|
151
155
|
end
|
152
156
|
|
157
|
+
def document_scheme(node)
|
158
|
+
node.attr("document-scheme")
|
159
|
+
end
|
160
|
+
|
153
161
|
def docidentifier_cleanup(xmldoc)
|
154
162
|
prefix = get_id_prefix(xmldoc)
|
155
163
|
id = xmldoc.at("//bibdata/docidentifier[@type = 'ISO']") or return
|
data/lib/metanorma/iec/front.rb
CHANGED
@@ -7,200 +7,154 @@ module Metanorma
|
|
7
7
|
"IEC"
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
def metadata_stagename(id)
|
11
|
+
if @amd
|
12
|
+
id.amendments&.first&.stage&.name ||
|
13
|
+
id.corrigendums&.first&.stage&.name
|
14
|
+
else
|
15
|
+
begin
|
16
|
+
id.typed_stage_name
|
17
|
+
rescue StandardError
|
18
|
+
id.stage&.name
|
19
|
+
end
|
17
20
|
end
|
18
|
-
xml.docidentifier dn, **attr_code(type: "ISO")
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def metadata_status(node, xml)
|
24
|
+
x = iso_id_default(iso_id_params(node)).stage
|
25
|
+
xml.status do |s|
|
26
|
+
s.stage x.harmonized_code.stage, **attr_code(abbreviation: x.abbr)
|
27
|
+
s.substage x.harmonized_code.substage
|
28
|
+
end
|
29
|
+
rescue *STAGE_ERROR
|
30
|
+
report_illegal_stage(get_stage(node), get_substage(node))
|
25
31
|
end
|
26
32
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
def get_typeabbr(node, amd: false)
|
34
|
+
node.attr("amendment-number") and return :amd
|
35
|
+
node.attr("corrigendum-number") and return :cor
|
36
|
+
case doctype(node)
|
37
|
+
when "directive" then :dir
|
38
|
+
when "white-paper" then :wp
|
39
|
+
when "technology-report" then :tec
|
40
|
+
when "social-technology-trend-report" then :sttr
|
41
|
+
when "component-specification" then :cs
|
42
|
+
when "systems-reference-document" then :srd
|
43
|
+
when "operational-document" then :od
|
44
|
+
when "conformity-assessment" then :ca
|
45
|
+
when "test-report-form" then :trf
|
46
|
+
when "technical-report" then :tr
|
47
|
+
when "technical-specification" then :ts
|
48
|
+
when "publicly-available-specification" then :pas
|
49
|
+
when "guide" then :guide
|
50
|
+
else :is
|
34
51
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
STAGE_CODES = {
|
59
|
-
"PNW" => "1000", "ANW" => "2000", "CAN" => "2098", "ACD" => "2099",
|
60
|
-
"CD" => "3020", "BWG" => "3092", "A2CD" => "3099", "2CD" => "3520",
|
61
|
-
"3CD" => "3520", "4CD" => "3520", "5CD" => "3520", "6CD" => "3520",
|
62
|
-
"7CD" => "3520", "8CD" => "3520", "9CD" => "3520", "CDM" => "3591",
|
63
|
-
"A3CD" => "3592", "A4CD" => "3592", "A5CD" => "3592", "A6CD" => "3592",
|
64
|
-
"A7CD" => "3592", "A8CD" => "3592", "A9CD" => "3592", "ACDV" => "3599",
|
65
|
-
"CCDV" => "4020", "CDVM" => "4091", "NCDV" => "4092",
|
66
|
-
"NADIS" => "4093", "ADIS" => "4099", "ADTR" => "4099",
|
67
|
-
"ADTS" => "4099", "RDISH" => "5000", "RFDIS" => "5000",
|
68
|
-
"CDISH" => "5020", "CDPAS" => "5020", "CDTR" => "5020",
|
69
|
-
"CDTS" => "5020", "CFDIS" => "5020", "DTRM" => "5092",
|
70
|
-
"DTSM" => "5092", "NDTR" => "5092", "NDTS" => "5092",
|
71
|
-
"NFDIS" => "5092", "APUB" => "5099", "BPUB" => "6000",
|
72
|
-
"PPUB" => "6060", "RR" => "9092", "AMW" => "9220", "WPUB" => "9599",
|
73
|
-
"DELPUB" => "9960", "PWI" => "0000", "NWIP" => "1000", "WD" => "2000",
|
74
|
-
"CDV" => "4000", "FDIS" => "5000"
|
75
|
-
}.freeze
|
76
|
-
|
77
|
-
DOC_STAGE = {
|
78
|
-
"00": "PWI",
|
79
|
-
"10": "NWIP",
|
80
|
-
"20": "WD",
|
81
|
-
"30": "CD",
|
82
|
-
"40": "CDV",
|
83
|
-
"50": "FDIS",
|
84
|
-
"60": "PPUB",
|
85
|
-
"90": "RR",
|
86
|
-
"92": "AMW",
|
87
|
-
"95": "WPUB",
|
88
|
-
"99": "DELPUB",
|
89
|
-
}.freeze
|
90
|
-
|
91
|
-
STAGE_ABBRS = {
|
92
|
-
"00" => { "00" => "PWI" },
|
93
|
-
"10" => { "00" => "PNW" },
|
94
|
-
"20" => { "00" => "ANW", "98" => "CAN", "99" => "ACD" },
|
95
|
-
"30" => { "00" => "CD", "20" => "CD", "92" => "BWG", "97" => "MERGED",
|
96
|
-
"98" => "DREJ", "99" => "A2CD" },
|
97
|
-
"35" => { "00" => "CD", "20" => "CD", "91" => "CDM", "92" => "ACD",
|
98
|
-
"99" => "ACDV" },
|
99
|
-
"40" => { "00" => "CCDV", "20" => "CCDV", "91" => "CDVM",
|
100
|
-
"92" => "NCDV", "93" => "NADIS",
|
101
|
-
"95" => "ADISSB", "99" => "ADIS" },
|
102
|
-
"50" => { "00" => "RFDIS", "20" => "CFDIS", "92" => "NFDIS",
|
103
|
-
"95" => "APUBSB", "99" => "APUB" },
|
104
|
-
"60" => { "00" => "BPUB", "60" => "PPUB" },
|
105
|
-
"90" => { "00" => "RR", "92" => "RR" },
|
106
|
-
"92" => { "00" => "AMW", "20" => "AMW" },
|
107
|
-
"95" => { "00" => "WPUB", "99" => "WPUB" },
|
108
|
-
"99" => { "00" => "DELPUB", "60" => "DELPUB" },
|
109
|
-
}.freeze
|
110
|
-
|
111
|
-
STAGE_NAMES = {
|
112
|
-
"00": "Preliminary work item",
|
113
|
-
"10": "New work item proposal",
|
114
|
-
"20": "Working draft",
|
115
|
-
"30": "Committee draft",
|
116
|
-
"35": "Committee draft",
|
117
|
-
"40": "Committed draft for vote",
|
118
|
-
"50": "Final draft international standard",
|
119
|
-
"60": "International standard",
|
120
|
-
"90": "Review",
|
121
|
-
"92": "Review",
|
122
|
-
"95": "Withdrawal",
|
123
|
-
"99": "Deleted",
|
124
|
-
}.freeze
|
125
|
-
|
126
|
-
def status_abbrev1(stage, substage, iter, doctype, _draft)
|
127
|
-
return "" unless stage
|
128
|
-
|
129
|
-
abbr = STAGE_ABBRS.dig(stage, substage) || "??"
|
130
|
-
if stage == "35" && substage == "92"
|
131
|
-
iter = (iter.to_i + 1) % "02"
|
132
|
-
end
|
133
|
-
case doctype
|
134
|
-
when "technical-report"
|
135
|
-
abbr = "ADTR" if stage == "40" && substage == "99"
|
136
|
-
abbr = "CDTR" if stage == "50" && substage == "20"
|
137
|
-
abbr = "DTRM" if stage == "50" && substage == "92"
|
138
|
-
when "technical-specification"
|
139
|
-
abbr = "ADTS" if stage == "40" && substage == "99"
|
140
|
-
abbr = "CDTS" if stage == "50" && substage == "20"
|
141
|
-
abbr = "DTSM" if stage == "50" && substage == "92"
|
142
|
-
when "interpretation-sheet"
|
143
|
-
abbr = "RDISH" if stage == "50" && substage == "00"
|
144
|
-
abbr = "CDISH" if stage == "50" && substage == "20"
|
145
|
-
when "publicly-available-specification"
|
146
|
-
abbr = "CDPAS" if stage == "50" && substage == "20"
|
52
|
+
end
|
53
|
+
|
54
|
+
def base_pubid
|
55
|
+
Pubid::Iec::Identifier
|
56
|
+
end
|
57
|
+
|
58
|
+
def iso_id_params_core(node)
|
59
|
+
pub = iso_id_pub(node)
|
60
|
+
ret = { number: node.attr("docnumber"),
|
61
|
+
part: node.attr("partnumber"),
|
62
|
+
language: node.attr("language")&.split(/,\s*/) || "en",
|
63
|
+
type: get_typeabbr(node),
|
64
|
+
edition: node.attr("edition"), publisher: pub[0],
|
65
|
+
unpublished: /^[0-5]/.match?(get_stage(node)),
|
66
|
+
copublisher: pub[1..-1] }.compact
|
67
|
+
ret[:copublisher].empty? and ret.delete(:copublisher)
|
68
|
+
ret
|
69
|
+
end
|
70
|
+
|
71
|
+
def iso_id_stage(node)
|
72
|
+
ret = "#{get_stage(node)}.#{get_substage(node)}"
|
73
|
+
if /[A-Z]/.match?(ret) # abbreviation
|
74
|
+
ret = get_stage(node)
|
147
75
|
end
|
148
|
-
|
149
|
-
|
76
|
+
ret
|
77
|
+
end
|
78
|
+
|
79
|
+
def iso_id_params_resolve(params, params2, node, orig_id)
|
80
|
+
ret = super
|
81
|
+
params[:number].nil? && !@amd and ret[:number] = "0"
|
82
|
+
ret
|
150
83
|
end
|
151
84
|
|
152
|
-
def
|
153
|
-
|
85
|
+
def iso_id_out(xml, params, _with_prf)
|
86
|
+
params[:stage] == "60.60" and params.delete(:stage)
|
87
|
+
super
|
88
|
+
end
|
89
|
+
|
90
|
+
def iso_id_out_common(xml, params, _with_prf)
|
91
|
+
xml.docidentifier iso_id_default(params).to_s,
|
92
|
+
**attr_code(type: "ISO")
|
93
|
+
xml.docidentifier iso_id_reference(params).to_s,
|
94
|
+
**attr_code(type: "iso-reference")
|
95
|
+
@id_revdate and
|
96
|
+
xml.docidentifier iso_id_revdate(params.merge(year: @id_revdate))
|
97
|
+
.to_s(with_edition_month_date: true),
|
98
|
+
**attr_code(type: "iso-revdate")
|
99
|
+
xml.docidentifier iso_id_reference(params).urn,
|
100
|
+
**attr_code(type: "URN")
|
101
|
+
end
|
102
|
+
|
103
|
+
def iso_id_out_non_amd(xml, params, _with_prf)
|
104
|
+
xml.docidentifier iso_id_undated(params).to_s,
|
105
|
+
**attr_code(type: "iso-undated")
|
106
|
+
xml.docidentifier iso_id_with_lang(params).to_s,
|
107
|
+
**attr_code(type: "iso-with-lang")
|
108
|
+
end
|
154
109
|
|
155
|
-
|
110
|
+
def iso_id_revdate(params)
|
111
|
+
params1 = params.dup.tap { |hs| hs.delete(:unpublished) }
|
112
|
+
m = params1[:year].match(/^(\d{4})(-\d{2})?(-\d{2})?/)
|
113
|
+
params1[:year] = m[1]
|
114
|
+
params1[:month] = m[2].sub(/^-/, "")
|
115
|
+
# skipping day for now
|
116
|
+
pubid_select(params1).create(**params1)
|
156
117
|
end
|
157
118
|
|
158
|
-
def
|
159
|
-
|
119
|
+
def status_abbrev1(node)
|
120
|
+
id = iso_id_default({ stage: "60.60" }.merge(iso_id_params(node)))
|
121
|
+
id.stage or return ""
|
122
|
+
id.stage.abbr
|
160
123
|
end
|
161
124
|
|
162
125
|
def get_stage(node)
|
163
126
|
stage = node.attr("status") || node.attr("docstage") || "60"
|
164
127
|
m = /([0-9])CD$/.match(stage) and node.set_attr("iteration", m[1])
|
165
|
-
STAGE_CODES[stage] and stage = STAGE_CODES[stage][0..1]
|
166
128
|
stage
|
167
129
|
end
|
168
130
|
|
169
131
|
def get_substage(node)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
end)
|
132
|
+
ret = node.attr("docsubstage") and return ret
|
133
|
+
st = get_stage(node)
|
134
|
+
case st
|
135
|
+
when "60" then "60"
|
136
|
+
when "30", "40", "50" then "20"
|
137
|
+
else "00"
|
138
|
+
end
|
178
139
|
end
|
179
140
|
|
180
|
-
def
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
141
|
+
def iso_id_params_add(node)
|
142
|
+
stage = iso_id_stage(node)
|
143
|
+
@id_revdate = node.attr("revdate")
|
144
|
+
ret = { number: node.attr("amendment-number") ||
|
145
|
+
node.attr("corrigendum-number"),
|
146
|
+
year: iso_id_year(node) }.compact
|
147
|
+
if stage && !cen?(node.attr("publisher"))
|
148
|
+
ret[:stage] = stage
|
149
|
+
end
|
150
|
+
ret
|
186
151
|
end
|
187
152
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
s.stage stage,
|
194
|
-
**attr_code(abbreviation: stage_abbr(stage, substage, nil))
|
195
|
-
subst = status_abbrev1(stage, substage, node.attr("iteration"),
|
196
|
-
doctype(node), node.attr("draft"))
|
197
|
-
s.substage substage, **attr_code(abbreviation: subst)
|
198
|
-
node.attr("iteration") && (s.iteration node.attr("iteration"))
|
199
|
-
end
|
200
|
-
iso_id_default(iso_id_params(node))
|
201
|
-
rescue Pubid::Core::Errors::HarmonizedStageCodeInvalidError,
|
202
|
-
Pubid::Core::Errors::TypeStageParseError
|
203
|
-
report_illegal_stage(stage, substage)
|
153
|
+
def report_illegal_stage(stage, substage)
|
154
|
+
out = stage || ""
|
155
|
+
/[A-Z]/.match?(out) or out += ".#{substage}"
|
156
|
+
err = "Illegal document stage: #{out}"
|
157
|
+
@log.add("Document Attributes", nil, err)
|
204
158
|
end
|
205
159
|
|
206
160
|
def metadata_subdoctype(node, xml)
|
@@ -17,10 +17,19 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.
|
20
|
+
<!-- VERSION v1.3.0 -->
|
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">
|
24
|
+
<define name="amend">
|
25
|
+
<element name="amend">
|
26
|
+
<ref name="BlockAttributes"/>
|
27
|
+
<ref name="AmendType"/>
|
28
|
+
<zeroOrMore>
|
29
|
+
<ref name="autonumber"/>
|
30
|
+
</zeroOrMore>
|
31
|
+
</element>
|
32
|
+
</define>
|
24
33
|
<define name="admonition">
|
25
34
|
<element name="admonition">
|
26
35
|
<attribute name="type">
|
@@ -137,6 +146,9 @@
|
|
137
146
|
<data type="boolean"/>
|
138
147
|
</attribute>
|
139
148
|
</optional>
|
149
|
+
<optional>
|
150
|
+
<attribute name="style"/>
|
151
|
+
</optional>
|
140
152
|
<oneOrMore>
|
141
153
|
<ref name="PureTextElement"/>
|
142
154
|
</oneOrMore>
|
@@ -2319,69 +2331,6 @@
|
|
2319
2331
|
<ref name="CitationType"/>
|
2320
2332
|
</element>
|
2321
2333
|
</define>
|
2322
|
-
<define name="amend">
|
2323
|
-
<element name="amend">
|
2324
|
-
<optional>
|
2325
|
-
<attribute name="id">
|
2326
|
-
<data type="ID"/>
|
2327
|
-
</attribute>
|
2328
|
-
</optional>
|
2329
|
-
<attribute name="change">
|
2330
|
-
<choice>
|
2331
|
-
<value>add</value>
|
2332
|
-
<value>modify</value>
|
2333
|
-
<value>delete</value>
|
2334
|
-
<value>replace</value>
|
2335
|
-
</choice>
|
2336
|
-
</attribute>
|
2337
|
-
<optional>
|
2338
|
-
<attribute name="path"/>
|
2339
|
-
</optional>
|
2340
|
-
<optional>
|
2341
|
-
<attribute name="path_end"/>
|
2342
|
-
</optional>
|
2343
|
-
<optional>
|
2344
|
-
<attribute name="title"/>
|
2345
|
-
</optional>
|
2346
|
-
<ref name="BlockAttributes"/>
|
2347
|
-
<optional>
|
2348
|
-
<element name="location">
|
2349
|
-
<zeroOrMore>
|
2350
|
-
<ref name="locality"/>
|
2351
|
-
</zeroOrMore>
|
2352
|
-
</element>
|
2353
|
-
</optional>
|
2354
|
-
<zeroOrMore>
|
2355
|
-
<ref name="autonumber"/>
|
2356
|
-
</zeroOrMore>
|
2357
|
-
<optional>
|
2358
|
-
<element name="description">
|
2359
|
-
<zeroOrMore>
|
2360
|
-
<ref name="BasicBlock"/>
|
2361
|
-
</zeroOrMore>
|
2362
|
-
</element>
|
2363
|
-
</optional>
|
2364
|
-
<optional>
|
2365
|
-
<element name="newcontent">
|
2366
|
-
<optional>
|
2367
|
-
<attribute name="id">
|
2368
|
-
<data type="ID"/>
|
2369
|
-
</attribute>
|
2370
|
-
</optional>
|
2371
|
-
<zeroOrMore>
|
2372
|
-
<ref name="BasicBlock"/>
|
2373
|
-
</zeroOrMore>
|
2374
|
-
</element>
|
2375
|
-
</optional>
|
2376
|
-
<optional>
|
2377
|
-
<element name="description">
|
2378
|
-
<zeroOrMore>
|
2379
|
-
<ref name="BasicBlock"/>
|
2380
|
-
</zeroOrMore>
|
2381
|
-
</element>
|
2382
|
-
</optional>
|
2383
|
-
</element>
|
2384
|
-
</define>
|
2385
2334
|
<define name="autonumber">
|
2386
2335
|
<element name="autonumber">
|
2387
2336
|
<attribute name="type">
|
data/lib/metanorma/iec/reqt.rng
CHANGED
@@ -207,20 +207,4 @@
|
|
207
207
|
<value>permission</value>
|
208
208
|
</choice>
|
209
209
|
</define>
|
210
|
-
<define name="classification">
|
211
|
-
<element name="classification">
|
212
|
-
<ref name="classification_tag"/>
|
213
|
-
<ref name="classification_value"/>
|
214
|
-
</element>
|
215
|
-
</define>
|
216
|
-
<define name="classification_tag">
|
217
|
-
<element name="tag">
|
218
|
-
<text/>
|
219
|
-
</element>
|
220
|
-
</define>
|
221
|
-
<define name="classification_value">
|
222
|
-
<element name="value">
|
223
|
-
<text/>
|
224
|
-
</element>
|
225
|
-
</define>
|
226
210
|
</grammar>
|
data/metanorma-iec.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
31
31
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
32
32
|
|
33
|
-
spec.add_dependency "metanorma-iso", "~> 2.
|
33
|
+
spec.add_dependency "metanorma-iso", "~> 2.7.0"
|
34
34
|
spec.add_dependency "pubid-iec"
|
35
35
|
spec.add_dependency "ruby-jing"
|
36
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pubid-iec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|