metanorma-cc 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: 32bfaf3f86ecb540428f86505f79864dd157364fbeb6fccf10c181cbeb58b2be
4
- data.tar.gz: adfd87a733968a6a3f6433819f1e525673fe269195cc3796053b29f7d6e30ee8
3
+ metadata.gz: 02500ebd02ebe65c4c1a840c9a57022da0f064f3da738a801811746d04b18cbd
4
+ data.tar.gz: 52ecdef573a1d9e59d3a4ee98bb5de87149badb22e2836e9397b43e2ebdcaea4
5
5
  SHA512:
6
- metadata.gz: '098d32219289258a4427b7f0f0b86c66086b49a0346465dd05081216a8bf788a93781a03af337029759fe579e266b2c51ed7c54ea90a3840f158e8d93470079a'
7
- data.tar.gz: a1a92edfde8b3a32a187f3516c3092ff3527e459360aee45e9a4c82542bd16889434dea7c1015877f5de5565f9d8762f226895d43fe58af72896da12121f5bc4
6
+ metadata.gz: 0ec7d7f403145d1306fa3865c59fdaf8e1314b2e0d6abc1060b2a326b03b4703f05ad0aaa9cd0eba7528496c6e70d96f04065bf577f95d08e3272cee54cc431e
7
+ data.tar.gz: a7e0ee3a1dc9bf6ee378ad5ef6e3ebd372e2834f65c4a3ec3526c1fc569b8cc2015a78326f0bac59428247d18ee983a5652fe5818ba09bddeb8a460b51d7873c
@@ -4798,7 +4798,8 @@
4798
4798
  </xsl:template>
4799
4799
 
4800
4800
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4801
- <xsl:variable name="text" select="normalize-space(.)"/>
4801
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
4802
+ <xsl:variable name="text" select="."/>
4802
4803
  <fo:inline font-size="75%" role="SKIP">
4803
4804
  <xsl:if test="string-length($text) &gt; 0">
4804
4805
  <xsl:variable name="smallCapsText">
@@ -6933,16 +6934,44 @@
6933
6934
  </xsl:choose>
6934
6935
 
6935
6936
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6936
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6937
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6937
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
6938
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
6939
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
6940
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
6941
+
6942
+ <!-- Example: -->
6938
6943
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6939
6944
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6940
6945
  <!-- effective height / width = 1.48, 1.4 - with title -->
6941
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6946
+
6947
+ <xsl:variable name="scale_x">
6948
+ <xsl:choose>
6949
+ <xsl:when test="$svg_width &gt; $width_effective_px">
6950
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
6951
+ </xsl:when>
6952
+ <xsl:otherwise>1</xsl:otherwise>
6953
+ </xsl:choose>
6954
+ </xsl:variable>
6955
+ <xsl:variable name="scale_y">
6956
+ <xsl:choose>
6957
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
6958
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
6959
+ </xsl:when>
6960
+ <xsl:otherwise>1</xsl:otherwise>
6961
+ </xsl:choose>
6962
+ </xsl:variable>
6963
+
6964
+ <!-- for images with big height -->
6965
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
6942
6966
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6943
6967
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6944
- </xsl:if>
6968
+ </xsl:if> -->
6945
6969
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6970
+
6971
+ <xsl:if test="$scale_y != 1">
6972
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
6973
+ </xsl:if>
6974
+
6946
6975
  <xsl:copy-of select="$svg_content"/>
6947
6976
  </fo:instream-foreign-object>
6948
6977
  <!-- </fo:block> -->
@@ -6980,8 +7009,12 @@
6980
7009
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6981
7010
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6982
7011
 
7012
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7013
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7014
+
6983
7015
  <xsl:attribute name="width">
6984
7016
  <xsl:choose>
7017
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
6985
7018
  <xsl:when test="$width != ''">
6986
7019
  <xsl:value-of select="round($width)"/>
6987
7020
  </xsl:when>
@@ -6990,6 +7023,7 @@
6990
7023
  </xsl:attribute>
6991
7024
  <xsl:attribute name="height">
6992
7025
  <xsl:choose>
7026
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
6993
7027
  <xsl:when test="$height != ''">
6994
7028
  <xsl:value-of select="round($height)"/>
6995
7029
  </xsl:when>
@@ -7001,6 +7035,28 @@
7001
7035
  </xsl:copy>
7002
7036
  </xsl:template>
7003
7037
 
7038
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7039
+ <!-- image[@width]/svg -->
7040
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7041
+ <xsl:attribute name="width">
7042
+ <xsl:choose>
7043
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7044
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7045
+ </xsl:choose>
7046
+ </xsl:attribute>
7047
+ </xsl:template>
7048
+
7049
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7050
+ <!-- image[@height]/svg -->
7051
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7052
+ <xsl:attribute name="height">
7053
+ <xsl:choose>
7054
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7055
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7056
+ </xsl:choose>
7057
+ </xsl:attribute>
7058
+ </xsl:template>
7059
+
7004
7060
  <!-- regex for 'display: inline-block;' -->
7005
7061
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7006
7062
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9079,7 +9135,9 @@
9079
9135
  </xsl:template> <!-- sections_element_style -->
9080
9136
 
9081
9137
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9082
- <fo:block break-after="page"/>
9138
+
9139
+ <fo:block break-after="page"/>
9140
+
9083
9141
  <fo:block>
9084
9142
  <xsl:call-template name="setId"/>
9085
9143
  <xsl:apply-templates/>
@@ -9146,7 +9204,7 @@
9146
9204
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9147
9205
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9148
9206
  </xsl:when>
9149
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9207
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9150
9208
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9151
9209
  </xsl:when>
9152
9210
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.4.3".freeze
3
+ VERSION = "2.4.4".freeze
4
4
  end
5
5
  end
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.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
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-generic