metanorma-ieee 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8b1f4904f4b2049efc0b0a1786712a872c4204531fffc6529f29613a263a3af
4
- data.tar.gz: 4d64adf5b036e464822e056ce7a05be31a67c9ea564b86ee42d32d3fafabadb3
3
+ metadata.gz: ab37b771354bffc19e7080b500920d2d06903584f58de70dd5c2f0ba2ad0ed65
4
+ data.tar.gz: e5d1cb8d760b5ef370bf8902fb22e09fd59423a6957af2f8ebb8cfab28cc875b
5
5
  SHA512:
6
- metadata.gz: 974fe9794e8b27cbd26f259e45ec7b652cec4c56ee716e6df6562c40acc3d747b8b5efd395d9e33602cbf5e94d8fa242e94e738e8b124d9c5fe69627d48a18de
7
- data.tar.gz: d7de6c724d06d8544b9e36c8f658f5d5f47194cf3767cffc5bb7e0b93abe51e90f8d964498fcd0de83d7560658632f96b7f051e0e0d9e836fed592b5073bfb33
6
+ metadata.gz: 246ea4c06c6ec1086b1d27b75cf1e9a877d804d5328205d6f0701db0a19afffef5cf8a2dc63d749138541cbba28c589acd8e2546ebe6a510360701dacf1acac8
7
+ data.tar.gz: f0bbae74c7dea1bf820cd1fa1aabd3cac46ea0985814c76d14e81b2ff6762749e3710bab4f75fe504f5a6d61746fc2fd62908bc6dcc90fefff75f0eb2141d8a3
@@ -8153,7 +8153,8 @@
8153
8153
  </xsl:template>
8154
8154
 
8155
8155
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8156
- <xsl:variable name="text" select="normalize-space(.)"/>
8156
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8157
+ <xsl:variable name="text" select="."/>
8157
8158
  <fo:inline font-size="75%" role="SKIP">
8158
8159
  <xsl:if test="string-length($text) &gt; 0">
8159
8160
  <xsl:variable name="smallCapsText">
@@ -10294,16 +10295,44 @@
10294
10295
  </xsl:choose>
10295
10296
 
10296
10297
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10297
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10298
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10298
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10299
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10300
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10301
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10302
+
10303
+ <!-- Example: -->
10299
10304
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10300
10305
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10301
10306
  <!-- effective height / width = 1.48, 1.4 - with title -->
10302
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10307
+
10308
+ <xsl:variable name="scale_x">
10309
+ <xsl:choose>
10310
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10311
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10312
+ </xsl:when>
10313
+ <xsl:otherwise>1</xsl:otherwise>
10314
+ </xsl:choose>
10315
+ </xsl:variable>
10316
+ <xsl:variable name="scale_y">
10317
+ <xsl:choose>
10318
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10319
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10320
+ </xsl:when>
10321
+ <xsl:otherwise>1</xsl:otherwise>
10322
+ </xsl:choose>
10323
+ </xsl:variable>
10324
+
10325
+ <!-- for images with big height -->
10326
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10303
10327
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10304
10328
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10305
- </xsl:if>
10329
+ </xsl:if> -->
10306
10330
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10331
+
10332
+ <xsl:if test="$scale_y != 1">
10333
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10334
+ </xsl:if>
10335
+
10307
10336
  <xsl:copy-of select="$svg_content"/>
10308
10337
  </fo:instream-foreign-object>
10309
10338
  <!-- </fo:block> -->
@@ -10341,8 +10370,12 @@
10341
10370
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10342
10371
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10343
10372
 
10373
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10374
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10375
+
10344
10376
  <xsl:attribute name="width">
10345
10377
  <xsl:choose>
10378
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10346
10379
  <xsl:when test="$width != ''">
10347
10380
  <xsl:value-of select="round($width)"/>
10348
10381
  </xsl:when>
@@ -10351,6 +10384,7 @@
10351
10384
  </xsl:attribute>
10352
10385
  <xsl:attribute name="height">
10353
10386
  <xsl:choose>
10387
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10354
10388
  <xsl:when test="$height != ''">
10355
10389
  <xsl:value-of select="round($height)"/>
10356
10390
  </xsl:when>
@@ -10362,6 +10396,28 @@
10362
10396
  </xsl:copy>
10363
10397
  </xsl:template>
10364
10398
 
10399
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10400
+ <!-- image[@width]/svg -->
10401
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10402
+ <xsl:attribute name="width">
10403
+ <xsl:choose>
10404
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10405
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10406
+ </xsl:choose>
10407
+ </xsl:attribute>
10408
+ </xsl:template>
10409
+
10410
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10411
+ <!-- image[@height]/svg -->
10412
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10413
+ <xsl:attribute name="height">
10414
+ <xsl:choose>
10415
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10416
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10417
+ </xsl:choose>
10418
+ </xsl:attribute>
10419
+ </xsl:template>
10420
+
10365
10421
  <!-- regex for 'display: inline-block;' -->
10366
10422
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10367
10423
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12425,7 +12481,9 @@
12425
12481
  </xsl:template> <!-- sections_element_style -->
12426
12482
 
12427
12483
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12428
- <fo:block break-after="page"/>
12484
+
12485
+ <fo:block break-after="page"/>
12486
+
12429
12487
  <fo:block>
12430
12488
  <xsl:call-template name="setId"/>
12431
12489
  <xsl:apply-templates/>
@@ -12492,7 +12550,7 @@
12492
12550
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12493
12551
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12494
12552
  </xsl:when>
12495
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12553
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12496
12554
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12497
12555
  </xsl:when>
12498
12556
  </xsl:choose>
@@ -8153,7 +8153,8 @@
8153
8153
  </xsl:template>
8154
8154
 
8155
8155
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8156
- <xsl:variable name="text" select="normalize-space(.)"/>
8156
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8157
+ <xsl:variable name="text" select="."/>
8157
8158
  <fo:inline font-size="75%" role="SKIP">
8158
8159
  <xsl:if test="string-length($text) &gt; 0">
8159
8160
  <xsl:variable name="smallCapsText">
@@ -10294,16 +10295,44 @@
10294
10295
  </xsl:choose>
10295
10296
 
10296
10297
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10297
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10298
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10298
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10299
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10300
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10301
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10302
+
10303
+ <!-- Example: -->
10299
10304
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10300
10305
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10301
10306
  <!-- effective height / width = 1.48, 1.4 - with title -->
10302
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10307
+
10308
+ <xsl:variable name="scale_x">
10309
+ <xsl:choose>
10310
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10311
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10312
+ </xsl:when>
10313
+ <xsl:otherwise>1</xsl:otherwise>
10314
+ </xsl:choose>
10315
+ </xsl:variable>
10316
+ <xsl:variable name="scale_y">
10317
+ <xsl:choose>
10318
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10319
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10320
+ </xsl:when>
10321
+ <xsl:otherwise>1</xsl:otherwise>
10322
+ </xsl:choose>
10323
+ </xsl:variable>
10324
+
10325
+ <!-- for images with big height -->
10326
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10303
10327
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10304
10328
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10305
- </xsl:if>
10329
+ </xsl:if> -->
10306
10330
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10331
+
10332
+ <xsl:if test="$scale_y != 1">
10333
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10334
+ </xsl:if>
10335
+
10307
10336
  <xsl:copy-of select="$svg_content"/>
10308
10337
  </fo:instream-foreign-object>
10309
10338
  <!-- </fo:block> -->
@@ -10341,8 +10370,12 @@
10341
10370
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10342
10371
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10343
10372
 
10373
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10374
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10375
+
10344
10376
  <xsl:attribute name="width">
10345
10377
  <xsl:choose>
10378
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10346
10379
  <xsl:when test="$width != ''">
10347
10380
  <xsl:value-of select="round($width)"/>
10348
10381
  </xsl:when>
@@ -10351,6 +10384,7 @@
10351
10384
  </xsl:attribute>
10352
10385
  <xsl:attribute name="height">
10353
10386
  <xsl:choose>
10387
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10354
10388
  <xsl:when test="$height != ''">
10355
10389
  <xsl:value-of select="round($height)"/>
10356
10390
  </xsl:when>
@@ -10362,6 +10396,28 @@
10362
10396
  </xsl:copy>
10363
10397
  </xsl:template>
10364
10398
 
10399
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10400
+ <!-- image[@width]/svg -->
10401
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10402
+ <xsl:attribute name="width">
10403
+ <xsl:choose>
10404
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10405
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10406
+ </xsl:choose>
10407
+ </xsl:attribute>
10408
+ </xsl:template>
10409
+
10410
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10411
+ <!-- image[@height]/svg -->
10412
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10413
+ <xsl:attribute name="height">
10414
+ <xsl:choose>
10415
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10416
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10417
+ </xsl:choose>
10418
+ </xsl:attribute>
10419
+ </xsl:template>
10420
+
10365
10421
  <!-- regex for 'display: inline-block;' -->
10366
10422
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10367
10423
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12425,7 +12481,9 @@
12425
12481
  </xsl:template> <!-- sections_element_style -->
12426
12482
 
12427
12483
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12428
- <fo:block break-after="page"/>
12484
+
12485
+ <fo:block break-after="page"/>
12486
+
12429
12487
  <fo:block>
12430
12488
  <xsl:call-template name="setId"/>
12431
12489
  <xsl:apply-templates/>
@@ -12492,7 +12550,7 @@
12492
12550
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12493
12551
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12494
12552
  </xsl:when>
12495
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12553
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12496
12554
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12497
12555
  </xsl:when>
12498
12556
  </xsl:choose>
@@ -131,7 +131,9 @@ module Metanorma
131
131
  xrefs = IsoDoc::IEEE::Xref
132
132
  .new(@lang, @script, klass, IsoDoc::IEEE::I18n.new(@lang, @script),
133
133
  { hierarchicalassets: @hierarchical_assets })
134
- xrefs.parse(Nokogiri::XML(xmldoc.to_xml))
134
+ # don't process refs without relaton-render init
135
+ xrefs.parse_inclusions(clauses: true, assets: true)
136
+ .parse(Nokogiri::XML(xmldoc.to_xml))
135
137
  xrefs
136
138
  end
137
139
 
@@ -160,8 +162,8 @@ module Metanorma
160
162
  # Style manual 17.2
161
163
  def figure_name_style_validate(docxml)
162
164
  docxml.xpath("//figure/name").each do |td|
163
- style_regex(/^(?<num>\p{Lower}\s*)/, "figure heading should be capitalised",
164
- td, td.text)
165
+ style_regex(/^(?<num>\p{Lower}\s*)/,
166
+ "figure heading should be capitalised", td, td.text)
165
167
  end
166
168
  end
167
169
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.2.4".freeze
3
+ VERSION = "1.2.5".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
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-standoc