metanorma-ieee 1.2.4 → 1.2.6

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: b8b1f4904f4b2049efc0b0a1786712a872c4204531fffc6529f29613a263a3af
4
- data.tar.gz: 4d64adf5b036e464822e056ce7a05be31a67c9ea564b86ee42d32d3fafabadb3
3
+ metadata.gz: a2d51c132909941f89ee23b619d8be7555123ca3c7c75fb051fc6ad2086c2c42
4
+ data.tar.gz: 6935f9b8388b2157bb0398ca7fa8121b64431f17d0f3b8ff25d90da12e32888b
5
5
  SHA512:
6
- metadata.gz: 974fe9794e8b27cbd26f259e45ec7b652cec4c56ee716e6df6562c40acc3d747b8b5efd395d9e33602cbf5e94d8fa242e94e738e8b124d9c5fe69627d48a18de
7
- data.tar.gz: d7de6c724d06d8544b9e36c8f658f5d5f47194cf3767cffc5bb7e0b93abe51e90f8d964498fcd0de83d7560658632f96b7f051e0e0d9e836fed592b5073bfb33
6
+ metadata.gz: 00ab0f45d0a138d195447e4698d659df23c6b64ec96ed3bbf7df3bb3c31bea845d2d97f71b823cab64fce1474d0842f7b2f8d3f4e047e10ad4ceb2106001b21d
7
+ data.tar.gz: 96688b9710f549546e10af742140926189283ae159987bd5ad4468422cfbab0970a1ede9c2b583746fc87743f6d1dd7cf3d608041a027ec3b1c7567ea0d01fee
@@ -4040,6 +4040,7 @@
4040
4040
  <xsl:variable name="zero_width_space">​</xsl:variable>
4041
4041
  <xsl:variable name="hair_space"> </xsl:variable>
4042
4042
  <xsl:variable name="en_dash">–</xsl:variable>
4043
+ <xsl:variable name="em_dash">—</xsl:variable>
4043
4044
 
4044
4045
  <xsl:template name="getTitle">
4045
4046
  <xsl:param name="name"/>
@@ -4371,6 +4372,10 @@
4371
4372
 
4372
4373
  </xsl:attribute-set> <!-- example-name-style -->
4373
4374
 
4375
+ <xsl:template name="refine_example-name-style">
4376
+
4377
+ </xsl:template>
4378
+
4374
4379
  <xsl:attribute-set name="example-p-style">
4375
4380
 
4376
4381
  </xsl:attribute-set> <!-- example-p-style -->
@@ -4391,6 +4396,10 @@
4391
4396
 
4392
4397
  </xsl:attribute-set> <!-- termexample-name-style -->
4393
4398
 
4399
+ <xsl:template name="refine_termexample-name-style">
4400
+
4401
+ </xsl:template>
4402
+
4394
4403
  <!-- ========================== -->
4395
4404
  <!-- Table styles -->
4396
4405
  <!-- ========================== -->
@@ -4606,6 +4615,10 @@
4606
4615
 
4607
4616
  </xsl:attribute-set> <!-- table-fn-style -->
4608
4617
 
4618
+ <xsl:template name="refine_table-fn-style">
4619
+
4620
+ </xsl:template>
4621
+
4609
4622
  <xsl:attribute-set name="table-fn-number-style">
4610
4623
  <xsl:attribute name="font-size">80%</xsl:attribute>
4611
4624
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -4615,6 +4628,10 @@
4615
4628
 
4616
4629
  </xsl:attribute-set> <!-- table-fn-number-style -->
4617
4630
 
4631
+ <xsl:template name="refine_table-fn-number-style">
4632
+
4633
+ </xsl:template>
4634
+
4618
4635
  <xsl:attribute-set name="fn-container-body-style">
4619
4636
  <xsl:attribute name="text-indent">0</xsl:attribute>
4620
4637
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -7016,8 +7033,9 @@
7016
7033
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7017
7034
 
7018
7035
  <fo:block xsl:use-attribute-sets="table-fn-style">
7019
-
7036
+ <xsl:call-template name="refine_table-fn-style"/>
7020
7037
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
7038
+ <xsl:call-template name="refine_table-fn-number-style"/>
7021
7039
 
7022
7040
  <xsl:value-of select="@reference"/>
7023
7041
 
@@ -8153,12 +8171,18 @@
8153
8171
  </xsl:template>
8154
8172
 
8155
8173
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8156
- <xsl:variable name="text" select="normalize-space(.)"/>
8157
- <fo:inline font-size="75%" role="SKIP">
8174
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8175
+ <xsl:variable name="text" select="."/>
8176
+ <xsl:variable name="ratio_">
8177
+ 0.75
8178
+ </xsl:variable>
8179
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
8180
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
8158
8181
  <xsl:if test="string-length($text) &gt; 0">
8159
8182
  <xsl:variable name="smallCapsText">
8160
8183
  <xsl:call-template name="recursiveSmallCaps">
8161
8184
  <xsl:with-param name="text" select="$text"/>
8185
+ <xsl:with-param name="ratio" select="$ratio"/>
8162
8186
  </xsl:call-template>
8163
8187
  </xsl:variable>
8164
8188
  <!-- merge neighboring fo:inline -->
@@ -8195,12 +8219,13 @@
8195
8219
 
8196
8220
  <xsl:template name="recursiveSmallCaps">
8197
8221
  <xsl:param name="text"/>
8222
+ <xsl:param name="ratio"/>
8198
8223
  <xsl:variable name="char" select="substring($text,1,1)"/>
8199
8224
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
8200
8225
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
8201
8226
  <xsl:choose>
8202
8227
  <xsl:when test="$char=$upperCase">
8203
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
8228
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
8204
8229
  <xsl:value-of select="$upperCase"/>
8205
8230
  </fo:inline>
8206
8231
  </xsl:when>
@@ -8211,6 +8236,7 @@
8211
8236
  <xsl:if test="string-length($text) &gt; 1">
8212
8237
  <xsl:call-template name="recursiveSmallCaps">
8213
8238
  <xsl:with-param name="text" select="substring($text,2)"/>
8239
+ <xsl:with-param name="ratio" select="$ratio"/>
8214
8240
  </xsl:call-template>
8215
8241
  </xsl:if>
8216
8242
  </xsl:template>
@@ -8247,6 +8273,9 @@
8247
8273
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
8248
8274
  <style name="{$key}"><xsl:value-of select="$value"/></style>
8249
8275
  </xsl:if>
8276
+ <xsl:if test="$key = 'text-indent'">
8277
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
8278
+ </xsl:if>
8250
8279
  </xsl:for-each>
8251
8280
  </xsl:variable>
8252
8281
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -9651,6 +9680,11 @@
9651
9680
  </xsl:call-template>
9652
9681
  </xsl:template>
9653
9682
 
9683
+ <!-- command between two xref points to non-standard bibitem -->
9684
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
9685
+ <xsl:value-of select="."/>
9686
+ </xsl:template>
9687
+
9654
9688
  <!-- ====== -->
9655
9689
  <!-- formula -->
9656
9690
  <!-- ====== -->
@@ -10294,16 +10328,44 @@
10294
10328
  </xsl:choose>
10295
10329
 
10296
10330
  <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"/>
10331
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10332
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10333
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10334
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10335
+
10336
+ <!-- Example: -->
10299
10337
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10300
10338
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10301
10339
  <!-- 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 -->
10340
+
10341
+ <xsl:variable name="scale_x">
10342
+ <xsl:choose>
10343
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10344
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10345
+ </xsl:when>
10346
+ <xsl:otherwise>1</xsl:otherwise>
10347
+ </xsl:choose>
10348
+ </xsl:variable>
10349
+ <xsl:variable name="scale_y">
10350
+ <xsl:choose>
10351
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10352
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10353
+ </xsl:when>
10354
+ <xsl:otherwise>1</xsl:otherwise>
10355
+ </xsl:choose>
10356
+ </xsl:variable>
10357
+
10358
+ <!-- for images with big height -->
10359
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10303
10360
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10304
10361
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10305
- </xsl:if>
10362
+ </xsl:if> -->
10306
10363
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10364
+
10365
+ <xsl:if test="$scale_y != 1">
10366
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10367
+ </xsl:if>
10368
+
10307
10369
  <xsl:copy-of select="$svg_content"/>
10308
10370
  </fo:instream-foreign-object>
10309
10371
  <!-- </fo:block> -->
@@ -10328,6 +10390,8 @@
10328
10390
  </xsl:attribute>
10329
10391
  </xsl:template>
10330
10392
 
10393
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
10394
+
10331
10395
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
10332
10396
  <xsl:copy>
10333
10397
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -10341,8 +10405,13 @@
10341
10405
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10342
10406
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10343
10407
 
10408
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10409
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10410
+
10344
10411
  <xsl:attribute name="width">
10345
10412
  <xsl:choose>
10413
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10414
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10346
10415
  <xsl:when test="$width != ''">
10347
10416
  <xsl:value-of select="round($width)"/>
10348
10417
  </xsl:when>
@@ -10351,6 +10420,8 @@
10351
10420
  </xsl:attribute>
10352
10421
  <xsl:attribute name="height">
10353
10422
  <xsl:choose>
10423
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10424
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10354
10425
  <xsl:when test="$height != ''">
10355
10426
  <xsl:value-of select="round($height)"/>
10356
10427
  </xsl:when>
@@ -10362,6 +10433,28 @@
10362
10433
  </xsl:copy>
10363
10434
  </xsl:template>
10364
10435
 
10436
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10437
+ <!-- image[@width]/svg -->
10438
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10439
+ <xsl:attribute name="width">
10440
+ <xsl:choose>
10441
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10442
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10443
+ </xsl:choose>
10444
+ </xsl:attribute>
10445
+ </xsl:template>
10446
+
10447
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10448
+ <!-- image[@height]/svg -->
10449
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10450
+ <xsl:attribute name="height">
10451
+ <xsl:choose>
10452
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10453
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10454
+ </xsl:choose>
10455
+ </xsl:attribute>
10456
+ </xsl:template>
10457
+
10365
10458
  <!-- regex for 'display: inline-block;' -->
10366
10459
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10367
10460
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -11817,6 +11910,7 @@
11817
11910
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
11818
11911
  <xsl:if test="normalize-space() != ''">
11819
11912
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11913
+ <xsl:call-template name="refine_termexample-name-style"/>
11820
11914
  <xsl:apply-templates/>:
11821
11915
  </fo:inline>
11822
11916
  </xsl:if>
@@ -11971,6 +12065,7 @@
11971
12065
  </xsl:when>
11972
12066
  <xsl:otherwise>
11973
12067
  <fo:inline xsl:use-attribute-sets="example-name-style">
12068
+ <xsl:call-template name="refine_example-name-style"/>
11974
12069
  <xsl:apply-templates/>:
11975
12070
  </fo:inline>
11976
12071
  </xsl:otherwise>
@@ -12425,7 +12520,9 @@
12425
12520
  </xsl:template> <!-- sections_element_style -->
12426
12521
 
12427
12522
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12428
- <fo:block break-after="page"/>
12523
+
12524
+ <fo:block break-after="page"/>
12525
+
12429
12526
  <fo:block>
12430
12527
  <xsl:call-template name="setId"/>
12431
12528
  <xsl:apply-templates/>
@@ -12492,7 +12589,7 @@
12492
12589
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12493
12590
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12494
12591
  </xsl:when>
12495
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12592
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12496
12593
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12497
12594
  </xsl:when>
12498
12595
  </xsl:choose>
@@ -13173,6 +13270,7 @@
13173
13270
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
13174
13271
 
13175
13272
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
13273
+
13176
13274
  <xsl:call-template name="processBibitem"/>
13177
13275
  </fo:block>
13178
13276
 
@@ -13227,6 +13325,7 @@
13227
13325
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
13228
13326
  <xsl:otherwise>
13229
13327
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
13328
+
13230
13329
  <fo:list-item-label end-indent="label-end()">
13231
13330
  <fo:block role="SKIP">
13232
13331
  <fo:inline role="SKIP">
@@ -15132,4 +15231,6 @@
15132
15231
  </xsl:if>
15133
15232
  </xsl:template>
15134
15233
 
15234
+ <!-- update -->
15235
+
15135
15236
  </xsl:stylesheet>
@@ -4040,6 +4040,7 @@
4040
4040
  <xsl:variable name="zero_width_space">​</xsl:variable>
4041
4041
  <xsl:variable name="hair_space"> </xsl:variable>
4042
4042
  <xsl:variable name="en_dash">–</xsl:variable>
4043
+ <xsl:variable name="em_dash">—</xsl:variable>
4043
4044
 
4044
4045
  <xsl:template name="getTitle">
4045
4046
  <xsl:param name="name"/>
@@ -4371,6 +4372,10 @@
4371
4372
 
4372
4373
  </xsl:attribute-set> <!-- example-name-style -->
4373
4374
 
4375
+ <xsl:template name="refine_example-name-style">
4376
+
4377
+ </xsl:template>
4378
+
4374
4379
  <xsl:attribute-set name="example-p-style">
4375
4380
 
4376
4381
  </xsl:attribute-set> <!-- example-p-style -->
@@ -4391,6 +4396,10 @@
4391
4396
 
4392
4397
  </xsl:attribute-set> <!-- termexample-name-style -->
4393
4398
 
4399
+ <xsl:template name="refine_termexample-name-style">
4400
+
4401
+ </xsl:template>
4402
+
4394
4403
  <!-- ========================== -->
4395
4404
  <!-- Table styles -->
4396
4405
  <!-- ========================== -->
@@ -4606,6 +4615,10 @@
4606
4615
 
4607
4616
  </xsl:attribute-set> <!-- table-fn-style -->
4608
4617
 
4618
+ <xsl:template name="refine_table-fn-style">
4619
+
4620
+ </xsl:template>
4621
+
4609
4622
  <xsl:attribute-set name="table-fn-number-style">
4610
4623
  <xsl:attribute name="font-size">80%</xsl:attribute>
4611
4624
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -4615,6 +4628,10 @@
4615
4628
 
4616
4629
  </xsl:attribute-set> <!-- table-fn-number-style -->
4617
4630
 
4631
+ <xsl:template name="refine_table-fn-number-style">
4632
+
4633
+ </xsl:template>
4634
+
4618
4635
  <xsl:attribute-set name="fn-container-body-style">
4619
4636
  <xsl:attribute name="text-indent">0</xsl:attribute>
4620
4637
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -7016,8 +7033,9 @@
7016
7033
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7017
7034
 
7018
7035
  <fo:block xsl:use-attribute-sets="table-fn-style">
7019
-
7036
+ <xsl:call-template name="refine_table-fn-style"/>
7020
7037
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
7038
+ <xsl:call-template name="refine_table-fn-number-style"/>
7021
7039
 
7022
7040
  <xsl:value-of select="@reference"/>
7023
7041
 
@@ -8153,12 +8171,18 @@
8153
8171
  </xsl:template>
8154
8172
 
8155
8173
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8156
- <xsl:variable name="text" select="normalize-space(.)"/>
8157
- <fo:inline font-size="75%" role="SKIP">
8174
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8175
+ <xsl:variable name="text" select="."/>
8176
+ <xsl:variable name="ratio_">
8177
+ 0.75
8178
+ </xsl:variable>
8179
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
8180
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
8158
8181
  <xsl:if test="string-length($text) &gt; 0">
8159
8182
  <xsl:variable name="smallCapsText">
8160
8183
  <xsl:call-template name="recursiveSmallCaps">
8161
8184
  <xsl:with-param name="text" select="$text"/>
8185
+ <xsl:with-param name="ratio" select="$ratio"/>
8162
8186
  </xsl:call-template>
8163
8187
  </xsl:variable>
8164
8188
  <!-- merge neighboring fo:inline -->
@@ -8195,12 +8219,13 @@
8195
8219
 
8196
8220
  <xsl:template name="recursiveSmallCaps">
8197
8221
  <xsl:param name="text"/>
8222
+ <xsl:param name="ratio"/>
8198
8223
  <xsl:variable name="char" select="substring($text,1,1)"/>
8199
8224
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
8200
8225
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
8201
8226
  <xsl:choose>
8202
8227
  <xsl:when test="$char=$upperCase">
8203
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
8228
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
8204
8229
  <xsl:value-of select="$upperCase"/>
8205
8230
  </fo:inline>
8206
8231
  </xsl:when>
@@ -8211,6 +8236,7 @@
8211
8236
  <xsl:if test="string-length($text) &gt; 1">
8212
8237
  <xsl:call-template name="recursiveSmallCaps">
8213
8238
  <xsl:with-param name="text" select="substring($text,2)"/>
8239
+ <xsl:with-param name="ratio" select="$ratio"/>
8214
8240
  </xsl:call-template>
8215
8241
  </xsl:if>
8216
8242
  </xsl:template>
@@ -8247,6 +8273,9 @@
8247
8273
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
8248
8274
  <style name="{$key}"><xsl:value-of select="$value"/></style>
8249
8275
  </xsl:if>
8276
+ <xsl:if test="$key = 'text-indent'">
8277
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
8278
+ </xsl:if>
8250
8279
  </xsl:for-each>
8251
8280
  </xsl:variable>
8252
8281
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -9651,6 +9680,11 @@
9651
9680
  </xsl:call-template>
9652
9681
  </xsl:template>
9653
9682
 
9683
+ <!-- command between two xref points to non-standard bibitem -->
9684
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
9685
+ <xsl:value-of select="."/>
9686
+ </xsl:template>
9687
+
9654
9688
  <!-- ====== -->
9655
9689
  <!-- formula -->
9656
9690
  <!-- ====== -->
@@ -10294,16 +10328,44 @@
10294
10328
  </xsl:choose>
10295
10329
 
10296
10330
  <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"/>
10331
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10332
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10333
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10334
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10335
+
10336
+ <!-- Example: -->
10299
10337
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10300
10338
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10301
10339
  <!-- 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 -->
10340
+
10341
+ <xsl:variable name="scale_x">
10342
+ <xsl:choose>
10343
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10344
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10345
+ </xsl:when>
10346
+ <xsl:otherwise>1</xsl:otherwise>
10347
+ </xsl:choose>
10348
+ </xsl:variable>
10349
+ <xsl:variable name="scale_y">
10350
+ <xsl:choose>
10351
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10352
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10353
+ </xsl:when>
10354
+ <xsl:otherwise>1</xsl:otherwise>
10355
+ </xsl:choose>
10356
+ </xsl:variable>
10357
+
10358
+ <!-- for images with big height -->
10359
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10303
10360
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10304
10361
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10305
- </xsl:if>
10362
+ </xsl:if> -->
10306
10363
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10364
+
10365
+ <xsl:if test="$scale_y != 1">
10366
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10367
+ </xsl:if>
10368
+
10307
10369
  <xsl:copy-of select="$svg_content"/>
10308
10370
  </fo:instream-foreign-object>
10309
10371
  <!-- </fo:block> -->
@@ -10328,6 +10390,8 @@
10328
10390
  </xsl:attribute>
10329
10391
  </xsl:template>
10330
10392
 
10393
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
10394
+
10331
10395
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
10332
10396
  <xsl:copy>
10333
10397
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -10341,8 +10405,13 @@
10341
10405
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10342
10406
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10343
10407
 
10408
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10409
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10410
+
10344
10411
  <xsl:attribute name="width">
10345
10412
  <xsl:choose>
10413
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10414
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10346
10415
  <xsl:when test="$width != ''">
10347
10416
  <xsl:value-of select="round($width)"/>
10348
10417
  </xsl:when>
@@ -10351,6 +10420,8 @@
10351
10420
  </xsl:attribute>
10352
10421
  <xsl:attribute name="height">
10353
10422
  <xsl:choose>
10423
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10424
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10354
10425
  <xsl:when test="$height != ''">
10355
10426
  <xsl:value-of select="round($height)"/>
10356
10427
  </xsl:when>
@@ -10362,6 +10433,28 @@
10362
10433
  </xsl:copy>
10363
10434
  </xsl:template>
10364
10435
 
10436
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10437
+ <!-- image[@width]/svg -->
10438
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10439
+ <xsl:attribute name="width">
10440
+ <xsl:choose>
10441
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10442
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10443
+ </xsl:choose>
10444
+ </xsl:attribute>
10445
+ </xsl:template>
10446
+
10447
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10448
+ <!-- image[@height]/svg -->
10449
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10450
+ <xsl:attribute name="height">
10451
+ <xsl:choose>
10452
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10453
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10454
+ </xsl:choose>
10455
+ </xsl:attribute>
10456
+ </xsl:template>
10457
+
10365
10458
  <!-- regex for 'display: inline-block;' -->
10366
10459
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10367
10460
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -11817,6 +11910,7 @@
11817
11910
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
11818
11911
  <xsl:if test="normalize-space() != ''">
11819
11912
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11913
+ <xsl:call-template name="refine_termexample-name-style"/>
11820
11914
  <xsl:apply-templates/>:
11821
11915
  </fo:inline>
11822
11916
  </xsl:if>
@@ -11971,6 +12065,7 @@
11971
12065
  </xsl:when>
11972
12066
  <xsl:otherwise>
11973
12067
  <fo:inline xsl:use-attribute-sets="example-name-style">
12068
+ <xsl:call-template name="refine_example-name-style"/>
11974
12069
  <xsl:apply-templates/>:
11975
12070
  </fo:inline>
11976
12071
  </xsl:otherwise>
@@ -12425,7 +12520,9 @@
12425
12520
  </xsl:template> <!-- sections_element_style -->
12426
12521
 
12427
12522
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12428
- <fo:block break-after="page"/>
12523
+
12524
+ <fo:block break-after="page"/>
12525
+
12429
12526
  <fo:block>
12430
12527
  <xsl:call-template name="setId"/>
12431
12528
  <xsl:apply-templates/>
@@ -12492,7 +12589,7 @@
12492
12589
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12493
12590
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12494
12591
  </xsl:when>
12495
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12592
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12496
12593
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12497
12594
  </xsl:when>
12498
12595
  </xsl:choose>
@@ -13173,6 +13270,7 @@
13173
13270
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
13174
13271
 
13175
13272
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
13273
+
13176
13274
  <xsl:call-template name="processBibitem"/>
13177
13275
  </fo:block>
13178
13276
 
@@ -13227,6 +13325,7 @@
13227
13325
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
13228
13326
  <xsl:otherwise>
13229
13327
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
13328
+
13230
13329
  <fo:list-item-label end-indent="label-end()">
13231
13330
  <fo:block role="SKIP">
13232
13331
  <fo:inline role="SKIP">
@@ -15132,4 +15231,6 @@
15132
15231
  </xsl:if>
15133
15232
  </xsl:template>
15134
15233
 
15234
+ <!-- update -->
15235
+
15135
15236
  </xsl:stylesheet>
@@ -15,8 +15,10 @@ module IsoDoc
15
15
  def biblio_anchor_linkend(node, bib)
16
16
  if %w(techreport standard).include?(bib[:type])
17
17
  [node["citeas"], bib[:ord]].compact.join(" ")
18
- else
18
+ elsif bib[:author]
19
19
  "#{bib[:author]} " + node["citeas"]
20
+ else
21
+ node["citeas"]
20
22
  end
21
23
  end
22
24
 
@@ -208,7 +208,9 @@
208
208
  </define>
209
209
  <define name="roledescription">
210
210
  <element name="description">
211
- <ref name="FormattedString"/>
211
+ <oneOrMore>
212
+ <ref name="TextElement"/>
213
+ </oneOrMore>
212
214
  </element>
213
215
  </define>
214
216
  <define name="person">
@@ -333,7 +335,9 @@
333
335
  </define>
334
336
  <define name="affiliationdescription">
335
337
  <element name="description">
336
- <ref name="FormattedString"/>
338
+ <oneOrMore>
339
+ <ref name="TextElement"/>
340
+ </oneOrMore>
337
341
  </element>
338
342
  </define>
339
343
  <define name="organization">
@@ -897,7 +901,9 @@
897
901
  </define>
898
902
  <define name="formattedref">
899
903
  <element name="formattedref">
900
- <ref name="FormattedString"/>
904
+ <oneOrMore>
905
+ <ref name="TextElement"/>
906
+ </oneOrMore>
901
907
  </element>
902
908
  </define>
903
909
  <define name="license">
@@ -942,7 +948,9 @@
942
948
  <optional>
943
949
  <attribute name="type"/>
944
950
  </optional>
945
- <ref name="FormattedString"/>
951
+ <zeroOrMore>
952
+ <ref name="TextElement"/>
953
+ </zeroOrMore>
946
954
  </define>
947
955
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
948
956
  <define name="TypedUri">
@@ -1042,7 +1050,9 @@
1042
1050
  <optional>
1043
1051
  <attribute name="script"/>
1044
1052
  </optional>
1045
- <text/>
1053
+ <oneOrMore>
1054
+ <ref name="TextElement"/>
1055
+ </oneOrMore>
1046
1056
  </element>
1047
1057
  </define>
1048
1058
  <define name="docnumber">
@@ -1267,12 +1277,16 @@
1267
1277
  <optional>
1268
1278
  <attribute name="type"/>
1269
1279
  </optional>
1270
- <ref name="FormattedString"/>
1280
+ <oneOrMore>
1281
+ <ref name="TextElement"/>
1282
+ </oneOrMore>
1271
1283
  </element>
1272
1284
  </define>
1273
1285
  <define name="bibabstract">
1274
1286
  <element name="abstract">
1275
- <ref name="FormattedString"/>
1287
+ <oneOrMore>
1288
+ <ref name="TextElement"/>
1289
+ </oneOrMore>
1276
1290
  </element>
1277
1291
  </define>
1278
1292
  <define name="copyright">
@@ -1377,7 +1391,9 @@
1377
1391
  </attribute>
1378
1392
  <optional>
1379
1393
  <element name="description">
1380
- <ref name="FormattedString"/>
1394
+ <oneOrMore>
1395
+ <ref name="TextElement"/>
1396
+ </oneOrMore>
1381
1397
  </element>
1382
1398
  </optional>
1383
1399
  <element name="bibitem">
@@ -36,7 +36,7 @@ module Metanorma
36
36
 
37
37
  def metadata_id(node, xml)
38
38
  if id = node.attr("docidentifier")
39
- xml.docidentifier id, **attr_code(type: "IEEE")
39
+ xml.docidentifier id, **attr_code(type: "IEEE", primary: "true")
40
40
  else ieee_id(node, xml)
41
41
  end
42
42
  id = node.attr("stdid-pdf") and
@@ -97,7 +97,7 @@ module Metanorma
97
97
 
98
98
  def ieee_id_out(xml, params)
99
99
  id = pubid_select(params).create(**params)
100
- xml.docidentifier id.to_s, type: "IEEE"
100
+ xml.docidentifier id.to_s, type: "IEEE", primary: "true"
101
101
  end
102
102
 
103
103
  def pubid_select(_params)
@@ -156,44 +156,7 @@
156
156
  </define>
157
157
  <define name="xref">
158
158
  <element name="xref">
159
- <attribute name="target">
160
- <data type="string">
161
- <param name="pattern">\i\c*|\c+#\c+</param>
162
- </data>
163
- </attribute>
164
- <optional>
165
- <attribute name="to">
166
- <data type="string">
167
- <param name="pattern">\i\c*|\c+#\c+</param>
168
- </data>
169
- </attribute>
170
- </optional>
171
- <optional>
172
- <attribute name="type">
173
- <ref name="ReferenceFormat"/>
174
- </attribute>
175
- </optional>
176
- <optional>
177
- <attribute name="alt"/>
178
- </optional>
179
- <optional>
180
- <attribute name="case">
181
- <choice>
182
- <value>capital</value>
183
- <value>lowercase</value>
184
- </choice>
185
- </attribute>
186
- </optional>
187
- <optional>
188
- <attribute name="droploc">
189
- <data type="boolean"/>
190
- </attribute>
191
- </optional>
192
- <optional>
193
- <attribute name="style">
194
- <ref name="XrefStyleType"/>
195
- </attribute>
196
- </optional>
159
+ <ref name="XrefAttributes"/>
197
160
  <ref name="XrefBody"/>
198
161
  </element>
199
162
  </define>
@@ -407,23 +370,7 @@
407
370
  </define>
408
371
  <define name="figure">
409
372
  <element name="figure">
410
- <attribute name="id">
411
- <data type="ID"/>
412
- </attribute>
413
- <optional>
414
- <attribute name="unnumbered">
415
- <data type="boolean"/>
416
- </attribute>
417
- </optional>
418
- <optional>
419
- <attribute name="number"/>
420
- </optional>
421
- <optional>
422
- <attribute name="subsequence"/>
423
- </optional>
424
- <optional>
425
- <attribute name="class"/>
426
- </optional>
373
+ <ref name="FigureAttributes"/>
427
374
  <ref name="BlockAttributes"/>
428
375
  <optional>
429
376
  <ref name="tname"/>
@@ -2450,6 +2397,49 @@
2450
2397
  </zeroOrMore>
2451
2398
  </element>
2452
2399
  </define>
2400
+ <define name="XrefAttributes">
2401
+ <attribute name="target">
2402
+ <data type="string">
2403
+ <param name="pattern">\i\c*|\c+#\c+</param>
2404
+ </data>
2405
+ </attribute>
2406
+ <optional>
2407
+ <attribute name="to">
2408
+ <data type="string">
2409
+ <param name="pattern">\i\c*|\c+#\c+</param>
2410
+ </data>
2411
+ </attribute>
2412
+ </optional>
2413
+ <optional>
2414
+ <attribute name="type">
2415
+ <ref name="ReferenceFormat"/>
2416
+ </attribute>
2417
+ </optional>
2418
+ <optional>
2419
+ <attribute name="alt"/>
2420
+ </optional>
2421
+ <optional>
2422
+ <attribute name="case">
2423
+ <choice>
2424
+ <value>capital</value>
2425
+ <value>lowercase</value>
2426
+ </choice>
2427
+ </attribute>
2428
+ </optional>
2429
+ <optional>
2430
+ <attribute name="droploc">
2431
+ <data type="boolean"/>
2432
+ </attribute>
2433
+ </optional>
2434
+ <optional>
2435
+ <attribute name="style">
2436
+ <ref name="XrefStyleType"/>
2437
+ </attribute>
2438
+ </optional>
2439
+ <optional>
2440
+ <attribute name="label"/>
2441
+ </optional>
2442
+ </define>
2453
2443
  <define name="XrefBody">
2454
2444
  <zeroOrMore>
2455
2445
  <ref name="XrefTarget"/>
@@ -2528,6 +2518,28 @@
2528
2518
  <attribute name="columns"/>
2529
2519
  </optional>
2530
2520
  </define>
2521
+ <define name="FigureAttributes">
2522
+ <attribute name="id">
2523
+ <data type="ID"/>
2524
+ </attribute>
2525
+ <optional>
2526
+ <attribute name="unnumbered">
2527
+ <data type="boolean"/>
2528
+ </attribute>
2529
+ </optional>
2530
+ <optional>
2531
+ <attribute name="number"/>
2532
+ </optional>
2533
+ <optional>
2534
+ <attribute name="subsequence"/>
2535
+ </optional>
2536
+ <optional>
2537
+ <attribute name="class"/>
2538
+ </optional>
2539
+ <optional>
2540
+ <attribute name="width"/>
2541
+ </optional>
2542
+ </define>
2531
2543
  <start>
2532
2544
  <ref name="standard-document"/>
2533
2545
  </start>
@@ -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.6".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.6
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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc