metanorma-ieee 1.2.3 → 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: 90d330287ff84b473fc19ddd7e820b60973e520789c53e7100c9a50650310515
4
- data.tar.gz: '0181ffc0475563ff448ba6cd557073932941cb4b7b2bfe0359673b582a63bd58'
3
+ metadata.gz: ab37b771354bffc19e7080b500920d2d06903584f58de70dd5c2f0ba2ad0ed65
4
+ data.tar.gz: e5d1cb8d760b5ef370bf8902fb22e09fd59423a6957af2f8ebb8cfab28cc875b
5
5
  SHA512:
6
- metadata.gz: 9db9b5c3460c575231a344b5dd657f2440164c6d03f424073ded04f1382e7a3193ee447d55e7146f56cdcc4c3c5c456bd9f09c854a59be7f7d12b0bbf3778576
7
- data.tar.gz: 1870478859699a333f013f25e7abf3286ddd837a9fb3f3b8bedf4b85c1be7cc170b3e44590778f20bcd1c2ee3358555d9ceee2bee5dd1753b557ca001bca3bca
6
+ metadata.gz: 246ea4c06c6ec1086b1d27b75cf1e9a877d804d5328205d6f0701db0a19afffef5cf8a2dc63d749138541cbba28c589acd8e2546ebe6a510360701dacf1acac8
7
+ data.tar.gz: f0bbae74c7dea1bf820cd1fa1aabd3cac46ea0985814c76d14e81b2ff6762749e3710bab4f75fe504f5a6d61746fc2fd62908bc6dcc90fefff75f0eb2141d8a3
@@ -3804,6 +3804,8 @@
3804
3804
  <xsl:param name="svg_images"/> <!-- svg images array -->
3805
3805
  <xsl:variable name="images" select="document($svg_images)"/>
3806
3806
  <xsl:param name="basepath"/> <!-- base path for images -->
3807
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
3808
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
3807
3809
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
3808
3810
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
3809
3811
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -3856,6 +3858,20 @@
3856
3858
  <xsl:call-template name="getLang"/>
3857
3859
  </xsl:variable>
3858
3860
 
3861
+ <xsl:variable name="inputxml_filename_prefix">
3862
+ <xsl:choose>
3863
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
3864
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
3865
+ </xsl:when>
3866
+ <xsl:when test="contains($inputxml_filename, '.xml')">
3867
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
3868
+ </xsl:when>
3869
+ <xsl:otherwise>
3870
+ <xsl:value-of select="$inputxml_filename"/>
3871
+ </xsl:otherwise>
3872
+ </xsl:choose>
3873
+ </xsl:variable>
3874
+
3859
3875
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
3860
3876
  You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
3861
3877
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
@@ -4826,6 +4842,10 @@
4826
4842
 
4827
4843
  </xsl:attribute-set>
4828
4844
 
4845
+ <xsl:template name="refine_figure-block-style">
4846
+
4847
+ </xsl:template>
4848
+
4829
4849
  <xsl:attribute-set name="figure-style">
4830
4850
 
4831
4851
  </xsl:attribute-set>
@@ -5755,7 +5775,7 @@
5755
5775
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
5756
5776
 
5757
5777
  <xsl:variable name="colwidths">
5758
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
5778
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
5759
5779
  <xsl:call-template name="calculate-column-widths">
5760
5780
  <xsl:with-param name="cols-count" select="$cols-count"/>
5761
5781
  <xsl:with-param name="table" select="$simple-table"/>
@@ -5874,6 +5894,11 @@
5874
5894
  <fo:table-column column-width="{@width}"/>
5875
5895
  </xsl:for-each>
5876
5896
  </xsl:when>
5897
+ <xsl:when test="@class = 'dl'">
5898
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
5899
+ <fo:table-column column-width="{@width}"/>
5900
+ </xsl:for-each>
5901
+ </xsl:when>
5877
5902
  <xsl:otherwise>
5878
5903
  <xsl:call-template name="insertTableColumnWidth">
5879
5904
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7175,6 +7200,7 @@
7175
7200
  <!-- ===================== -->
7176
7201
  <!-- Definition List -->
7177
7202
  <!-- ===================== -->
7203
+
7178
7204
  <xsl:template match="*[local-name()='dl']">
7179
7205
  <xsl:variable name="isAdded" select="@added"/>
7180
7206
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -7387,10 +7413,21 @@
7387
7413
  </xsl:variable>
7388
7414
 
7389
7415
  <xsl:variable name="colwidths">
7390
- <xsl:call-template name="calculate-column-widths">
7391
- <xsl:with-param name="cols-count" select="2"/>
7392
- <xsl:with-param name="table" select="$simple-table"/>
7393
- </xsl:call-template>
7416
+ <xsl:choose>
7417
+ <!-- dl from table[@class='dl'] -->
7418
+ <xsl:when test="*[local-name() = 'colgroup']">
7419
+ <autolayout/>
7420
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
7421
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
7422
+ </xsl:for-each>
7423
+ </xsl:when>
7424
+ <xsl:otherwise>
7425
+ <xsl:call-template name="calculate-column-widths">
7426
+ <xsl:with-param name="cols-count" select="2"/>
7427
+ <xsl:with-param name="table" select="$simple-table"/>
7428
+ </xsl:call-template>
7429
+ </xsl:otherwise>
7430
+ </xsl:choose>
7394
7431
  </xsl:variable>
7395
7432
 
7396
7433
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -8116,7 +8153,8 @@
8116
8153
  </xsl:template>
8117
8154
 
8118
8155
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8119
- <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="."/>
8120
8158
  <fo:inline font-size="75%" role="SKIP">
8121
8159
  <xsl:if test="string-length($text) &gt; 0">
8122
8160
  <xsl:variable name="smallCapsText">
@@ -9486,6 +9524,12 @@
9486
9524
  <xsl:when test="@updatetype = 'true'">
9487
9525
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
9488
9526
  </xsl:when>
9527
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
9528
+ <!-- link to the PDF attachment -->
9529
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
9530
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
9531
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
9532
+ </xsl:when>
9489
9533
  <xsl:otherwise>
9490
9534
  <xsl:value-of select="normalize-space(@target)"/>
9491
9535
  </xsl:otherwise>
@@ -9895,6 +9939,7 @@
9895
9939
  <xsl:variable name="isAdded" select="@added"/>
9896
9940
  <xsl:variable name="isDeleted" select="@deleted"/>
9897
9941
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
9942
+ <xsl:call-template name="refine_figure-block-style"/>
9898
9943
 
9899
9944
  <xsl:call-template name="setTrackChangesStyles">
9900
9945
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -10250,16 +10295,44 @@
10250
10295
  </xsl:choose>
10251
10296
 
10252
10297
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10253
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10254
- <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: -->
10255
10304
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10256
10305
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10257
10306
  <!-- effective height / width = 1.48, 1.4 - with title -->
10258
- <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)">
10259
10327
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10260
10328
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10261
- </xsl:if>
10329
+ </xsl:if> -->
10262
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
+
10263
10336
  <xsl:copy-of select="$svg_content"/>
10264
10337
  </fo:instream-foreign-object>
10265
10338
  <!-- </fo:block> -->
@@ -10297,8 +10370,12 @@
10297
10370
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10298
10371
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10299
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
+
10300
10376
  <xsl:attribute name="width">
10301
10377
  <xsl:choose>
10378
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10302
10379
  <xsl:when test="$width != ''">
10303
10380
  <xsl:value-of select="round($width)"/>
10304
10381
  </xsl:when>
@@ -10307,6 +10384,7 @@
10307
10384
  </xsl:attribute>
10308
10385
  <xsl:attribute name="height">
10309
10386
  <xsl:choose>
10387
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10310
10388
  <xsl:when test="$height != ''">
10311
10389
  <xsl:value-of select="round($height)"/>
10312
10390
  </xsl:when>
@@ -10318,6 +10396,28 @@
10318
10396
  </xsl:copy>
10319
10397
  </xsl:template>
10320
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
+
10321
10421
  <!-- regex for 'display: inline-block;' -->
10322
10422
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10323
10423
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12381,7 +12481,9 @@
12381
12481
  </xsl:template> <!-- sections_element_style -->
12382
12482
 
12383
12483
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12384
- <fo:block break-after="page"/>
12484
+
12485
+ <fo:block break-after="page"/>
12486
+
12385
12487
  <fo:block>
12386
12488
  <xsl:call-template name="setId"/>
12387
12489
  <xsl:apply-templates/>
@@ -12448,7 +12550,7 @@
12448
12550
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12449
12551
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12450
12552
  </xsl:when>
12451
- <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])">
12452
12554
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12453
12555
  </xsl:when>
12454
12556
  </xsl:choose>
@@ -14408,10 +14510,10 @@
14408
14510
 
14409
14511
  <xsl:template name="addPDFUAmeta">
14410
14512
  <pdf:catalog>
14411
- <pdf:dictionary type="normal" key="ViewerPreferences">
14412
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14413
- </pdf:dictionary>
14414
- </pdf:catalog>
14513
+ <pdf:dictionary type="normal" key="ViewerPreferences">
14514
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14515
+ </pdf:dictionary>
14516
+ </pdf:catalog>
14415
14517
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14416
14518
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14417
14519
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
@@ -14461,6 +14563,19 @@
14461
14563
  </rdf:Description>
14462
14564
  </rdf:RDF>
14463
14565
  </x:xmpmeta>
14566
+ <!-- add attachments -->
14567
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14568
+ <xsl:choose>
14569
+ <xsl:when test="normalize-space() != ''">
14570
+ <pdf:embedded-file src="{.}" filename="{@name}"/>
14571
+ </xsl:when>
14572
+ <xsl:otherwise>
14573
+ <!-- _{filename}_attachments -->
14574
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14575
+ <pdf:embedded-file src="{$url}" filename="{@name}"/>
14576
+ </xsl:otherwise>
14577
+ </xsl:choose>
14578
+ </xsl:for-each>
14464
14579
  </xsl:template> <!-- addPDFUAmeta -->
14465
14580
 
14466
14581
  <xsl:template name="getId">
@@ -3804,6 +3804,8 @@
3804
3804
  <xsl:param name="svg_images"/> <!-- svg images array -->
3805
3805
  <xsl:variable name="images" select="document($svg_images)"/>
3806
3806
  <xsl:param name="basepath"/> <!-- base path for images -->
3807
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
3808
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
3807
3809
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
3808
3810
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
3809
3811
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -3856,6 +3858,20 @@
3856
3858
  <xsl:call-template name="getLang"/>
3857
3859
  </xsl:variable>
3858
3860
 
3861
+ <xsl:variable name="inputxml_filename_prefix">
3862
+ <xsl:choose>
3863
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
3864
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
3865
+ </xsl:when>
3866
+ <xsl:when test="contains($inputxml_filename, '.xml')">
3867
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
3868
+ </xsl:when>
3869
+ <xsl:otherwise>
3870
+ <xsl:value-of select="$inputxml_filename"/>
3871
+ </xsl:otherwise>
3872
+ </xsl:choose>
3873
+ </xsl:variable>
3874
+
3859
3875
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
3860
3876
  You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
3861
3877
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
@@ -4826,6 +4842,10 @@
4826
4842
 
4827
4843
  </xsl:attribute-set>
4828
4844
 
4845
+ <xsl:template name="refine_figure-block-style">
4846
+
4847
+ </xsl:template>
4848
+
4829
4849
  <xsl:attribute-set name="figure-style">
4830
4850
 
4831
4851
  </xsl:attribute-set>
@@ -5755,7 +5775,7 @@
5755
5775
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
5756
5776
 
5757
5777
  <xsl:variable name="colwidths">
5758
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
5778
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
5759
5779
  <xsl:call-template name="calculate-column-widths">
5760
5780
  <xsl:with-param name="cols-count" select="$cols-count"/>
5761
5781
  <xsl:with-param name="table" select="$simple-table"/>
@@ -5874,6 +5894,11 @@
5874
5894
  <fo:table-column column-width="{@width}"/>
5875
5895
  </xsl:for-each>
5876
5896
  </xsl:when>
5897
+ <xsl:when test="@class = 'dl'">
5898
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
5899
+ <fo:table-column column-width="{@width}"/>
5900
+ </xsl:for-each>
5901
+ </xsl:when>
5877
5902
  <xsl:otherwise>
5878
5903
  <xsl:call-template name="insertTableColumnWidth">
5879
5904
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7175,6 +7200,7 @@
7175
7200
  <!-- ===================== -->
7176
7201
  <!-- Definition List -->
7177
7202
  <!-- ===================== -->
7203
+
7178
7204
  <xsl:template match="*[local-name()='dl']">
7179
7205
  <xsl:variable name="isAdded" select="@added"/>
7180
7206
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -7387,10 +7413,21 @@
7387
7413
  </xsl:variable>
7388
7414
 
7389
7415
  <xsl:variable name="colwidths">
7390
- <xsl:call-template name="calculate-column-widths">
7391
- <xsl:with-param name="cols-count" select="2"/>
7392
- <xsl:with-param name="table" select="$simple-table"/>
7393
- </xsl:call-template>
7416
+ <xsl:choose>
7417
+ <!-- dl from table[@class='dl'] -->
7418
+ <xsl:when test="*[local-name() = 'colgroup']">
7419
+ <autolayout/>
7420
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
7421
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
7422
+ </xsl:for-each>
7423
+ </xsl:when>
7424
+ <xsl:otherwise>
7425
+ <xsl:call-template name="calculate-column-widths">
7426
+ <xsl:with-param name="cols-count" select="2"/>
7427
+ <xsl:with-param name="table" select="$simple-table"/>
7428
+ </xsl:call-template>
7429
+ </xsl:otherwise>
7430
+ </xsl:choose>
7394
7431
  </xsl:variable>
7395
7432
 
7396
7433
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -8116,7 +8153,8 @@
8116
8153
  </xsl:template>
8117
8154
 
8118
8155
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8119
- <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="."/>
8120
8158
  <fo:inline font-size="75%" role="SKIP">
8121
8159
  <xsl:if test="string-length($text) &gt; 0">
8122
8160
  <xsl:variable name="smallCapsText">
@@ -9486,6 +9524,12 @@
9486
9524
  <xsl:when test="@updatetype = 'true'">
9487
9525
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
9488
9526
  </xsl:when>
9527
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
9528
+ <!-- link to the PDF attachment -->
9529
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
9530
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
9531
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
9532
+ </xsl:when>
9489
9533
  <xsl:otherwise>
9490
9534
  <xsl:value-of select="normalize-space(@target)"/>
9491
9535
  </xsl:otherwise>
@@ -9895,6 +9939,7 @@
9895
9939
  <xsl:variable name="isAdded" select="@added"/>
9896
9940
  <xsl:variable name="isDeleted" select="@deleted"/>
9897
9941
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
9942
+ <xsl:call-template name="refine_figure-block-style"/>
9898
9943
 
9899
9944
  <xsl:call-template name="setTrackChangesStyles">
9900
9945
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -10250,16 +10295,44 @@
10250
10295
  </xsl:choose>
10251
10296
 
10252
10297
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10253
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10254
- <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: -->
10255
10304
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10256
10305
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10257
10306
  <!-- effective height / width = 1.48, 1.4 - with title -->
10258
- <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)">
10259
10327
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10260
10328
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10261
- </xsl:if>
10329
+ </xsl:if> -->
10262
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
+
10263
10336
  <xsl:copy-of select="$svg_content"/>
10264
10337
  </fo:instream-foreign-object>
10265
10338
  <!-- </fo:block> -->
@@ -10297,8 +10370,12 @@
10297
10370
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10298
10371
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10299
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
+
10300
10376
  <xsl:attribute name="width">
10301
10377
  <xsl:choose>
10378
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10302
10379
  <xsl:when test="$width != ''">
10303
10380
  <xsl:value-of select="round($width)"/>
10304
10381
  </xsl:when>
@@ -10307,6 +10384,7 @@
10307
10384
  </xsl:attribute>
10308
10385
  <xsl:attribute name="height">
10309
10386
  <xsl:choose>
10387
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10310
10388
  <xsl:when test="$height != ''">
10311
10389
  <xsl:value-of select="round($height)"/>
10312
10390
  </xsl:when>
@@ -10318,6 +10396,28 @@
10318
10396
  </xsl:copy>
10319
10397
  </xsl:template>
10320
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
+
10321
10421
  <!-- regex for 'display: inline-block;' -->
10322
10422
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10323
10423
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12381,7 +12481,9 @@
12381
12481
  </xsl:template> <!-- sections_element_style -->
12382
12482
 
12383
12483
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12384
- <fo:block break-after="page"/>
12484
+
12485
+ <fo:block break-after="page"/>
12486
+
12385
12487
  <fo:block>
12386
12488
  <xsl:call-template name="setId"/>
12387
12489
  <xsl:apply-templates/>
@@ -12448,7 +12550,7 @@
12448
12550
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12449
12551
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12450
12552
  </xsl:when>
12451
- <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])">
12452
12554
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12453
12555
  </xsl:when>
12454
12556
  </xsl:choose>
@@ -14408,10 +14510,10 @@
14408
14510
 
14409
14511
  <xsl:template name="addPDFUAmeta">
14410
14512
  <pdf:catalog>
14411
- <pdf:dictionary type="normal" key="ViewerPreferences">
14412
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14413
- </pdf:dictionary>
14414
- </pdf:catalog>
14513
+ <pdf:dictionary type="normal" key="ViewerPreferences">
14514
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14515
+ </pdf:dictionary>
14516
+ </pdf:catalog>
14415
14517
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14416
14518
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14417
14519
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
@@ -14461,6 +14563,19 @@
14461
14563
  </rdf:Description>
14462
14564
  </rdf:RDF>
14463
14565
  </x:xmpmeta>
14566
+ <!-- add attachments -->
14567
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14568
+ <xsl:choose>
14569
+ <xsl:when test="normalize-space() != ''">
14570
+ <pdf:embedded-file src="{.}" filename="{@name}"/>
14571
+ </xsl:when>
14572
+ <xsl:otherwise>
14573
+ <!-- _{filename}_attachments -->
14574
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14575
+ <pdf:embedded-file src="{$url}" filename="{@name}"/>
14576
+ </xsl:otherwise>
14577
+ </xsl:choose>
14578
+ </xsl:for-each>
14464
14579
  </xsl:template> <!-- addPDFUAmeta -->
14465
14580
 
14466
14581
  <xsl:template name="getId">
@@ -21,6 +21,11 @@ module IsoDoc
21
21
  i18nyaml: i18nyaml || @i18nyaml)
22
22
  end
23
23
 
24
+ def bibrenderer
25
+ ::Relaton::Render::IEEE::General.new(language: @lang,
26
+ i18nhash: @i18n.get)
27
+ end
28
+
24
29
  def fileloc(loc)
25
30
  File.join(File.dirname(__FILE__), loc)
26
31
  end
@@ -34,11 +34,6 @@ module IsoDoc
34
34
  end
35
35
  end
36
36
 
37
- def bibrenderer
38
- ::Relaton::Render::IEEE::General.new(language: @lang,
39
- i18nhash: @i18n.get)
40
- end
41
-
42
37
  def citestyle
43
38
  "author-date"
44
39
  end
@@ -62,7 +57,7 @@ module IsoDoc
62
57
  .new(language: @lang, i18nhash: @i18n.get,
63
58
  template: { (bibitem["type"] || "misc").to_sym =>
64
59
  "{{ creatornames }}" })
65
- .parse1(RelatonBib::XMLParser.from_xml(bibitem.to_xml))
60
+ .render1(RelatonBib::XMLParser.from_xml(bibitem.to_xml))
66
61
  end
67
62
 
68
63
  def bibliography_bibitem_number1(bibitem, idx)
@@ -338,29 +338,32 @@
338
338
  </define>
339
339
  <define name="organization">
340
340
  <element name="organization">
341
- <oneOrMore>
342
- <ref name="orgname"/>
343
- </oneOrMore>
344
- <zeroOrMore>
345
- <ref name="subdivision"/>
346
- </zeroOrMore>
347
- <optional>
348
- <ref name="abbreviation"/>
349
- </optional>
350
- <zeroOrMore>
351
- <ref name="uri"/>
352
- </zeroOrMore>
353
- <zeroOrMore>
354
- <ref name="org-identifier"/>
355
- </zeroOrMore>
356
- <zeroOrMore>
357
- <ref name="contact"/>
358
- </zeroOrMore>
359
- <optional>
360
- <ref name="logo"/>
361
- </optional>
341
+ <ref name="OrganizationType"/>
362
342
  </element>
363
343
  </define>
344
+ <define name="OrganizationType">
345
+ <oneOrMore>
346
+ <ref name="orgname"/>
347
+ </oneOrMore>
348
+ <zeroOrMore>
349
+ <ref name="subdivision"/>
350
+ </zeroOrMore>
351
+ <optional>
352
+ <ref name="abbreviation"/>
353
+ </optional>
354
+ <zeroOrMore>
355
+ <ref name="uri"/>
356
+ </zeroOrMore>
357
+ <zeroOrMore>
358
+ <ref name="org-identifier"/>
359
+ </zeroOrMore>
360
+ <zeroOrMore>
361
+ <ref name="contact"/>
362
+ </zeroOrMore>
363
+ <optional>
364
+ <ref name="logo"/>
365
+ </optional>
366
+ </define>
364
367
  <define name="orgname">
365
368
  <element name="name">
366
369
  <choice>
@@ -371,10 +374,10 @@
371
374
  </define>
372
375
  <define name="subdivision">
373
376
  <element name="subdivision">
374
- <choice>
375
- <ref name="LocalizedString"/>
376
- <ref name="NameWithVariants"/>
377
- </choice>
377
+ <optional>
378
+ <attribute name="type"/>
379
+ </optional>
380
+ <ref name="OrganizationType"/>
378
381
  </element>
379
382
  </define>
380
383
  <define name="logo">
@@ -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.3".freeze
3
+ VERSION = "1.2.5".freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
27
27
 
28
- spec.add_dependency "metanorma-standoc", "~> 2.8.2"
28
+ spec.add_dependency "metanorma-standoc", "~> 2.8.4"
29
29
  spec.add_dependency "mnconvert", "~> 1.20"
30
30
  spec.add_dependency "pubid-ieee"
31
31
  #spec.add_dependency "pubid-iso", "~> 0.5.3"
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.3
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-02-20 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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.2
19
+ version: 2.8.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.8.2
26
+ version: 2.8.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement