metanorma-iec 2.4.0 → 2.4.2
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 +110 -17
- data/lib/isodoc/iec/presentation_xml_convert.rb +2 -1
- data/lib/metanorma/iec/basicdoc.rng +3 -0
- data/lib/metanorma/iec/converter.rb +8 -0
- data/lib/metanorma/iec/front.rb +123 -169
- data/lib/metanorma/iec/isodoc.rng +4 -1
- 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: 10177bc4adcd772657e975fa25b6291c9bc160c5305f6de3771dca5165376958
|
4
|
+
data.tar.gz: 3e8e6457114391eab0741c6835962f8971a1d7c4895538c815372e6dc38aef80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a7d53c37f35af53686200f67f136562922c1ddecd44526782e25ba244939c5860956aceda69a2c4458d80d58e5a5aeb4e6d548d4a5cb3846f18b04665a81997
|
7
|
+
data.tar.gz: e6bd168b98945bae77c74f348cacfb4ee20f81860cff0c6f8b3e4a6608a3e2372a726fc303069add01c99414da251d3ac527ee5b2ee8a7acc842c7be0073016a
|
@@ -1018,7 +1018,13 @@
|
|
1018
1018
|
</xsl:call-template>
|
1019
1019
|
<xsl:text> </xsl:text>
|
1020
1020
|
<fo:inline>
|
1021
|
-
<xsl:variable name="
|
1021
|
+
<xsl:variable name="edition_" select="normalize-space(//iec:iec-standard/iec:bibdata/iec:edition[normalize-space(@language) = ''])"/>
|
1022
|
+
<xsl:variable name="edition">
|
1023
|
+
<xsl:choose>
|
1024
|
+
<xsl:when test="$edition_ = ''">1</xsl:when>
|
1025
|
+
<xsl:otherwise><xsl:value-of select="$edition_"/></xsl:otherwise>
|
1026
|
+
</xsl:choose>
|
1027
|
+
</xsl:variable>
|
1022
1028
|
<xsl:value-of select="$edition"/>
|
1023
1029
|
<xsl:if test="not(contains($edition, '.'))">.0</xsl:if>
|
1024
1030
|
</fo:inline>
|
@@ -2630,6 +2636,10 @@
|
|
2630
2636
|
|
2631
2637
|
</xsl:attribute-set>
|
2632
2638
|
|
2639
|
+
<xsl:template name="refine_termexample-style">
|
2640
|
+
|
2641
|
+
</xsl:template>
|
2642
|
+
|
2633
2643
|
<xsl:attribute-set name="example-style">
|
2634
2644
|
|
2635
2645
|
<xsl:attribute name="space-before">8pt</xsl:attribute>
|
@@ -3804,6 +3814,36 @@
|
|
3804
3814
|
</xsl:for-each>
|
3805
3815
|
</xsl:template>
|
3806
3816
|
|
3817
|
+
<xsl:template name="processMainSectionsDefault_flatxml">
|
3818
|
+
<xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
|
3819
|
+
<xsl:sort select="@displayorder" data-type="number"/>
|
3820
|
+
<xsl:variable name="flatxml">
|
3821
|
+
<xsl:apply-templates select="." mode="flatxml"/>
|
3822
|
+
</xsl:variable>
|
3823
|
+
<!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
|
3824
|
+
<xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
|
3825
|
+
|
3826
|
+
</xsl:for-each>
|
3827
|
+
|
3828
|
+
<xsl:for-each select="/*/*[local-name()='annex']">
|
3829
|
+
<xsl:sort select="@displayorder" data-type="number"/>
|
3830
|
+
<xsl:variable name="flatxml">
|
3831
|
+
<xsl:apply-templates select="." mode="flatxml"/>
|
3832
|
+
</xsl:variable>
|
3833
|
+
<!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
|
3834
|
+
<xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
|
3835
|
+
</xsl:for-each>
|
3836
|
+
|
3837
|
+
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
3838
|
+
<xsl:sort select="@displayorder" data-type="number"/>
|
3839
|
+
<xsl:variable name="flatxml">
|
3840
|
+
<xsl:apply-templates select="." mode="flatxml"/>
|
3841
|
+
</xsl:variable>
|
3842
|
+
<!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
|
3843
|
+
<xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
|
3844
|
+
</xsl:for-each>
|
3845
|
+
</xsl:template>
|
3846
|
+
|
3807
3847
|
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3808
3848
|
<xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
|
3809
3849
|
<xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
|
@@ -3930,7 +3970,9 @@
|
|
3930
3970
|
</xsl:template> <!-- license-statement/p -->
|
3931
3971
|
|
3932
3972
|
<xsl:template match="*[local-name()='legal-statement']">
|
3973
|
+
<xsl:param name="isLegacy">false</xsl:param>
|
3933
3974
|
<fo:block xsl:use-attribute-sets="legal-statement-style">
|
3975
|
+
|
3934
3976
|
<xsl:apply-templates/>
|
3935
3977
|
</fo:block>
|
3936
3978
|
</xsl:template> <!-- legal-statement -->
|
@@ -5965,13 +6007,13 @@
|
|
5965
6007
|
<tr>
|
5966
6008
|
<td>
|
5967
6009
|
<xsl:attribute name="id">
|
5968
|
-
<xsl:value-of select="concat($id,'
|
6010
|
+
<xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
|
5969
6011
|
</xsl:attribute>
|
5970
6012
|
<xsl:apply-templates/>
|
5971
6013
|
</td>
|
5972
6014
|
<td>
|
5973
6015
|
<xsl:attribute name="id">
|
5974
|
-
<xsl:value-of select="concat($id,'
|
6016
|
+
<xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
|
5975
6017
|
</xsl:attribute>
|
5976
6018
|
|
5977
6019
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
@@ -6282,13 +6324,14 @@
|
|
6282
6324
|
<!-- ================= -->
|
6283
6325
|
<!-- Added,deleted text -->
|
6284
6326
|
<!-- ================= -->
|
6285
|
-
<xsl:template match="*[local-name()='add']" name="tag_add">
|
6327
|
+
<xsl:template match="*[local-name()='add'] | *[local-name() = 'change-open-tag'] | *[local-name() = 'change-close-tag']" name="tag_add">
|
6286
6328
|
<xsl:param name="skip">true</xsl:param>
|
6287
6329
|
<xsl:param name="block">false</xsl:param>
|
6288
6330
|
<xsl:param name="type"/>
|
6289
6331
|
<xsl:param name="text-align"/>
|
6290
6332
|
<xsl:choose>
|
6291
|
-
<xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start
|
6333
|
+
<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
|
6334
|
+
<change-open-tag>A<sub>1</sub></change-open-tag>, <change-close-tag>A<sub>1</sub></change-close-tag> -->
|
6292
6335
|
<xsl:choose>
|
6293
6336
|
<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
6337
|
<xsl:otherwise>
|
@@ -6296,12 +6339,32 @@
|
|
6296
6339
|
<xsl:call-template name="insertTag">
|
6297
6340
|
<xsl:with-param name="type">
|
6298
6341
|
<xsl:choose>
|
6342
|
+
<xsl:when test="local-name() = 'change-open-tag'">start</xsl:when>
|
6343
|
+
<xsl:when test="local-name() = 'change-close-tag'">end</xsl:when>
|
6299
6344
|
<xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
|
6300
6345
|
<xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
|
6301
6346
|
</xsl:choose>
|
6302
6347
|
</xsl:with-param>
|
6303
|
-
<xsl:with-param name="kind"
|
6304
|
-
|
6348
|
+
<xsl:with-param name="kind">
|
6349
|
+
<xsl:choose>
|
6350
|
+
<xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
|
6351
|
+
<xsl:value-of select="text()"/>
|
6352
|
+
</xsl:when>
|
6353
|
+
<xsl:otherwise>
|
6354
|
+
<xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
|
6355
|
+
</xsl:otherwise>
|
6356
|
+
</xsl:choose>
|
6357
|
+
</xsl:with-param>
|
6358
|
+
<xsl:with-param name="value">
|
6359
|
+
<xsl:choose>
|
6360
|
+
<xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
|
6361
|
+
<xsl:value-of select="*[local-name() = 'sub']"/>
|
6362
|
+
</xsl:when>
|
6363
|
+
<xsl:otherwise>
|
6364
|
+
<xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
|
6365
|
+
</xsl:otherwise>
|
6366
|
+
</xsl:choose>
|
6367
|
+
</xsl:with-param>
|
6305
6368
|
</xsl:call-template>
|
6306
6369
|
</xsl:variable>
|
6307
6370
|
<xsl:choose>
|
@@ -6632,6 +6695,10 @@
|
|
6632
6695
|
<fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
|
6633
6696
|
</xsl:template>
|
6634
6697
|
|
6698
|
+
<xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
|
6699
|
+
<xsl:value-of select="."/>
|
6700
|
+
</xsl:template>
|
6701
|
+
|
6635
6702
|
<!-- ========================= -->
|
6636
6703
|
<!-- END Rich text formatting -->
|
6637
6704
|
<!-- ========================= -->
|
@@ -7262,7 +7329,7 @@
|
|
7262
7329
|
</xsl:choose>
|
7263
7330
|
</xsl:variable>
|
7264
7331
|
<xsl:attribute name="id">
|
7265
|
-
<xsl:value-of select="concat($id,'
|
7332
|
+
<xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
|
7266
7333
|
</xsl:attribute>
|
7267
7334
|
|
7268
7335
|
<xsl:for-each select="*[local-name() = 'p']">
|
@@ -7270,7 +7337,7 @@
|
|
7270
7337
|
<xsl:copy-of select="@*"/>
|
7271
7338
|
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
7272
7339
|
<xsl:attribute name="id">
|
7273
|
-
<xsl:value-of select="concat($id,'
|
7340
|
+
<xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
|
7274
7341
|
</xsl:attribute>
|
7275
7342
|
|
7276
7343
|
<!-- <xsl:copy-of select="node()" /> -->
|
@@ -7334,7 +7401,7 @@
|
|
7334
7401
|
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
7335
7402
|
<xsl:copy>
|
7336
7403
|
<xsl:attribute name="id">
|
7337
|
-
<xsl:value-of select="concat($id,'
|
7404
|
+
<xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
|
7338
7405
|
</xsl:attribute>
|
7339
7406
|
<xsl:copy-of select="node()"/>
|
7340
7407
|
</xsl:copy>
|
@@ -8580,11 +8647,17 @@
|
|
8580
8647
|
</xsl:when>
|
8581
8648
|
<xsl:otherwise>
|
8582
8649
|
|
8650
|
+
<xsl:variable name="image_class" select="ancestor::*[local-name() = 'image']/@class"/>
|
8651
|
+
<xsl:variable name="ancestor_table_cell" select="normalize-space(ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"/>
|
8652
|
+
|
8583
8653
|
<xsl:variable name="element">
|
8584
8654
|
<xsl:choose>
|
8585
8655
|
<xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
|
8586
8656
|
<fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
|
8587
8657
|
</xsl:when>
|
8658
|
+
<xsl:when test="not(ancestor::*[local-name() = 'figure'])">
|
8659
|
+
<fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
|
8660
|
+
</xsl:when>
|
8588
8661
|
<xsl:otherwise>
|
8589
8662
|
<fo:block xsl:use-attribute-sets="image-style">
|
8590
8663
|
<xsl:if test="ancestor::*[local-name() = 'dt']">
|
@@ -8600,10 +8673,24 @@
|
|
8600
8673
|
<xsl:copy-of select="@*"/>
|
8601
8674
|
<!-- <fo:block xsl:use-attribute-sets="image-style"> -->
|
8602
8675
|
<fo:instream-foreign-object fox:alt-text="{$alt-text}">
|
8603
|
-
|
8604
|
-
|
8605
|
-
|
8606
|
-
|
8676
|
+
|
8677
|
+
<xsl:choose>
|
8678
|
+
<xsl:when test="$image_class = 'corrigenda-tag'">
|
8679
|
+
<xsl:attribute name="fox:alt-text">CorrigendaTag</xsl:attribute>
|
8680
|
+
<xsl:attribute name="baseline-shift">-10%</xsl:attribute>
|
8681
|
+
<xsl:if test="$ancestor_table_cell = 'true'">
|
8682
|
+
<xsl:attribute name="baseline-shift">-25%</xsl:attribute>
|
8683
|
+
</xsl:if>
|
8684
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8685
|
+
</xsl:when>
|
8686
|
+
<xsl:otherwise>
|
8687
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
8688
|
+
<xsl:attribute name="width">100%</xsl:attribute>
|
8689
|
+
</xsl:if>
|
8690
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
8691
|
+
</xsl:otherwise>
|
8692
|
+
</xsl:choose>
|
8693
|
+
|
8607
8694
|
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8608
8695
|
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
|
8609
8696
|
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
|
@@ -10130,7 +10217,7 @@
|
|
10130
10217
|
<!-- ====== -->
|
10131
10218
|
<xsl:template match="*[local-name() = 'termexample']">
|
10132
10219
|
<fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
|
10133
|
-
|
10220
|
+
<xsl:call-template name="refine_termexample-style"/>
|
10134
10221
|
<xsl:call-template name="setBlockSpanAll"/>
|
10135
10222
|
|
10136
10223
|
<xsl:apply-templates select="*[local-name()='name']"/>
|
@@ -10823,13 +10910,19 @@
|
|
10823
10910
|
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10824
10911
|
</xsl:when>
|
10825
10912
|
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
10826
|
-
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
10913
|
+
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
10914
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10915
|
+
</xsl:when>
|
10916
|
+
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
|
10827
10917
|
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10828
10918
|
</xsl:when>
|
10829
10919
|
</xsl:choose>
|
10830
10920
|
|
10831
10921
|
</xsl:template>
|
10832
10922
|
|
10923
|
+
<!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
|
10924
|
+
<xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
|
10925
|
+
|
10833
10926
|
<xsl:template match="*[local-name() = 'name']/text()">
|
10834
10927
|
<!-- 0xA0 to space replacement -->
|
10835
10928
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -12442,7 +12535,7 @@
|
|
12442
12535
|
|
12443
12536
|
<xsl:template name="printEdition">
|
12444
12537
|
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
12445
|
-
|
12538
|
+
|
12446
12539
|
<xsl:choose>
|
12447
12540
|
<xsl:when test="$edition_i18n != ''">
|
12448
12541
|
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
@@ -84,10 +84,11 @@ module IsoDoc
|
|
84
84
|
<p class="zzSTDTitle1"> </p>
|
85
85
|
<p class="zzSTDTitle2"><strong>#{title2}</strong></p>
|
86
86
|
OUTPUT
|
87
|
+
title1 &&= Metanorma::Utils.case_transform_xml(title1, :upcase)
|
87
88
|
ins.next = <<~OUTPUT
|
88
89
|
<pagebreak/><p class="zzSTDTitle1">#{@i18n.get['IEC']}</p>
|
89
90
|
<p class="zzSTDTitle1">____________</p><p class="zzSTDTitle1"> </p>
|
90
|
-
<p class="zzSTDTitle1"><strong>#{title1
|
91
|
+
<p class="zzSTDTitle1"><strong>#{title1}</strong></p>#{title2out}
|
91
92
|
<p class="zzSTDTitle1"> </p>
|
92
93
|
OUTPUT
|
93
94
|
end
|
@@ -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] }
|
67
|
+
ret[:copublisher].empty? and ret.delete(:copublisher)
|
68
|
+
compact_blank(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) }
|
147
|
+
if stage && !cen?(node.attr("publisher"))
|
148
|
+
ret[:stage] = stage
|
149
|
+
end
|
150
|
+
compact_blank(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,7 +17,7 @@
|
|
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">
|
@@ -146,6 +146,9 @@
|
|
146
146
|
<data type="boolean"/>
|
147
147
|
</attribute>
|
148
148
|
</optional>
|
149
|
+
<optional>
|
150
|
+
<attribute name="style"/>
|
151
|
+
</optional>
|
149
152
|
<oneOrMore>
|
150
153
|
<ref name="PureTextElement"/>
|
151
154
|
</oneOrMore>
|
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.7.
|
33
|
+
spec.add_dependency "metanorma-iso", "~> 2.7.2"
|
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.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-19 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.7.
|
19
|
+
version: 2.7.2
|
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.7.
|
26
|
+
version: 2.7.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pubid-iec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|