metanorma-iec 2.4.3 → 2.4.4

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: 67f13ed076d84721e934f89543ebd35bfb61dcde9a119fb1a74a6c37972ae638
4
- data.tar.gz: 3c6d285ba5b25b7ede8fe587eb12634cc41a3bfde605f544480def7d7ddbf5ac
3
+ metadata.gz: 983a0ecfbb9268e7428c55b36574bc046a2fc4ce749aa93dce9ecef035ae4e5a
4
+ data.tar.gz: 64ec2813deda8032f200ca67b359e287bd7db20000efde215b3add5fb1f2c498
5
5
  SHA512:
6
- metadata.gz: 12f7b8b241864d2c4ab78ca9862bf51b5d6a070959cce22501793e0709f06d37b21283e3b5447d942f21cf9a37dc61a293698e7a373b744d1774679ff812b530
7
- data.tar.gz: 6dc3974076f9f24f247c1007e71d9eee1202bd96bdc89cf04cc900e48b137eb4870aee233461134d5ab29e8938238cb0bda7bea2ac806777d32bfc5cd91ac760
6
+ metadata.gz: ed8a99a03048f7ec0da59e21bfd1be59b06e0d21c03f95d38ca27f88330d6e01b9199f62f8f978ffc2af820cafd7e6345510ad6a126cf0285e523acd77336928
7
+ data.tar.gz: 3d08b38772898074098c9b0af578a875ce435dce0c490d37f4361326fbacb35ef9901188c8e4461148a8ce81c381056a673324e3c4cd5b362b07ff21287325c6
@@ -6526,7 +6526,8 @@
6526
6526
  </xsl:template>
6527
6527
 
6528
6528
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6529
- <xsl:variable name="text" select="normalize-space(.)"/>
6529
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6530
+ <xsl:variable name="text" select="."/>
6530
6531
  <fo:inline font-size="75%" role="SKIP">
6531
6532
  <xsl:if test="string-length($text) &gt; 0">
6532
6533
  <xsl:variable name="smallCapsText">
@@ -8736,16 +8737,44 @@
8736
8737
  </xsl:choose>
8737
8738
 
8738
8739
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8739
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8740
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8740
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8741
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8742
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8743
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8744
+
8745
+ <!-- Example: -->
8741
8746
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8742
8747
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8743
8748
  <!-- effective height / width = 1.48, 1.4 - with title -->
8744
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8749
+
8750
+ <xsl:variable name="scale_x">
8751
+ <xsl:choose>
8752
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8753
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8754
+ </xsl:when>
8755
+ <xsl:otherwise>1</xsl:otherwise>
8756
+ </xsl:choose>
8757
+ </xsl:variable>
8758
+ <xsl:variable name="scale_y">
8759
+ <xsl:choose>
8760
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8761
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8762
+ </xsl:when>
8763
+ <xsl:otherwise>1</xsl:otherwise>
8764
+ </xsl:choose>
8765
+ </xsl:variable>
8766
+
8767
+ <!-- for images with big height -->
8768
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8745
8769
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8746
8770
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8747
- </xsl:if>
8771
+ </xsl:if> -->
8748
8772
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8773
+
8774
+ <xsl:if test="$scale_y != 1">
8775
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8776
+ </xsl:if>
8777
+
8749
8778
  <xsl:copy-of select="$svg_content"/>
8750
8779
  </fo:instream-foreign-object>
8751
8780
  <!-- </fo:block> -->
@@ -8783,8 +8812,12 @@
8783
8812
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8784
8813
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8785
8814
 
8815
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8816
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8817
+
8786
8818
  <xsl:attribute name="width">
8787
8819
  <xsl:choose>
8820
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8788
8821
  <xsl:when test="$width != ''">
8789
8822
  <xsl:value-of select="round($width)"/>
8790
8823
  </xsl:when>
@@ -8793,6 +8826,7 @@
8793
8826
  </xsl:attribute>
8794
8827
  <xsl:attribute name="height">
8795
8828
  <xsl:choose>
8829
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8796
8830
  <xsl:when test="$height != ''">
8797
8831
  <xsl:value-of select="round($height)"/>
8798
8832
  </xsl:when>
@@ -8804,6 +8838,28 @@
8804
8838
  </xsl:copy>
8805
8839
  </xsl:template>
8806
8840
 
8841
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8842
+ <!-- image[@width]/svg -->
8843
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8844
+ <xsl:attribute name="width">
8845
+ <xsl:choose>
8846
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8847
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8848
+ </xsl:choose>
8849
+ </xsl:attribute>
8850
+ </xsl:template>
8851
+
8852
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8853
+ <!-- image[@height]/svg -->
8854
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8855
+ <xsl:attribute name="height">
8856
+ <xsl:choose>
8857
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8858
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8859
+ </xsl:choose>
8860
+ </xsl:attribute>
8861
+ </xsl:template>
8862
+
8807
8863
  <!-- regex for 'display: inline-block;' -->
8808
8864
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8809
8865
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10890,7 +10946,9 @@
10890
10946
  </xsl:template> <!-- sections_element_style -->
10891
10947
 
10892
10948
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10893
- <fo:block break-after="page"/>
10949
+
10950
+ <fo:block break-after="page"/>
10951
+
10894
10952
  <fo:block>
10895
10953
  <xsl:call-template name="setId"/>
10896
10954
  <xsl:apply-templates/>
@@ -10957,7 +11015,7 @@
10957
11015
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10958
11016
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10959
11017
  </xsl:when>
10960
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11018
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10961
11019
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10962
11020
  </xsl:when>
10963
11021
  </xsl:choose>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.4.3".freeze
3
+ VERSION = "2.4.4".freeze
4
4
  end
5
5
  end
6
6
 
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.3
4
+ version: 2.4.4
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-03-04 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso