metanorma-csa 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: 9e4fa9ad31dfc822948fa0c41539cee42c88dcbc4d90aab489ea37075b2a25fd
4
- data.tar.gz: ea51d3c48d4301eb2fbb32bcc2d143a831c4bd01503016ff4a5c89633a94a05a
3
+ metadata.gz: 22d4bfa3220b5d6efd0a74f14bc170f7bc5c2bedfa74a4b983a7199221722bd0
4
+ data.tar.gz: 44e0c583faa3763e6cb12b246a67cbedacdf316e90fb670e56c203a2aad13ee5
5
5
  SHA512:
6
- metadata.gz: adf4a1a7e2bd08738e9d69dab199852d899438a6646b567662bc77d189647e4436dedc4a8f011b9a490ebc52017c41dcd398c89fd525f1e7d4458e63fbb96c39
7
- data.tar.gz: ed481d1008946eea02b468a40168e98f7f216ff864936f15dc2f85a68431ff11829770d42d34b8041308d4f837492ae4cf65a7293406d14dea1c4b09c35b962a
6
+ metadata.gz: 3c13778cd5fef2c2e7297a2f817cdf3d3fff5df5d070ce8b816000d90dd3587b928b634612a1166469984e0629e2c67abb14d594fef7211a7bfcd4bce0022567
7
+ data.tar.gz: b6754ebcd7ce19a17be4548857980f2fd672fdbcf73d65630f862f96003e130f9c9b75ddc89918f1094c82097da45ad7dd9a4325463abe3dca3e4608480f7e07
@@ -4811,7 +4811,8 @@
4811
4811
  </xsl:template>
4812
4812
 
4813
4813
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4814
- <xsl:variable name="text" select="normalize-space(.)"/>
4814
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
4815
+ <xsl:variable name="text" select="."/>
4815
4816
  <fo:inline font-size="75%" role="SKIP">
4816
4817
  <xsl:if test="string-length($text) &gt; 0">
4817
4818
  <xsl:variable name="smallCapsText">
@@ -6950,16 +6951,44 @@
6950
6951
  </xsl:choose>
6951
6952
 
6952
6953
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6953
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6954
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6954
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
6955
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
6956
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
6957
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
6958
+
6959
+ <!-- Example: -->
6955
6960
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6956
6961
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6957
6962
  <!-- effective height / width = 1.48, 1.4 - with title -->
6958
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6963
+
6964
+ <xsl:variable name="scale_x">
6965
+ <xsl:choose>
6966
+ <xsl:when test="$svg_width &gt; $width_effective_px">
6967
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
6968
+ </xsl:when>
6969
+ <xsl:otherwise>1</xsl:otherwise>
6970
+ </xsl:choose>
6971
+ </xsl:variable>
6972
+ <xsl:variable name="scale_y">
6973
+ <xsl:choose>
6974
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
6975
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
6976
+ </xsl:when>
6977
+ <xsl:otherwise>1</xsl:otherwise>
6978
+ </xsl:choose>
6979
+ </xsl:variable>
6980
+
6981
+ <!-- for images with big height -->
6982
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
6959
6983
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6960
6984
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6961
- </xsl:if>
6985
+ </xsl:if> -->
6962
6986
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6987
+
6988
+ <xsl:if test="$scale_y != 1">
6989
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
6990
+ </xsl:if>
6991
+
6963
6992
  <xsl:copy-of select="$svg_content"/>
6964
6993
  </fo:instream-foreign-object>
6965
6994
  <!-- </fo:block> -->
@@ -6997,8 +7026,12 @@
6997
7026
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6998
7027
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6999
7028
 
7029
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7030
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7031
+
7000
7032
  <xsl:attribute name="width">
7001
7033
  <xsl:choose>
7034
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7002
7035
  <xsl:when test="$width != ''">
7003
7036
  <xsl:value-of select="round($width)"/>
7004
7037
  </xsl:when>
@@ -7007,6 +7040,7 @@
7007
7040
  </xsl:attribute>
7008
7041
  <xsl:attribute name="height">
7009
7042
  <xsl:choose>
7043
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7010
7044
  <xsl:when test="$height != ''">
7011
7045
  <xsl:value-of select="round($height)"/>
7012
7046
  </xsl:when>
@@ -7018,6 +7052,28 @@
7018
7052
  </xsl:copy>
7019
7053
  </xsl:template>
7020
7054
 
7055
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7056
+ <!-- image[@width]/svg -->
7057
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7058
+ <xsl:attribute name="width">
7059
+ <xsl:choose>
7060
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7061
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7062
+ </xsl:choose>
7063
+ </xsl:attribute>
7064
+ </xsl:template>
7065
+
7066
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7067
+ <!-- image[@height]/svg -->
7068
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7069
+ <xsl:attribute name="height">
7070
+ <xsl:choose>
7071
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7072
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7073
+ </xsl:choose>
7074
+ </xsl:attribute>
7075
+ </xsl:template>
7076
+
7021
7077
  <!-- regex for 'display: inline-block;' -->
7022
7078
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7023
7079
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9088,7 +9144,9 @@
9088
9144
  </xsl:template> <!-- sections_element_style -->
9089
9145
 
9090
9146
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9091
- <fo:block break-after="page"/>
9147
+
9148
+ <fo:block break-after="page"/>
9149
+
9092
9150
  <fo:block>
9093
9151
  <xsl:call-template name="setId"/>
9094
9152
  <xsl:apply-templates/>
@@ -9155,7 +9213,7 @@
9155
9213
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9156
9214
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9157
9215
  </xsl:when>
9158
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9216
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9159
9217
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9160
9218
  </xsl:when>
9161
9219
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
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-csa
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