metanorma-iec 2.1.13 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 103451df9208dd5c73f9405284df2fd6f2d92a32904b167840e0458b4766f401
4
- data.tar.gz: e2ee999fd2718b01d4362ac00ad1f3428287de9ea28ad320bd67a7f3e6938bb3
3
+ metadata.gz: fe5f071488c1b489abdf32da76363aaa976af39d6bfb84631225a3d08ad630bd
4
+ data.tar.gz: 94c952903d02e5de6934ed33ec9a45caa1fe930025c6391cc94d857c386e6ce5
5
5
  SHA512:
6
- metadata.gz: 7bd2c177ac2a318a847b8ed88703fc9d20d70a597e47d82db7d3fc8c8eb56ef7e3d11b60fc8602af07bdc301990fc20c93fc60d83037806d34a7e1b9493f18e9
7
- data.tar.gz: 6578b3a9bd37d56fdb81ff2e59467fc0ffe451e134366927e3e95f81c3bf043837cce1cfee8e5cd4594bcb3dffd31a5ca46d633c8d6566f97c304ebcd0ba7106
6
+ metadata.gz: b60c7395b02c317a03675b08f70be8b09b75d19b963aebcbf2355caa0f6ed7b832ede96e628aa3203546c0f27daaa75999e629b4cd89ff4473dc8ddcf34588d3
7
+ data.tar.gz: 0c13485be861d7abef84dadce587fbbc1306c2f2a4a95faefbcdd6029905a7e27534d14f1c9b551a1c950d939abbb56a7ccd67d034c8883dcd29bee25a264877
data/.gitignore CHANGED
@@ -5,7 +5,6 @@ coverage/
5
5
 
6
6
  .rubocop-https--*
7
7
 
8
- /Gemfile.devel
9
8
  /Gemfile.lock
10
9
  /spec/assets/iso.doc
11
10
  /spec/assets/iso.html
@@ -4637,6 +4637,10 @@
4637
4637
  <xsl:variable name="footnote_inline">
4638
4638
  <fo:inline xsl:use-attribute-sets="fn-num-style">
4639
4639
 
4640
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4641
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4642
+ </xsl:if>
4643
+
4640
4644
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4641
4645
  <xsl:value-of select="$current_fn_number_text"/>
4642
4646
  </fo:basic-link>
@@ -5807,6 +5811,23 @@
5807
5811
  <xsl:apply-templates/>
5808
5812
  </xsl:template>
5809
5813
 
5814
+ <!-- Don't break standard's numbers -->
5815
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
5816
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
5817
+ <xsl:choose>
5818
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5819
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5820
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5821
+ </xsl:when>
5822
+ <xsl:otherwise>
5823
+ <xsl:apply-templates/>
5824
+ </xsl:otherwise>
5825
+ </xsl:choose>
5826
+ </xsl:template>
5827
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
5828
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5829
+ </xsl:template>
5830
+
5810
5831
  <!-- ========================= -->
5811
5832
  <!-- END Rich text formatting -->
5812
5833
  <!-- ========================= -->
@@ -6202,7 +6223,7 @@
6202
6223
  <xsl:choose>
6203
6224
  <xsl:when test="@colspan">
6204
6225
  <xsl:variable name="td">
6205
- <xsl:element name="td">
6226
+ <xsl:element name="{local-name()}">
6206
6227
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
6207
6228
  <xsl:if test="local-name()='th'">
6208
6229
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -6217,7 +6238,7 @@
6217
6238
  </xsl:call-template>
6218
6239
  </xsl:when>
6219
6240
  <xsl:otherwise>
6220
- <xsl:element name="td">
6241
+ <xsl:element name="{local-name()}">
6221
6242
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
6222
6243
  <xsl:if test="local-name()='th'">
6223
6244
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -6284,7 +6305,7 @@
6284
6305
  <xsl:variable name="currentRow" select="."/>
6285
6306
 
6286
6307
  <xsl:variable name="normalizedTDs">
6287
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
6308
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
6288
6309
  <xsl:choose>
6289
6310
  <xsl:when test="@rowspan &gt; 1">
6290
6311
  <xsl:copy>
@@ -6296,7 +6317,7 @@
6296
6317
  </xsl:copy>
6297
6318
  </xsl:when>
6298
6319
  <xsl:otherwise>
6299
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
6320
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
6300
6321
  </xsl:otherwise>
6301
6322
  </xsl:choose>
6302
6323
  </xsl:for-each>
@@ -6970,12 +6991,6 @@
6970
6991
 
6971
6992
  <fo:block-container margin-left="0mm">
6972
6993
 
6973
- <!-- <xsl:if test="$namespace = 'iho'">
6974
- <xsl:if test="ancestor::iho:td">
6975
- <xsl:attribute name="font-size">12pt</xsl:attribute>
6976
- </xsl:if>
6977
- </xsl:if> -->
6978
-
6979
6994
  <fo:block>
6980
6995
 
6981
6996
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -7479,6 +7494,31 @@
7479
7494
  <xsl:apply-templates mode="svg_update"/>
7480
7495
  </xsl:copy>
7481
7496
  </xsl:template>
7497
+
7498
+ <!-- regex for 'display: inline-block;' -->
7499
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7500
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
7501
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
7502
+ </xsl:template>
7503
+
7504
+ <!-- replace
7505
+ stroke="rgba(r, g, b, alpha)" to
7506
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
7507
+ fill="rgba(r, g, b, alpha)" to
7508
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
7509
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
7510
+ <xsl:variable name="components_">
7511
+ <xsl:call-template name="split">
7512
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
7513
+ <xsl:with-param name="sep" select="','"/>
7514
+ </xsl:call-template>
7515
+ </xsl:variable>
7516
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
7517
+ <xsl:variable name="att_name" select="local-name()"/>
7518
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
7519
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
7520
+ </xsl:template>
7521
+
7482
7522
  <!-- ============== -->
7483
7523
  <!-- END: svg_update -->
7484
7524
  <!-- ============== -->
@@ -10440,7 +10480,9 @@
10440
10480
  <!-- Update xml -->
10441
10481
  <!-- ===================================== -->
10442
10482
  <!-- =========================================================================== -->
10443
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10483
+ <!-- STEP1: -->
10484
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
10485
+ <!-- - Ignore 'span' without style -->
10444
10486
  <!-- =========================================================================== -->
10445
10487
  <xsl:template match="@*|node()" mode="update_xml_step1">
10446
10488
  <xsl:copy>
@@ -10523,7 +10565,8 @@
10523
10565
  </xsl:copy>
10524
10566
  </xsl:template>
10525
10567
 
10526
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
10568
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
10569
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
10527
10570
  <xsl:copy>
10528
10571
  <xsl:copy-of select="@*"/>
10529
10572
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -124,7 +124,7 @@ module IsoDoc
124
124
  p = d.parent
125
125
  designation_annotate(p, d.at(ns("./name")))
126
126
  m << { lang: lg, script: Metanorma::Utils.default_script(lg),
127
- designation: l10n_recursive(p.remove, lg).to_xml.strip }
127
+ designation: to_xml(l10n_recursive(p.remove, lg)).strip }
128
128
  end
129
129
  end
130
130
 
@@ -183,7 +183,7 @@ module IsoDoc
183
183
  ref = node.at(ns("./xref | ./eref | ./termref"))
184
184
  label = @i18n.relatedterms[node["type"]].upcase
185
185
  node.replace(l10n("<p>#{label}: " \
186
- "#{p.children.to_xml} (#{ref.to_xml})</p>"))
186
+ "#{to_xml(p.children)} (#{to_xml(ref)})</p>"))
187
187
  @i18n = @i18n_lg["default"]
188
188
  end
189
189
 
@@ -205,9 +205,9 @@ module IsoDoc
205
205
 
206
206
  def termsource1_iev(elem)
207
207
  while elem&.next_element&.name == "termsource"
208
- elem << "; #{elem.next_element.remove.children.to_xml}"
208
+ elem << "; #{to_xml(elem.next_element.remove.children)}"
209
209
  end
210
- elem.children = l10n("#{@i18n.source}: #{elem.children.to_xml.strip}")
210
+ elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
211
211
  end
212
212
 
213
213
  def termexample(docxml)
@@ -683,6 +683,9 @@
683
683
  </define>
684
684
  <define name="underline">
685
685
  <element name="underline">
686
+ <optional>
687
+ <attribute name="style"/>
688
+ </optional>
686
689
  <zeroOrMore>
687
690
  <ref name="PureTextElement"/>
688
691
  </zeroOrMore>
@@ -2653,6 +2653,7 @@
2653
2653
  <value>full</value>
2654
2654
  <value>short</value>
2655
2655
  <value>id</value>
2656
+ <value>modspec</value>
2656
2657
  </choice>
2657
2658
  </define>
2658
2659
  <define name="erefTypeWithConnective">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.1.13".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
6
6
 
@@ -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.2.0"
33
+ spec.add_dependency "metanorma-iso", "~> 2.3.0"
34
34
  spec.add_dependency "ruby-jing"
35
35
 
36
36
  spec.add_development_dependency "debug"
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.1.13
4
+ version: 2.2.0
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-11-21 00:00:00.000000000 Z
11
+ date: 2022-12-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.2.0
19
+ version: 2.3.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.2.0
26
+ version: 2.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-jing
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.3.7
273
+ rubygems_version: 3.3.26
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: metanorma-iec lets you write IEC standards in AsciiDoc.