metanorma-iho 0.9.3 → 0.9.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: 6f23932cc917c41bf9680cf9e300d37ea48db54c2bebb8f489b6fca2630836f5
4
- data.tar.gz: dad38711590324bb7f1c9accfeeb34b9c6aafbddad5464ccf44b9e9111dd9589
3
+ metadata.gz: cb6946f10c3caf2a5be78ad05de574a12f0631def9348c00a3bffc91227b59e2
4
+ data.tar.gz: 7b43557687b137ab71d9e2694c620c3925b45b0e83bebd2f7e60573df3bdfaf6
5
5
  SHA512:
6
- metadata.gz: 81026b6867354a0a96005f3a79f6b298abb37d0bee2ba2c8a4871d183cca50c743b23ae00500757024e33e70e9f1094fc81772956c1f78b5723c6aff778b52b2
7
- data.tar.gz: c96d8655a05f751d5475fcd622f6bdc1230a2ef579cac08790aa0218100ab404e3df196b80f97ae56a0012e8b07fa0a4b5a43aaa4b2831967b4b7e34edea28e4
6
+ metadata.gz: c6d684c1dc5de2a59f50f297f5865e25b3cfaaf7b4241396ef030d188aafa4ea3c5a1f5ad7e8cbf2a7f72f673091caea18d01101925ba7e1486be3d70c852b28
7
+ data.tar.gz: 7340cdc0e5f4cd5edac28ca4864f7f6bd7acd07441ecc5723f710eea3a66cb10882a547903f77a195232bee26810e7907ec82b4f790e227b7414ac477f7458e7
@@ -5113,7 +5113,8 @@
5113
5113
  </xsl:template>
5114
5114
 
5115
5115
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5116
- <xsl:variable name="text" select="normalize-space(.)"/>
5116
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5117
+ <xsl:variable name="text" select="."/>
5117
5118
  <fo:inline font-size="75%" role="SKIP">
5118
5119
  <xsl:if test="string-length($text) &gt; 0">
5119
5120
  <xsl:variable name="smallCapsText">
@@ -7321,16 +7322,44 @@
7321
7322
  </xsl:choose>
7322
7323
 
7323
7324
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7324
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7325
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7325
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7326
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7327
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7328
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7329
+
7330
+ <!-- Example: -->
7326
7331
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7327
7332
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7328
7333
  <!-- effective height / width = 1.48, 1.4 - with title -->
7329
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7334
+
7335
+ <xsl:variable name="scale_x">
7336
+ <xsl:choose>
7337
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7338
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7339
+ </xsl:when>
7340
+ <xsl:otherwise>1</xsl:otherwise>
7341
+ </xsl:choose>
7342
+ </xsl:variable>
7343
+ <xsl:variable name="scale_y">
7344
+ <xsl:choose>
7345
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7346
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7347
+ </xsl:when>
7348
+ <xsl:otherwise>1</xsl:otherwise>
7349
+ </xsl:choose>
7350
+ </xsl:variable>
7351
+
7352
+ <!-- for images with big height -->
7353
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7330
7354
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7331
7355
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7332
- </xsl:if>
7356
+ </xsl:if> -->
7333
7357
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7358
+
7359
+ <xsl:if test="$scale_y != 1">
7360
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7361
+ </xsl:if>
7362
+
7334
7363
  <xsl:copy-of select="$svg_content"/>
7335
7364
  </fo:instream-foreign-object>
7336
7365
  <!-- </fo:block> -->
@@ -7368,8 +7397,12 @@
7368
7397
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7369
7398
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7370
7399
 
7400
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7401
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7402
+
7371
7403
  <xsl:attribute name="width">
7372
7404
  <xsl:choose>
7405
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7373
7406
  <xsl:when test="$width != ''">
7374
7407
  <xsl:value-of select="round($width)"/>
7375
7408
  </xsl:when>
@@ -7378,6 +7411,7 @@
7378
7411
  </xsl:attribute>
7379
7412
  <xsl:attribute name="height">
7380
7413
  <xsl:choose>
7414
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7381
7415
  <xsl:when test="$height != ''">
7382
7416
  <xsl:value-of select="round($height)"/>
7383
7417
  </xsl:when>
@@ -7389,6 +7423,28 @@
7389
7423
  </xsl:copy>
7390
7424
  </xsl:template>
7391
7425
 
7426
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7427
+ <!-- image[@width]/svg -->
7428
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7429
+ <xsl:attribute name="width">
7430
+ <xsl:choose>
7431
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7432
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7433
+ </xsl:choose>
7434
+ </xsl:attribute>
7435
+ </xsl:template>
7436
+
7437
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7438
+ <!-- image[@height]/svg -->
7439
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7440
+ <xsl:attribute name="height">
7441
+ <xsl:choose>
7442
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7443
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7444
+ </xsl:choose>
7445
+ </xsl:attribute>
7446
+ </xsl:template>
7447
+
7392
7448
  <!-- regex for 'display: inline-block;' -->
7393
7449
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7394
7450
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9455,7 +9511,9 @@
9455
9511
  </xsl:template> <!-- sections_element_style -->
9456
9512
 
9457
9513
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9458
- <fo:block break-after="page"/>
9514
+
9515
+ <fo:block break-after="page"/>
9516
+
9459
9517
  <fo:block>
9460
9518
  <xsl:call-template name="setId"/>
9461
9519
  <xsl:apply-templates/>
@@ -9522,7 +9580,7 @@
9522
9580
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9523
9581
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9524
9582
  </xsl:when>
9525
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9583
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9526
9584
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9527
9585
  </xsl:when>
9528
9586
  </xsl:choose>
@@ -5113,7 +5113,8 @@
5113
5113
  </xsl:template>
5114
5114
 
5115
5115
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5116
- <xsl:variable name="text" select="normalize-space(.)"/>
5116
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5117
+ <xsl:variable name="text" select="."/>
5117
5118
  <fo:inline font-size="75%" role="SKIP">
5118
5119
  <xsl:if test="string-length($text) &gt; 0">
5119
5120
  <xsl:variable name="smallCapsText">
@@ -7321,16 +7322,44 @@
7321
7322
  </xsl:choose>
7322
7323
 
7323
7324
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7324
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7325
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7325
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7326
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7327
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7328
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7329
+
7330
+ <!-- Example: -->
7326
7331
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7327
7332
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7328
7333
  <!-- effective height / width = 1.48, 1.4 - with title -->
7329
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7334
+
7335
+ <xsl:variable name="scale_x">
7336
+ <xsl:choose>
7337
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7338
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7339
+ </xsl:when>
7340
+ <xsl:otherwise>1</xsl:otherwise>
7341
+ </xsl:choose>
7342
+ </xsl:variable>
7343
+ <xsl:variable name="scale_y">
7344
+ <xsl:choose>
7345
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7346
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7347
+ </xsl:when>
7348
+ <xsl:otherwise>1</xsl:otherwise>
7349
+ </xsl:choose>
7350
+ </xsl:variable>
7351
+
7352
+ <!-- for images with big height -->
7353
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7330
7354
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7331
7355
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7332
- </xsl:if>
7356
+ </xsl:if> -->
7333
7357
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7358
+
7359
+ <xsl:if test="$scale_y != 1">
7360
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7361
+ </xsl:if>
7362
+
7334
7363
  <xsl:copy-of select="$svg_content"/>
7335
7364
  </fo:instream-foreign-object>
7336
7365
  <!-- </fo:block> -->
@@ -7368,8 +7397,12 @@
7368
7397
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7369
7398
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7370
7399
 
7400
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7401
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7402
+
7371
7403
  <xsl:attribute name="width">
7372
7404
  <xsl:choose>
7405
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7373
7406
  <xsl:when test="$width != ''">
7374
7407
  <xsl:value-of select="round($width)"/>
7375
7408
  </xsl:when>
@@ -7378,6 +7411,7 @@
7378
7411
  </xsl:attribute>
7379
7412
  <xsl:attribute name="height">
7380
7413
  <xsl:choose>
7414
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7381
7415
  <xsl:when test="$height != ''">
7382
7416
  <xsl:value-of select="round($height)"/>
7383
7417
  </xsl:when>
@@ -7389,6 +7423,28 @@
7389
7423
  </xsl:copy>
7390
7424
  </xsl:template>
7391
7425
 
7426
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7427
+ <!-- image[@width]/svg -->
7428
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7429
+ <xsl:attribute name="width">
7430
+ <xsl:choose>
7431
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7432
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7433
+ </xsl:choose>
7434
+ </xsl:attribute>
7435
+ </xsl:template>
7436
+
7437
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7438
+ <!-- image[@height]/svg -->
7439
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7440
+ <xsl:attribute name="height">
7441
+ <xsl:choose>
7442
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7443
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7444
+ </xsl:choose>
7445
+ </xsl:attribute>
7446
+ </xsl:template>
7447
+
7392
7448
  <!-- regex for 'display: inline-block;' -->
7393
7449
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7394
7450
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9455,7 +9511,9 @@
9455
9511
  </xsl:template> <!-- sections_element_style -->
9456
9512
 
9457
9513
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9458
- <fo:block break-after="page"/>
9514
+
9515
+ <fo:block break-after="page"/>
9516
+
9459
9517
  <fo:block>
9460
9518
  <xsl:call-template name="setId"/>
9461
9519
  <xsl:apply-templates/>
@@ -9522,7 +9580,7 @@
9522
9580
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9523
9581
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9524
9582
  </xsl:when>
9525
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9583
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9526
9584
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9527
9585
  </xsl:when>
9528
9586
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.9.3".freeze
3
+ VERSION = "0.9.4".freeze
4
4
  end
5
5
  end
@@ -11,11 +11,7 @@ module Relaton
11
11
  end
12
12
 
13
13
  def klass_initialize(_options)
14
- @nametemplateklass = Relaton::Render::Template::Name
15
- @seriestemplateklass = Relaton::Render::Template::Series
16
- @extenttemplateklass = Relaton::Render::Template::Extent
17
- @sizetemplateklass = Relaton::Render::Template::Size
18
- @generaltemplateklass = Relaton::Render::Template::General
14
+ super
19
15
  @fieldsklass = Relaton::Render::IHO::Fields
20
16
  @parseklass = Relaton::Render::IHO::Parse
21
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.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