metanorma-jis 0.2.3 → 0.2.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: a064f0e798e321317671b5e491d584734b5c6348cce7a3b4724a6bc1f71460bf
4
- data.tar.gz: d7f98949f0e67fa152423525138a0c203e544c102160c25b4852ddeee8dfde31
3
+ metadata.gz: c8dc64b7e2524636baafacbeb79db166d0de7fe32390f6863c2b424b43d6a236
4
+ data.tar.gz: b81a5ab243c3cde8b604a0481f17875d8931c9af92a8bdd8303a8a405e409c62
5
5
  SHA512:
6
- metadata.gz: 47436176727b7d79fcf56ef5dae063d8235f4e238cee743b88f0da622f0babbe9dfc5d7c1b477f919c23990b0e75f4bd27f98a07dd7903e4aa11122acdcf7be5
7
- data.tar.gz: 30fd069624c832d3527736d35f56d8f0ff52225579121f299f91d54b106b8584c2483d98ecac608583cd74323798fbbf6f2a60d9cdf89ec470d4943758ab7743
6
+ metadata.gz: 320ca25a90e1fe5df1f2ff17c8dee46ad4a8a9ac3b9756e07cf149a5ba16ab842fafcae3f19a12bc550235dfa589950841ba3e742e48bd844e84dfe898446927
7
+ data.tar.gz: 470d48f3536cf937d52a57cacf7890fff1d29aeb52f9c21581a38ef8019268fc71e8f51f1fe0913f393a3599eb4c4c8935b7d7b7366c50cadad72d1787c3c2cf
@@ -5858,7 +5858,8 @@
5858
5858
  </xsl:template>
5859
5859
 
5860
5860
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5861
- <xsl:variable name="text" select="normalize-space(.)"/>
5861
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5862
+ <xsl:variable name="text" select="."/>
5862
5863
  <fo:inline font-size="75%" role="SKIP">
5863
5864
  <xsl:if test="string-length($text) &gt; 0">
5864
5865
  <xsl:variable name="smallCapsText">
@@ -7992,16 +7993,44 @@
7992
7993
  </xsl:choose>
7993
7994
 
7994
7995
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7995
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7996
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7996
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7997
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7998
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7999
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8000
+
8001
+ <!-- Example: -->
7997
8002
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7998
8003
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7999
8004
  <!-- effective height / width = 1.48, 1.4 - with title -->
8000
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8005
+
8006
+ <xsl:variable name="scale_x">
8007
+ <xsl:choose>
8008
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8009
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8010
+ </xsl:when>
8011
+ <xsl:otherwise>1</xsl:otherwise>
8012
+ </xsl:choose>
8013
+ </xsl:variable>
8014
+ <xsl:variable name="scale_y">
8015
+ <xsl:choose>
8016
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8017
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8018
+ </xsl:when>
8019
+ <xsl:otherwise>1</xsl:otherwise>
8020
+ </xsl:choose>
8021
+ </xsl:variable>
8022
+
8023
+ <!-- for images with big height -->
8024
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8001
8025
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8002
8026
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8003
- </xsl:if>
8027
+ </xsl:if> -->
8004
8028
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8029
+
8030
+ <xsl:if test="$scale_y != 1">
8031
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8032
+ </xsl:if>
8033
+
8005
8034
  <xsl:copy-of select="$svg_content"/>
8006
8035
  </fo:instream-foreign-object>
8007
8036
  <!-- </fo:block> -->
@@ -8039,8 +8068,12 @@
8039
8068
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8040
8069
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8041
8070
 
8071
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8072
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8073
+
8042
8074
  <xsl:attribute name="width">
8043
8075
  <xsl:choose>
8076
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8044
8077
  <xsl:when test="$width != ''">
8045
8078
  <xsl:value-of select="round($width)"/>
8046
8079
  </xsl:when>
@@ -8049,6 +8082,7 @@
8049
8082
  </xsl:attribute>
8050
8083
  <xsl:attribute name="height">
8051
8084
  <xsl:choose>
8085
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8052
8086
  <xsl:when test="$height != ''">
8053
8087
  <xsl:value-of select="round($height)"/>
8054
8088
  </xsl:when>
@@ -8060,6 +8094,28 @@
8060
8094
  </xsl:copy>
8061
8095
  </xsl:template>
8062
8096
 
8097
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8098
+ <!-- image[@width]/svg -->
8099
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8100
+ <xsl:attribute name="width">
8101
+ <xsl:choose>
8102
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8103
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8104
+ </xsl:choose>
8105
+ </xsl:attribute>
8106
+ </xsl:template>
8107
+
8108
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8109
+ <!-- image[@height]/svg -->
8110
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8111
+ <xsl:attribute name="height">
8112
+ <xsl:choose>
8113
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8114
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8115
+ </xsl:choose>
8116
+ </xsl:attribute>
8117
+ </xsl:template>
8118
+
8063
8119
  <!-- regex for 'display: inline-block;' -->
8064
8120
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8065
8121
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10121,7 +10177,9 @@
10121
10177
  </xsl:template> <!-- sections_element_style -->
10122
10178
 
10123
10179
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10124
- <fo:block break-after="page"/>
10180
+
10181
+ <fo:block break-after="page"/>
10182
+
10125
10183
  <fo:block>
10126
10184
  <xsl:call-template name="setId"/>
10127
10185
  <xsl:apply-templates/>
@@ -10188,7 +10246,7 @@
10188
10246
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10189
10247
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10190
10248
  </xsl:when>
10191
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10249
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10192
10250
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10193
10251
  </xsl:when>
10194
10252
  </xsl:choose>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.2.3".freeze
3
+ VERSION = "0.2.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-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.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: japanese_calendar