metanorma-cc 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: 5000afa2946588d1bfb3cb0e985af9beef653134e773704f72b27944d98e0b83
4
- data.tar.gz: 22cd057e8aa8c8ac6e50a11af2c8d959648461be50c5126cd96bf4d786b86086
3
+ metadata.gz: 3b5b027d48021b7071f3e61fa85371fc3d2afb2db750b461001ae8f4d2c16606
4
+ data.tar.gz: f12d7befa0dc6583c25bf35372df0d2f2fe0e6caeabbd152fd95454ba2307307
5
5
  SHA512:
6
- metadata.gz: e7c899b03f57744cb7cad336a38b28fd7c6f6f31e19191900c0647b91d76186c6baef984c917087d7a84141f7a3b559bad73d7fcb509a043379a3f9f5fff4e38
7
- data.tar.gz: 05bf8c83d0b32183c5844ed482c2439a410af5a33f621f70c5514ebc5ad711a50ce01fabb87931bb5d629548ede68308162520cbe85cd99fd5b71cd352d38979
6
+ metadata.gz: 605251c6eb61d7ec93b0bfb533b0d2211c4a6207228d2d2325e4f41be6c88c50cb1424285a1f7eefd95b87763e05178146db278f3e1287cc5b1239ef3a99222a
7
+ data.tar.gz: 78258e44feebed56e7dbcd5326950225f3e0c0b4e92583895182f7e82699611c4955d914ae60fad0b2176ad908f0f04858679b20cee61a6452cec4f310226b3f
data/.gitignore CHANGED
@@ -3,6 +3,5 @@
3
3
  .rubocop-https--*
4
4
 
5
5
  /.rspec_status
6
- /Gemfile.devel
7
6
  /Gemfile.lock
8
7
  /coverage/
@@ -3125,6 +3125,10 @@
3125
3125
  <xsl:variable name="footnote_inline">
3126
3126
  <fo:inline xsl:use-attribute-sets="fn-num-style">
3127
3127
 
3128
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3129
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3130
+ </xsl:if>
3131
+
3128
3132
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3129
3133
  <xsl:value-of select="$current_fn_number_text"/>
3130
3134
  </fo:basic-link>
@@ -4276,6 +4280,23 @@
4276
4280
  <xsl:apply-templates/>
4277
4281
  </xsl:template>
4278
4282
 
4283
+ <!-- Don't break standard's numbers -->
4284
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4285
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4286
+ <xsl:choose>
4287
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4288
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4289
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4290
+ </xsl:when>
4291
+ <xsl:otherwise>
4292
+ <xsl:apply-templates/>
4293
+ </xsl:otherwise>
4294
+ </xsl:choose>
4295
+ </xsl:template>
4296
+ <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">
4297
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4298
+ </xsl:template>
4299
+
4279
4300
  <!-- ========================= -->
4280
4301
  <!-- END Rich text formatting -->
4281
4302
  <!-- ========================= -->
@@ -4671,7 +4692,7 @@
4671
4692
  <xsl:choose>
4672
4693
  <xsl:when test="@colspan">
4673
4694
  <xsl:variable name="td">
4674
- <xsl:element name="td">
4695
+ <xsl:element name="{local-name()}">
4675
4696
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4676
4697
  <xsl:if test="local-name()='th'">
4677
4698
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4686,7 +4707,7 @@
4686
4707
  </xsl:call-template>
4687
4708
  </xsl:when>
4688
4709
  <xsl:otherwise>
4689
- <xsl:element name="td">
4710
+ <xsl:element name="{local-name()}">
4690
4711
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4691
4712
  <xsl:if test="local-name()='th'">
4692
4713
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4753,7 +4774,7 @@
4753
4774
  <xsl:variable name="currentRow" select="."/>
4754
4775
 
4755
4776
  <xsl:variable name="normalizedTDs">
4756
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
4777
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
4757
4778
  <xsl:choose>
4758
4779
  <xsl:when test="@rowspan &gt; 1">
4759
4780
  <xsl:copy>
@@ -4765,7 +4786,7 @@
4765
4786
  </xsl:copy>
4766
4787
  </xsl:when>
4767
4788
  <xsl:otherwise>
4768
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
4789
+ <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)])]"/>
4769
4790
  </xsl:otherwise>
4770
4791
  </xsl:choose>
4771
4792
  </xsl:for-each>
@@ -5435,12 +5456,6 @@
5435
5456
 
5436
5457
  <fo:block-container margin-left="0mm">
5437
5458
 
5438
- <!-- <xsl:if test="$namespace = 'iho'">
5439
- <xsl:if test="ancestor::iho:td">
5440
- <xsl:attribute name="font-size">12pt</xsl:attribute>
5441
- </xsl:if>
5442
- </xsl:if> -->
5443
-
5444
5459
  <fo:block>
5445
5460
 
5446
5461
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -5942,6 +5957,31 @@
5942
5957
  <xsl:apply-templates mode="svg_update"/>
5943
5958
  </xsl:copy>
5944
5959
  </xsl:template>
5960
+
5961
+ <!-- regex for 'display: inline-block;' -->
5962
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
5963
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
5964
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
5965
+ </xsl:template>
5966
+
5967
+ <!-- replace
5968
+ stroke="rgba(r, g, b, alpha)" to
5969
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
5970
+ fill="rgba(r, g, b, alpha)" to
5971
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
5972
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
5973
+ <xsl:variable name="components_">
5974
+ <xsl:call-template name="split">
5975
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
5976
+ <xsl:with-param name="sep" select="','"/>
5977
+ </xsl:call-template>
5978
+ </xsl:variable>
5979
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
5980
+ <xsl:variable name="att_name" select="local-name()"/>
5981
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
5982
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
5983
+ </xsl:template>
5984
+
5945
5985
  <!-- ============== -->
5946
5986
  <!-- END: svg_update -->
5947
5987
  <!-- ============== -->
@@ -8898,7 +8938,9 @@
8898
8938
  <!-- Update xml -->
8899
8939
  <!-- ===================================== -->
8900
8940
  <!-- =========================================================================== -->
8901
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
8941
+ <!-- STEP1: -->
8942
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
8943
+ <!-- - Ignore 'span' without style -->
8902
8944
  <!-- =========================================================================== -->
8903
8945
  <xsl:template match="@*|node()" mode="update_xml_step1">
8904
8946
  <xsl:copy>
@@ -8981,7 +9023,8 @@
8981
9023
  </xsl:copy>
8982
9024
  </xsl:template>
8983
9025
 
8984
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9026
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9027
+ <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">
8985
9028
  <xsl:copy>
8986
9029
  <xsl:copy-of select="@*"/>
8987
9030
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  def annex1(elem)
9
9
  lbl = @xrefs.anchor(elem["id"], :label)
10
10
  if t = elem.at(ns("./title"))
11
- t.children = "<strong>#{t.children.to_xml}</strong>"
11
+ t.children = "<strong>#{to_xml(t.children)}</strong>"
12
12
  end
13
13
  prefix_name(elem, "<br/>", lbl, "title")
14
14
  end
@@ -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>
@@ -47,7 +47,7 @@
47
47
  </element>
48
48
  </define>
49
49
  <define name="DocumentType">
50
- <value>document</value>
50
+ <text/>
51
51
  </define>
52
52
  <define name="docsubtype">
53
53
  <element name="subdoctype">
@@ -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,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.1.13".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 2.2.2"
32
+ spec.add_dependency "metanorma-generic", "~> 2.3.0"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
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: exe
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-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.2
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.2
26
+ version: 2.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  requirements: []
248
- rubygems_version: 3.3.7
248
+ rubygems_version: 3.3.26
249
249
  signing_key:
250
250
  specification_version: 4
251
251
  summary: metanorma-cc lets you write CalConnect standards in AsciiDoc.