metanorma-iec 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd38c355c3d2dd1cdf7e109be5e326c18f18c9f5d7b9f5cbe815c58687eafd56
4
- data.tar.gz: 8441df7cd2ba4eed2d0015391b06b4058fb74f428a7e8cd27beeafe6d10d7f6b
3
+ metadata.gz: efffb1911ccc40c61913ea1afe4711abff6eba4396b9fc46a24cb78a24434f51
4
+ data.tar.gz: 6895a2259cc7cabaee3f175cb4186232c29ceca5282a6e8ef81d1d8123c8faf4
5
5
  SHA512:
6
- metadata.gz: f568d89fbe727d8b21040c8f56a2457ac08acc67b598e2a9ad8a03a03ff67974162ad687096df66d6eb6c153dd72abec30ec717307fbdf59373954dfbc28b66e
7
- data.tar.gz: af527efbfcdeb9cd6ffa68bfe1f598b08fb57201bd217a90f860e62e20e3588f5a7ec4e90f7e263634f9dba417ed6c15db332ce913a718466da9dd98f03383f0
6
+ metadata.gz: 2fbec035d589c6a49df172d36a4a37399962f1526e842fdc3303ae7f593c676311c620797105e5a76200cb293992d3c89f1997d8ed3ecd094798211c3662fde0
7
+ data.tar.gz: fc71ae2e1bce8b2f099d488f1448340978ba4b7ab4d3cdcb2b7dfac1b007e07a42cbab7cd9647e85bc9aea5086f6664ae32d388d5ee69f65cbb9af5411fadd4b
@@ -114,7 +114,13 @@
114
114
  <xsl:call-template name="namespaceCheck"/>
115
115
  <!-- https://stackoverflow.com/questions/25261949/xsl-fo-letter-spacing-with-text-align -->
116
116
  <!-- https://xmlgraphics.apache.org/fop/knownissues.html -->
117
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
117
+ <fo:root xml:lang="{$lang}">
118
+ <xsl:variable name="root-style">
119
+ <root-style xsl:use-attribute-sets="root-style"/>
120
+ </xsl:variable>
121
+ <xsl:call-template name="insertRootStyle">
122
+ <xsl:with-param name="root-style" select="$root-style"/>
123
+ </xsl:call-template>
118
124
  <fo:layout-master-set>
119
125
  <!-- cover pages -->
120
126
  <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -2078,7 +2084,30 @@
2078
2084
 
2079
2085
 
2080
2086
 
2081
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
2087
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
2088
+ <xsl:param name="root-style"/>
2089
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
2090
+
2091
+ <xsl:variable name="additional_fonts_">
2092
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
2093
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
2094
+ </xsl:for-each>
2095
+ </xsl:variable>
2096
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2097
+
2098
+ <xsl:for-each select="$root-style_/root-style/@*">
2099
+ <xsl:choose>
2100
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2101
+ <xsl:attribute name="{local-name()}">
2102
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2103
+ </xsl:attribute>
2104
+ </xsl:when>
2105
+ <xsl:otherwise>
2106
+ <xsl:copy-of select="."/>
2107
+ </xsl:otherwise>
2108
+ </xsl:choose>
2109
+ </xsl:for-each>
2110
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
2082
2111
 
2083
2112
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
2084
2113
 
@@ -2620,7 +2649,7 @@
2620
2649
 
2621
2650
 
2622
2651
 
2623
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2652
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2624
2653
 
2625
2654
 
2626
2655
 
@@ -5056,24 +5085,28 @@
5056
5085
  </xsl:template><xsl:template name="add-zero-spaces-equal">
5057
5086
  <xsl:param name="text" select="."/>
5058
5087
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
5088
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
5059
5089
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
5090
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
5060
5091
  <xsl:variable name="zero-space">​</xsl:variable>
5061
5092
  <xsl:choose>
5062
5093
  <xsl:when test="contains($text, $zero-space-after-equals)">
5063
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5094
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5064
5095
  <xsl:value-of select="$zero-space-after-equals"/>
5065
5096
  <xsl:value-of select="$zero-space"/>
5066
5097
  <xsl:call-template name="add-zero-spaces-equal">
5067
5098
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
5068
- </xsl:call-template>
5099
+ </xsl:call-template> -->
5100
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
5069
5101
  </xsl:when>
5070
5102
  <xsl:when test="contains($text, $zero-space-after-equal)">
5071
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5103
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5072
5104
  <xsl:value-of select="$zero-space-after-equal"/>
5073
5105
  <xsl:value-of select="$zero-space"/>
5074
5106
  <xsl:call-template name="add-zero-spaces-equal">
5075
5107
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
5076
- </xsl:call-template>
5108
+ </xsl:call-template> -->
5109
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
5077
5110
  </xsl:when>
5078
5111
  <xsl:otherwise>
5079
5112
  <xsl:value-of select="$text"/>
@@ -5553,7 +5586,12 @@
5553
5586
 
5554
5587
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5555
5588
 
5589
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5590
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5591
+ </xsl:if>
5592
+
5556
5593
 
5594
+
5557
5595
 
5558
5596
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5559
5597
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -6542,17 +6580,15 @@
6542
6580
 
6543
6581
  <!-- split text by zero-width space -->
6544
6582
  <xsl:variable name="text_step4">
6545
- <xsl:call-template name="split">
6583
+ <xsl:call-template name="split_for_interspers">
6546
6584
  <xsl:with-param name="pText" select="$text_step3"/>
6547
6585
  <xsl:with-param name="sep" select="$zero_width_space"/>
6548
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6549
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6550
6586
  </xsl:call-template>
6551
6587
  </xsl:variable>
6552
6588
 
6553
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6589
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6554
6590
  <xsl:choose>
6555
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6591
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6556
6592
  <xsl:call-template name="interspers">
6557
6593
  <xsl:with-param name="str" select="."/>
6558
6594
  </xsl:call-template>
@@ -6563,6 +6599,30 @@
6563
6599
  </xsl:choose>
6564
6600
  </xsl:for-each>
6565
6601
 
6602
+ </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
6603
+ <xsl:param name="pText" select="."/>
6604
+ <xsl:param name="sep" select="','"/>
6605
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6606
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6607
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6608
+ <xsl:call-template name="replace_tag_interspers">
6609
+ <xsl:with-param name="text" select="$text"/>
6610
+ </xsl:call-template>
6611
+ </xsl:template><xsl:template name="replace_tag_interspers">
6612
+ <xsl:param name="text"/>
6613
+ <xsl:choose>
6614
+ <xsl:when test="contains($text, $interspers_tag_open)">
6615
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6616
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6617
+ <interspers>
6618
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6619
+ </interspers>
6620
+ <xsl:call-template name="replace_tag_interspers">
6621
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6622
+ </xsl:call-template>
6623
+ </xsl:when>
6624
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6625
+ </xsl:choose>
6566
6626
  </xsl:template><xsl:template name="interspers">
6567
6627
  <xsl:param name="str"/>
6568
6628
  <xsl:param name="char" select="$zero_width_space"/>
@@ -7016,7 +7076,7 @@
7016
7076
  </xsl:otherwise>
7017
7077
  </xsl:choose> -->
7018
7078
  </fo:block>
7019
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7079
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
7020
7080
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
7021
7081
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
7022
7082
  <xsl:if test="normalize-space() != ''">
@@ -527,7 +527,7 @@
527
527
  </define>
528
528
  <define name="LocalityType">
529
529
  <data type="string">
530
- <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
530
+ <param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
531
531
  </data>
532
532
  </define>
533
533
  <define name="referenceFrom">
@@ -677,6 +677,9 @@
677
677
  <zeroOrMore>
678
678
  <ref name="extent"/>
679
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
680
683
  <zeroOrMore>
681
684
  <ref name="accesslocation"/>
682
685
  </zeroOrMore>
@@ -922,9 +925,29 @@
922
925
  <text/>
923
926
  </element>
924
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
925
941
  <define name="extent">
926
942
  <element name="extent">
927
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
928
951
  </element>
929
952
  </define>
930
953
  <define name="series">
@@ -46,7 +46,7 @@ module Metanorma
46
46
 
47
47
  part, subpart = node&.attr("partnumber")&.split(/-/)
48
48
  dn = add_id_parts(node.attr("docnumber"), part, subpart)
49
- dn = id_stage_prefix(dn, node, false)
49
+ dn = id_stage_prefix(dn, node)
50
50
  dn = id_edition_suffix(dn, node)
51
51
  xml.docidentifier dn, **attr_code(type: "ISO")
52
52
  end
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.0.7".freeze
3
+ VERSION = "2.0.8".freeze
4
4
  end
5
5
  end
6
6
 
@@ -859,7 +859,7 @@ RSpec.describe IsoDoc do
859
859
  <dd language='zh' script='Hans'>
860
860
  <preferred>
861
861
  <strong>&#x4EA7;&#x54C1;</strong>
862
- &#x3001;&#x3c;&#x5728;&#x53EF;&#x9760;&#x6027;&#x65B9;&#x9762;&#x3e;
862
+ , &#x3c;&#x5728;&#x53EF;&#x9760;&#x6027;&#x65B9;&#x9762;&#x3e;
863
863
  </preferred>
864
864
  </dd>
865
865
  </dl>
@@ -132,7 +132,7 @@ RSpec.describe Metanorma::Iec do
132
132
  <title>Terms and definitions</title>
133
133
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
134
134
  #{TERMS_BOILERPLATE}
135
- <term id="term-term1">
135
+ <term id="term-Term1">
136
136
  <preferred><expression><name>Term1</name></expression></preferred>
137
137
  <termnote id="_">
138
138
  <p id="_">This is a note</p>
@@ -254,7 +254,7 @@ RSpec.describe Metanorma::Iec do
254
254
  <title>Terms and definitions</title>
255
255
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
256
256
  #{TERMS_BOILERPLATE}
257
- <term id="term-term1">
257
+ <term id="term-Term1">
258
258
  <preferred><expression><name>Term1</name></expression></preferred>
259
259
  <termexample id="_">
260
260
  <p id="_">This is an example</p>
@@ -127,7 +127,7 @@ RSpec.describe Metanorma::Iec do
127
127
  <p id='_'>So am I</p>
128
128
  </li>
129
129
  </ul>
130
- <term id="term-time">
130
+ <term id="term-Time">
131
131
  <preferred><expression><name>Time</name></expression></preferred>
132
132
  <definition><verbal-definition><p id="_">This paragraph is extraneous</p></verbal-definition></definition>
133
133
  </term></terms>
@@ -164,7 +164,7 @@ RSpec.describe Metanorma::Iec do
164
164
  <title>Terms and definitions</title>
165
165
  <terms id='_' obligation='normative'>
166
166
  <title>General</title>
167
- <term id='term-term-1'>
167
+ <term id='term-Term-1'>
168
168
  <preferred><expression><name>Term 1</name></expression></preferred>
169
169
  </term>
170
170
  </terms>
@@ -1,12 +1,12 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Metanorma::Iec do
4
- before(:all) do
5
- @blank_hdr = blank_hdr_gen
6
- end
4
+ before(:all) do
5
+ @blank_hdr = blank_hdr_gen
6
+ end
7
7
 
8
8
  it "processes breaks" do
9
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
9
+ input = <<~INPUT
10
10
  #{ASCIIDOC_BLANK_HDR}
11
11
  Line break +
12
12
  line break
@@ -15,47 +15,56 @@ end
15
15
 
16
16
  <<<
17
17
  INPUT
18
- #{@blank_hdr}
19
- <sections><p id="_">Line break<br/>
20
- line break</p>
21
- <hr/>
22
- <pagebreak/></sections>
23
- </iec-standard>
18
+ output = <<~OUTPUT
19
+ #{@blank_hdr}
20
+ <sections><p id="_">Line break<br/>
21
+ line break</p>
22
+ <hr/>
23
+ <pagebreak/></sections>
24
+ </iec-standard>
24
25
  OUTPUT
26
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, OPTIONS))))
27
+ .to be_equivalent_to xmlpp(output)
25
28
  end
26
29
 
27
30
  it "processes links" do
28
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
31
+ input = <<~INPUT
29
32
  #{ASCIIDOC_BLANK_HDR}
30
33
  mailto:fred@example.com
31
34
  http://example.com[]
32
35
  http://example.com[Link]
33
36
  INPUT
34
- #{@blank_hdr}
35
- <sections>
36
- <p id="_">mailto:fred@example.com
37
- <link target="http://example.com"/>
38
- <link target="http://example.com">Link</link></p>
39
- </sections>
40
- </iec-standard>
37
+ output = <<~OUTPUT
38
+ #{@blank_hdr}
39
+ <sections>
40
+ <p id="_">mailto:fred@example.com
41
+ <link target="http://example.com"/>
42
+ <link target="http://example.com">Link</link></p>
43
+ </sections>
44
+ </iec-standard>
41
45
  OUTPUT
46
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, OPTIONS))))
47
+ .to be_equivalent_to xmlpp(output)
42
48
  end
43
49
 
44
- it "processes bookmarks" do
45
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
50
+ it "processes bookmarks" do
51
+ input = <<~INPUT
46
52
  #{ASCIIDOC_BLANK_HDR}
47
53
  Text [[bookmark]] Text
48
54
  INPUT
49
- #{@blank_hdr}
50
- <sections>
51
- <p id="_">Text <bookmark id="bookmark"/> Text</p>
52
- </sections>
53
- </iec-standard>
55
+ output = <<~OUTPUT
56
+ #{@blank_hdr}
57
+ <sections>
58
+ <p id="_">Text <bookmark id="bookmark"/> Text</p>
59
+ </sections>
60
+ </iec-standard>
54
61
  OUTPUT
55
- end
62
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, OPTIONS))))
63
+ .to be_equivalent_to xmlpp(output)
64
+ end
56
65
 
57
- it "processes crossreferences" do
58
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
66
+ it "processes crossreferences" do
67
+ input = <<~INPUT
59
68
  #{ASCIIDOC_BLANK_HDR}
60
69
  [[reference]]
61
70
  == Section
@@ -65,22 +74,25 @@ end
65
74
  Inline Reference with Text to <<reference,text>>
66
75
  Footnoted Reference with Text to <<reference,fn: text>>
67
76
  INPUT
68
- #{@blank_hdr}
69
- <sections>
70
- <clause id="reference" inline-header="false" obligation="normative">
71
- <title>Section</title>
72
- <p id="_">Inline Reference to <xref target="reference"/>
73
- Footnoted Reference to <xref target="reference"/>
74
- Inline Reference with Text to <xref target="reference">text</xref>
75
- Footnoted Reference with Text to <xref target="reference">text</xref></p>
76
- </clause>
77
- </sections>
78
- </iec-standard>
79
- OUTPUT
80
- end
77
+ output = <<~OUTPUT
78
+ #{@blank_hdr}
79
+ <sections>
80
+ <clause id="reference" inline-header="false" obligation="normative">
81
+ <title>Section</title>
82
+ <p id="_">Inline Reference to <xref target="reference"/>
83
+ Footnoted Reference to <xref target="reference"/>
84
+ Inline Reference with Text to <xref target="reference">text</xref>
85
+ Footnoted Reference with Text to <xref target="reference">text</xref></p>
86
+ </clause>
87
+ </sections>
88
+ </iec-standard>
89
+ OUTPUT
90
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, OPTIONS))))
91
+ .to be_equivalent_to xmlpp(output)
92
+ end
81
93
 
82
- it "processes bibliographic anchors" do
83
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
94
+ it "processes bibliographic anchors" do
95
+ input = <<~INPUT
84
96
  #{ASCIIDOC_BLANK_HDR}
85
97
  [bibliography]
86
98
  == Normative References
@@ -89,41 +101,45 @@ end
89
101
  * [[[ISO713]]] Reference
90
102
 
91
103
  INPUT
92
- #{@blank_hdr}
93
- <sections>
104
+ output = <<~OUTPUT
105
+ #{@blank_hdr}
106
+ <sections>
94
107
 
95
- </sections><bibliography><references id="_" obligation="informative" normative="true">
96
- <title>Normative references</title>
97
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
98
- <bibitem id="ISO712">
99
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
100
- <docidentifier>x</docidentifier>
101
- </bibitem>
102
- <bibitem id="ISO713">
103
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
104
- <docidentifier>ISO713</docidentifier>
105
- <docnumber>713</docnumber>
106
- </bibitem>
107
- </references>
108
- </bibliography>
109
- </iec-standard>
108
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
109
+ <title>Normative references</title>
110
+ <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
111
+ <bibitem id="ISO712">
112
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
113
+ <docidentifier>x</docidentifier>
114
+ </bibitem>
115
+ <bibitem id="ISO713">
116
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
117
+ <docidentifier>ISO713</docidentifier>
118
+ <docnumber>713</docnumber>
119
+ </bibitem>
120
+ </references>
121
+ </bibliography>
122
+ </iec-standard>
110
123
  OUTPUT
124
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, OPTIONS))))
125
+ .to be_equivalent_to xmlpp(output)
111
126
  end
112
127
 
113
128
  it "processes footnotes" do
114
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
129
+ input = <<~INPUT
115
130
  #{ASCIIDOC_BLANK_HDR}
116
131
  Hello!footnote:[Footnote text]
117
132
  INPUT
118
- #{@blank_hdr}
119
- <sections>
120
- <p id="_">Hello!<fn reference="1">
121
- <p id="_">Footnote text</p>
122
- </fn></p>
123
- </sections>
124
- </iec-standard>
133
+ output = <<~OUTPUT
134
+ #{@blank_hdr}
135
+ <sections>
136
+ <p id="_">Hello!<fn reference="1">
137
+ <p id="_">Footnote text</p>
138
+ </fn></p>
139
+ </sections>
140
+ </iec-standard>
125
141
  OUTPUT
142
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, OPTIONS))))
143
+ .to be_equivalent_to xmlpp(output)
126
144
  end
127
-
128
-
129
145
  end
@@ -1,12 +1,12 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Metanorma::Iec do
4
- before(:all) do
5
- @blank_hdr = blank_hdr_gen
6
- end
4
+ before(:all) do
5
+ @blank_hdr = blank_hdr_gen
6
+ end
7
7
 
8
8
  it "processes sections" do
9
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
9
+ input = <<~INPUT
10
10
  #{ASCIIDOC_BLANK_HDR}
11
11
  .Foreword
12
12
 
@@ -56,69 +56,72 @@ end
56
56
 
57
57
  === Bibliography Subsection
58
58
  INPUT
59
- #{@blank_hdr}
60
- <preface><foreword id="_" obligation="informative">
61
- <title>FOREWORD</title>
62
- <p id="_">Text</p>
63
- </foreword><introduction id="_" obligation="informative">
64
- <title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
65
- <title>Introduction Subsection</title>
66
- </clause>
67
- </introduction></preface><sections>
68
- <clause id="_" obligation="normative" type="scope" inline-header='false'>
69
- <title>Scope</title>
70
- <p id="_">Text</p>
71
- </clause>
72
-
73
- <terms id="_" obligation="normative">
74
- <title>Terms and definitions</title>
75
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
76
- #{TERMS_BOILERPLATE}
77
- <term id="term-term1">
78
- <preferred><expression><name>Term1</name></expression></preferred>
79
- </term>
80
- </terms>
81
- <clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="_" obligation="normative">
82
- <title>Normal Terms</title>
83
- <term id="term-term2">
84
- <preferred><expression><name>Term2</name></expression></preferred>
85
- </term>
86
- </terms>
87
- <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions></clause>
88
- <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions>
89
- <clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
90
- <title>Introduction</title>
91
- </clause>
92
- <clause id="_" inline-header="false" obligation="normative">
93
- <title>Clause 4.2</title>
94
- </clause></clause>
95
- <clause id="_" inline-header="false" obligation="normative">
96
- <title>Terms and Definitions</title>
97
- </clause>
98
-
99
-
100
- </sections><annex id="_" inline-header="false" obligation="normative">
101
- <title>Annex</title>
102
- <clause id="_" inline-header="false" obligation="normative">
103
- <title>Annex A.1</title>
104
- </clause>
105
- <appendix id="_" inline-header="false" obligation="normative">
106
- <title>Appendix 1</title>
107
- </appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
108
- <title>Normative references</title><p id="_">There are no normative references in this document.</p>
109
- </references><clause id="_" obligation="informative">
110
- <title>Bibliography</title>
111
- <references id="_" obligation="informative" normative="false">
112
- <title>Bibliography Subsection</title>
113
- </references>
114
- </clause>
115
- </bibliography>
116
- </iec-standard>
59
+ output = <<~OUTPUT
60
+ #{@blank_hdr}
61
+ <preface><foreword id="_" obligation="informative">
62
+ <title>FOREWORD</title>
63
+ <p id="_">Text</p>
64
+ </foreword><introduction id="_" obligation="informative">
65
+ <title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
66
+ <title>Introduction Subsection</title>
67
+ </clause>
68
+ </introduction></preface><sections>
69
+ <clause id="_" obligation="normative" type="scope" inline-header='false'>
70
+ <title>Scope</title>
71
+ <p id="_">Text</p>
72
+ </clause>
73
+
74
+ <terms id="_" obligation="normative">
75
+ <title>Terms and definitions</title>
76
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
77
+ #{TERMS_BOILERPLATE}
78
+ <term id="term-Term1">
79
+ <preferred><expression><name>Term1</name></expression></preferred>
80
+ </term>
81
+ </terms>
82
+ <clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="_" obligation="normative">
83
+ <title>Normal Terms</title>
84
+ <term id="term-Term2">
85
+ <preferred><expression><name>Term2</name></expression></preferred>
86
+ </term>
87
+ </terms>
88
+ <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions></clause>
89
+ <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions>
90
+ <clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
91
+ <title>Introduction</title>
92
+ </clause>
93
+ <clause id="_" inline-header="false" obligation="normative">
94
+ <title>Clause 4.2</title>
95
+ </clause></clause>
96
+ <clause id="_" inline-header="false" obligation="normative">
97
+ <title>Terms and Definitions</title>
98
+ </clause>
99
+
100
+
101
+ </sections><annex id="_" inline-header="false" obligation="normative">
102
+ <title>Annex</title>
103
+ <clause id="_" inline-header="false" obligation="normative">
104
+ <title>Annex A.1</title>
105
+ </clause>
106
+ <appendix id="_" inline-header="false" obligation="normative">
107
+ <title>Appendix 1</title>
108
+ </appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
109
+ <title>Normative references</title><p id="_">There are no normative references in this document.</p>
110
+ </references><clause id="_" obligation="informative">
111
+ <title>Bibliography</title>
112
+ <references id="_" obligation="informative" normative="false">
113
+ <title>Bibliography Subsection</title>
114
+ </references>
115
+ </clause>
116
+ </bibliography>
117
+ </iec-standard>
117
118
  OUTPUT
119
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
120
+ .to be_equivalent_to xmlpp(output)
118
121
  end
119
122
 
120
123
  it "processes sections with title attributes" do
121
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
124
+ input = <<~INPUT
122
125
  #{ASCIIDOC_BLANK_HDR}
123
126
  .Foreword
124
127
 
@@ -174,84 +177,86 @@ end
174
177
 
175
178
  === Bibliography Subsection
176
179
  INPUT
177
- #{@blank_hdr}
178
- <preface>
179
- <foreword id="_" obligation="informative">
180
- <title>FOREWORD</title>
181
- <p id="_">Text</p>
182
- </foreword>
183
- <introduction id="_" obligation="informative">
184
- <title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
185
- <title>Introduction Subsection</title>
186
- </clause>
187
- </introduction>
188
- </preface>
189
- <sections>
190
- <clause id="_" obligation="normative" type="scope" inline-header='false'>
191
- <title>Scope</title>
192
- <p id="_">Text</p>
193
- </clause>
194
-
195
- <terms id="_" obligation="normative">
196
- <title>Terms and definitions</title>
197
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
198
- #{TERMS_BOILERPLATE}
199
- <term id="term-term1">
200
- <preferred><expression><name>Term1</name></expression></preferred>
201
- </term>
202
- </terms>
203
- <clause id='_' obligation='normative'>
204
- <title>Terms, definitions, symbols and abbreviated terms</title>
205
- <terms id='_' obligation='normative'>
206
- <title>Normal Terms</title>
207
- <term id='term-term2'>
208
- <preferred><expression><name>Term2</name></expression></preferred>
209
- </term>
210
- </terms>
211
- <definitions id='_' obligation="normative">
212
- <title>Symbols and abbreviated terms</title>
213
- </definitions>
214
- </clause>
215
- <definitions id='_' obligation="normative">
216
- <title>Symbols and abbreviated terms</title>
217
- </definitions>
218
- <clause id='_' inline-header='false' obligation='normative'>
219
- <title>Clause 4</title>
220
- <clause id='_' inline-header='false' obligation='normative'>
221
- <title>Introduction</title>
180
+ output = <<~OUTPUT
181
+ #{@blank_hdr}
182
+ <preface>
183
+ <foreword id="_" obligation="informative">
184
+ <title>FOREWORD</title>
185
+ <p id="_">Text</p>
186
+ </foreword>
187
+ <introduction id="_" obligation="informative">
188
+ <title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
189
+ <title>Introduction Subsection</title>
222
190
  </clause>
223
- <clause id='_' inline-header='false' obligation='normative'>
224
- <title>Clause 4.2</title>
191
+ </introduction>
192
+ </preface>
193
+ <sections>
194
+ <clause id="_" obligation="normative" type="scope" inline-header='false'>
195
+ <title>Scope</title>
196
+ <p id="_">Text</p>
225
197
  </clause>
226
- </clause>
227
- </sections>
228
- <annex id='_' inline-header='false' obligation='normative'>
229
- <title>Annex</title>
230
- <clause id='_' inline-header='false' obligation='normative'>
231
- <title>Annex A.1</title>
232
- </clause>
233
- <appendix id='_' inline-header='false' obligation='normative'>
234
- <title>Appendx 1</title>
235
- </appendix>
236
- </annex>
237
- <bibliography>
238
- <references id='_' obligation='informative' normative="true">
239
- <title>Normative references</title>
240
- <p id="_">There are no normative references in this document.</p>
241
- </references>
242
- <clause id='_' obligation='informative'>
243
- <title>Bibliography</title>
244
- <references id='_' obligation='informative' normative="false">
245
- <title>Bibliography Subsection</title>
246
- </references>
247
- </clause>
248
- </bibliography>
249
- </iec-standard>
198
+ <terms id="_" obligation="normative">
199
+ <title>Terms and definitions</title>
200
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
201
+ #{TERMS_BOILERPLATE}
202
+ <term id="term-Term1">
203
+ <preferred><expression><name>Term1</name></expression></preferred>
204
+ </term>
205
+ </terms>
206
+ <clause id='_' obligation='normative'>
207
+ <title>Terms, definitions, symbols and abbreviated terms</title>
208
+ <terms id='_' obligation='normative'>
209
+ <title>Normal Terms</title>
210
+ <term id='term-Term2'>
211
+ <preferred><expression><name>Term2</name></expression></preferred>
212
+ </term>
213
+ </terms>
214
+ <definitions id='_' obligation="normative">
215
+ <title>Symbols and abbreviated terms</title>
216
+ </definitions>
217
+ </clause>
218
+ <definitions id='_' obligation="normative">
219
+ <title>Symbols and abbreviated terms</title>
220
+ </definitions>
221
+ <clause id='_' inline-header='false' obligation='normative'>
222
+ <title>Clause 4</title>
223
+ <clause id='_' inline-header='false' obligation='normative'>
224
+ <title>Introduction</title>
225
+ </clause>
226
+ <clause id='_' inline-header='false' obligation='normative'>
227
+ <title>Clause 4.2</title>
228
+ </clause>
229
+ </clause>
230
+ </sections>
231
+ <annex id='_' inline-header='false' obligation='normative'>
232
+ <title>Annex</title>
233
+ <clause id='_' inline-header='false' obligation='normative'>
234
+ <title>Annex A.1</title>
235
+ </clause>
236
+ <appendix id='_' inline-header='false' obligation='normative'>
237
+ <title>Appendx 1</title>
238
+ </appendix>
239
+ </annex>
240
+ <bibliography>
241
+ <references id='_' obligation='informative' normative="true">
242
+ <title>Normative references</title>
243
+ <p id="_">There are no normative references in this document.</p>
244
+ </references>
245
+ <clause id='_' obligation='informative'>
246
+ <title>Bibliography</title>
247
+ <references id='_' obligation='informative' normative="false">
248
+ <title>Bibliography Subsection</title>
249
+ </references>
250
+ </clause>
251
+ </bibliography>
252
+ </iec-standard>
250
253
  OUTPUT
254
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
255
+ .to be_equivalent_to xmlpp(output)
251
256
  end
252
257
 
253
258
  it "processes section obligations" do
254
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
259
+ input = <<~INPUT
255
260
  #{ASCIIDOC_BLANK_HDR}
256
261
  [obligation=informative]
257
262
  == Clause 1
@@ -263,26 +268,29 @@ end
263
268
 
264
269
  [appendix,obligation=informative]
265
270
  == Annex
266
- INPUT
267
- #{@blank_hdr}
268
- <sections><clause id="_" inline-header="false" obligation="informative">
269
- <title>Clause 1</title>
270
- <clause id="_" inline-header="false" obligation="informative">
271
- <title>Clause 1a</title>
272
- </clause>
273
- </clause>
274
- <clause id="_" inline-header="false" obligation="normative">
275
- <title>Clause 2</title>
276
- </clause>
277
- </sections><annex id="_" inline-header="false" obligation="informative">
278
- <title>Annex</title>
279
- </annex>
280
- </iec-standard>
281
- OUTPUT
271
+ INPUT
272
+ output = <<~OUTPUT
273
+ #{@blank_hdr}
274
+ <sections><clause id="_" inline-header="false" obligation="informative">
275
+ <title>Clause 1</title>
276
+ <clause id="_" inline-header="false" obligation="informative">
277
+ <title>Clause 1a</title>
278
+ </clause>
279
+ </clause>
280
+ <clause id="_" inline-header="false" obligation="normative">
281
+ <title>Clause 2</title>
282
+ </clause>
283
+ </sections><annex id="_" inline-header="false" obligation="informative">
284
+ <title>Annex</title>
285
+ </annex>
286
+ </iec-standard>
287
+ OUTPUT
288
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
289
+ .to be_equivalent_to xmlpp(output)
282
290
  end
283
291
 
284
- it "processes inline headers" do
285
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
292
+ it "processes inline headers" do
293
+ input = <<~INPUT
286
294
  #{ASCIIDOC_BLANK_HDR}
287
295
  == Clause 1
288
296
 
@@ -294,42 +302,47 @@ end
294
302
 
295
303
  [%inline-header]
296
304
  === Clause Aa
297
- INPUT
298
- #{@blank_hdr}
299
- <sections><clause id="_" inline-header="false" obligation="normative">
300
- <title>Clause 1</title>
301
- <clause id="_" inline-header="true" obligation="normative">
302
- <title>Clause 1a</title>
303
- </clause>
304
- </clause>
305
- </sections><annex id="_" inline-header="false" obligation="normative">
306
- <title>Annex A</title>
307
- <clause id="_" inline-header="true" obligation="normative">
308
- <title>Clause Aa</title>
309
- </clause>
310
- </annex>
311
- </iec-standard>
312
- OUTPUT
313
- end
305
+ INPUT
306
+ output = <<~OUTPUT
307
+ #{@blank_hdr}
308
+ <sections><clause id="_" inline-header="false" obligation="normative">
309
+ <title>Clause 1</title>
310
+ <clause id="_" inline-header="true" obligation="normative">
311
+ <title>Clause 1a</title>
312
+ </clause>
313
+ </clause>
314
+ </sections><annex id="_" inline-header="false" obligation="normative">
315
+ <title>Annex A</title>
316
+ <clause id="_" inline-header="true" obligation="normative">
317
+ <title>Clause Aa</title>
318
+ </clause>
319
+ </annex>
320
+ </iec-standard>
321
+ OUTPUT
322
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
323
+ .to be_equivalent_to xmlpp(output)
324
+ end
314
325
 
315
326
  it "processes blank headers" do
316
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
327
+ input = <<~INPUT
317
328
  #{ASCIIDOC_BLANK_HDR}
318
329
  == Clause 1
319
330
 
320
331
  === {blank}
321
332
 
322
- INPUT
323
- #{@blank_hdr}
324
- <sections>
325
- <clause id="_" inline-header="false" obligation="normative">
326
- <title>Clause 1</title>
327
- <clause id="_" inline-header="false" obligation="normative">
328
- </clause>
329
- </clause>
330
- </sections>
331
- </iec-standard>
332
- OUTPUT
333
+ INPUT
334
+ output = <<~OUTPUT
335
+ #{@blank_hdr}
336
+ <sections>
337
+ <clause id="_" inline-header="false" obligation="normative">
338
+ <title>Clause 1</title>
339
+ <clause id="_" inline-header="false" obligation="normative">
340
+ </clause>
341
+ </clause>
342
+ </sections>
343
+ </iec-standard>
344
+ OUTPUT
345
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
346
+ .to be_equivalent_to xmlpp(output)
333
347
  end
334
-
335
348
  end
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.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso