metanorma-csa 2.1.13 → 2.2.0

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: 41bacb1e8cce4edaecc1abbc8b80d10182bc18e47f7eefc5ff0fd18bf2ec7bc2
4
- data.tar.gz: e3a06a2a3837fc7892319db24e1438cdb06a67ff53edecceaf7b4254b1c2be82
3
+ metadata.gz: ad12d8a38ab08e75aefc9fb672d35b9e363980d1f71a61ae9b38c5af9e42fc4c
4
+ data.tar.gz: 054c0100481db949965516221c1a7ae499d6b612461173c67f9ab133b34a885e
5
5
  SHA512:
6
- metadata.gz: 3a953eddc1012bfa2c9fcd36ab4632fc283d8b05f25d03852aefaf937107fefdebd0c7653d000f00b4f07008a9a6c8366c3bce0d3b052af0cbcd206195806fc0
7
- data.tar.gz: f7b6a3a2d38ece3ea945cf626d7b086c632895530a84fda0a0ff3f4ee6fadacf2e3af4f720c348084b6e63f2b4177babe1d3f42895695494ea9e96d8bcbd7b97
6
+ metadata.gz: eaa7d0cd126bb5b61ece5c2c625ba1c50460f085eda890ce4e68886ea8e1a8bf39188e4718340fceb65367fd312f4d60820b18ec197090e307142f95bdcc1ff2
7
+ data.tar.gz: ce4a488caecc3d2620c88ed0b78c0994234e53544b85ada7e3e7704b62d162522f6d3d539263e50cb33cd9c3d091ce74a8c11ff4f3f9deec538bea96a1912873
data/.gitignore CHANGED
@@ -9,5 +9,4 @@
9
9
 
10
10
  .rubocop-https--*
11
11
 
12
- /Gemfile.devel
13
12
  /Gemfile.lock
@@ -3151,6 +3151,10 @@
3151
3151
  <xsl:variable name="footnote_inline">
3152
3152
  <fo:inline xsl:use-attribute-sets="fn-num-style">
3153
3153
 
3154
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3155
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3156
+ </xsl:if>
3157
+
3154
3158
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3155
3159
  <xsl:value-of select="$current_fn_number_text"/>
3156
3160
  </fo:basic-link>
@@ -4301,6 +4305,23 @@
4301
4305
  <xsl:apply-templates/>
4302
4306
  </xsl:template>
4303
4307
 
4308
+ <!-- Don't break standard's numbers -->
4309
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4310
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4311
+ <xsl:choose>
4312
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4313
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4314
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4315
+ </xsl:when>
4316
+ <xsl:otherwise>
4317
+ <xsl:apply-templates/>
4318
+ </xsl:otherwise>
4319
+ </xsl:choose>
4320
+ </xsl:template>
4321
+ <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">
4322
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4323
+ </xsl:template>
4324
+
4304
4325
  <!-- ========================= -->
4305
4326
  <!-- END Rich text formatting -->
4306
4327
  <!-- ========================= -->
@@ -4696,7 +4717,7 @@
4696
4717
  <xsl:choose>
4697
4718
  <xsl:when test="@colspan">
4698
4719
  <xsl:variable name="td">
4699
- <xsl:element name="td">
4720
+ <xsl:element name="{local-name()}">
4700
4721
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4701
4722
  <xsl:if test="local-name()='th'">
4702
4723
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4711,7 +4732,7 @@
4711
4732
  </xsl:call-template>
4712
4733
  </xsl:when>
4713
4734
  <xsl:otherwise>
4714
- <xsl:element name="td">
4735
+ <xsl:element name="{local-name()}">
4715
4736
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4716
4737
  <xsl:if test="local-name()='th'">
4717
4738
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4778,7 +4799,7 @@
4778
4799
  <xsl:variable name="currentRow" select="."/>
4779
4800
 
4780
4801
  <xsl:variable name="normalizedTDs">
4781
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
4802
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
4782
4803
  <xsl:choose>
4783
4804
  <xsl:when test="@rowspan &gt; 1">
4784
4805
  <xsl:copy>
@@ -4790,7 +4811,7 @@
4790
4811
  </xsl:copy>
4791
4812
  </xsl:when>
4792
4813
  <xsl:otherwise>
4793
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
4814
+ <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)])]"/>
4794
4815
  </xsl:otherwise>
4795
4816
  </xsl:choose>
4796
4817
  </xsl:for-each>
@@ -5464,12 +5485,6 @@
5464
5485
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
5465
5486
  </xsl:if>
5466
5487
 
5467
- <!-- <xsl:if test="$namespace = 'iho'">
5468
- <xsl:if test="ancestor::iho:td">
5469
- <xsl:attribute name="font-size">12pt</xsl:attribute>
5470
- </xsl:if>
5471
- </xsl:if> -->
5472
-
5473
5488
  <fo:block>
5474
5489
 
5475
5490
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -5971,6 +5986,31 @@
5971
5986
  <xsl:apply-templates mode="svg_update"/>
5972
5987
  </xsl:copy>
5973
5988
  </xsl:template>
5989
+
5990
+ <!-- regex for 'display: inline-block;' -->
5991
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
5992
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
5993
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
5994
+ </xsl:template>
5995
+
5996
+ <!-- replace
5997
+ stroke="rgba(r, g, b, alpha)" to
5998
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
5999
+ fill="rgba(r, g, b, alpha)" to
6000
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6001
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6002
+ <xsl:variable name="components_">
6003
+ <xsl:call-template name="split">
6004
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6005
+ <xsl:with-param name="sep" select="','"/>
6006
+ </xsl:call-template>
6007
+ </xsl:variable>
6008
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6009
+ <xsl:variable name="att_name" select="local-name()"/>
6010
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6011
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6012
+ </xsl:template>
6013
+
5974
6014
  <!-- ============== -->
5975
6015
  <!-- END: svg_update -->
5976
6016
  <!-- ============== -->
@@ -8902,7 +8942,9 @@
8902
8942
  <!-- Update xml -->
8903
8943
  <!-- ===================================== -->
8904
8944
  <!-- =========================================================================== -->
8905
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
8945
+ <!-- STEP1: -->
8946
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
8947
+ <!-- - Ignore 'span' without style -->
8906
8948
  <!-- =========================================================================== -->
8907
8949
  <xsl:template match="@*|node()" mode="update_xml_step1">
8908
8950
  <xsl:copy>
@@ -8985,7 +9027,8 @@
8985
9027
  </xsl:copy>
8986
9028
  </xsl:template>
8987
9029
 
8988
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9030
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9031
+ <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">
8989
9032
  <xsl:copy>
8990
9033
  <xsl:copy-of select="@*"/>
8991
9034
  <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 Csa
3
- VERSION = "2.1.13".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
@@ -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-csa
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
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.3.7
247
+ rubygems_version: 3.3.26
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: metanorma-csa lets you write CSA Normal Documents (CSAND) in AsciiDoc.