metanorma-iho 0.9.3 → 0.9.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: 6f23932cc917c41bf9680cf9e300d37ea48db54c2bebb8f489b6fca2630836f5
4
- data.tar.gz: dad38711590324bb7f1c9accfeeb34b9c6aafbddad5464ccf44b9e9111dd9589
3
+ metadata.gz: ac6b94d80ec01694cb92156d01300f4b05f795a52f8b8ac3e941114c8e804f38
4
+ data.tar.gz: 89138692b96dd9f82e6362566c959f9d00fbc5a8c1e0f7e7e1f7848d830a3429
5
5
  SHA512:
6
- metadata.gz: 81026b6867354a0a96005f3a79f6b298abb37d0bee2ba2c8a4871d183cca50c743b23ae00500757024e33e70e9f1094fc81772956c1f78b5723c6aff778b52b2
7
- data.tar.gz: c96d8655a05f751d5475fcd622f6bdc1230a2ef579cac08790aa0218100ab404e3df196b80f97ae56a0012e8b07fa0a4b5a43aaa4b2831967b4b7e34edea28e4
6
+ metadata.gz: 1f6f860a2276969866f9559f573890bae77027a50c9f3e399b922e66563e50a8581f4c716659acd98a8997d4702fb2a9901eadafd26acc01921df14dd9a48754
7
+ data.tar.gz: cb01939da80416546f14d86b085a7b20e7159174fa6f3b300fc1474db6b13d55b8bfde07c13b2dc3739ee37109b72abc1021045490926e42f4526a8a6da2ea9b
@@ -1083,6 +1083,7 @@
1083
1083
  <xsl:variable name="zero_width_space">​</xsl:variable>
1084
1084
  <xsl:variable name="hair_space"> </xsl:variable>
1085
1085
  <xsl:variable name="en_dash">–</xsl:variable>
1086
+ <xsl:variable name="em_dash">—</xsl:variable>
1086
1087
 
1087
1088
  <xsl:template name="getTitle">
1088
1089
  <xsl:param name="name"/>
@@ -1404,6 +1405,10 @@
1404
1405
 
1405
1406
  </xsl:attribute-set> <!-- example-name-style -->
1406
1407
 
1408
+ <xsl:template name="refine_example-name-style">
1409
+
1410
+ </xsl:template>
1411
+
1407
1412
  <xsl:attribute-set name="example-p-style">
1408
1413
 
1409
1414
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1421,6 +1426,10 @@
1421
1426
 
1422
1427
  </xsl:attribute-set> <!-- termexample-name-style -->
1423
1428
 
1429
+ <xsl:template name="refine_termexample-name-style">
1430
+
1431
+ </xsl:template>
1432
+
1424
1433
  <!-- ========================== -->
1425
1434
  <!-- Table styles -->
1426
1435
  <!-- ========================== -->
@@ -1604,6 +1613,10 @@
1604
1613
 
1605
1614
  </xsl:attribute-set> <!-- table-fn-style -->
1606
1615
 
1616
+ <xsl:template name="refine_table-fn-style">
1617
+
1618
+ </xsl:template>
1619
+
1607
1620
  <xsl:attribute-set name="table-fn-number-style">
1608
1621
  <xsl:attribute name="font-size">80%</xsl:attribute>
1609
1622
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1612,6 +1625,10 @@
1612
1625
 
1613
1626
  </xsl:attribute-set> <!-- table-fn-number-style -->
1614
1627
 
1628
+ <xsl:template name="refine_table-fn-number-style">
1629
+
1630
+ </xsl:template>
1631
+
1615
1632
  <xsl:attribute-set name="fn-container-body-style">
1616
1633
  <xsl:attribute name="text-indent">0</xsl:attribute>
1617
1634
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -2928,6 +2945,7 @@
2928
2945
  <!-- centered table when table name is centered (see table-name-style) -->
2929
2946
 
2930
2947
  <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
2948
+
2931
2949
  <fo:table-column column-width="proportional-column-width(1)"/>
2932
2950
  <fo:table-column column-width="{@width}"/>
2933
2951
  <fo:table-column column-width="proportional-column-width(1)"/>
@@ -3969,8 +3987,9 @@
3969
3987
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3970
3988
 
3971
3989
  <fo:block xsl:use-attribute-sets="table-fn-style">
3972
-
3990
+ <xsl:call-template name="refine_table-fn-style"/>
3973
3991
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3992
+ <xsl:call-template name="refine_table-fn-number-style"/>
3974
3993
 
3975
3994
  <xsl:value-of select="@reference"/>
3976
3995
 
@@ -5113,12 +5132,18 @@
5113
5132
  </xsl:template>
5114
5133
 
5115
5134
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5116
- <xsl:variable name="text" select="normalize-space(.)"/>
5117
- <fo:inline font-size="75%" role="SKIP">
5135
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5136
+ <xsl:variable name="text" select="."/>
5137
+ <xsl:variable name="ratio_">
5138
+ 0.75
5139
+ </xsl:variable>
5140
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5141
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
5118
5142
  <xsl:if test="string-length($text) &gt; 0">
5119
5143
  <xsl:variable name="smallCapsText">
5120
5144
  <xsl:call-template name="recursiveSmallCaps">
5121
5145
  <xsl:with-param name="text" select="$text"/>
5146
+ <xsl:with-param name="ratio" select="$ratio"/>
5122
5147
  </xsl:call-template>
5123
5148
  </xsl:variable>
5124
5149
  <!-- merge neighboring fo:inline -->
@@ -5155,12 +5180,13 @@
5155
5180
 
5156
5181
  <xsl:template name="recursiveSmallCaps">
5157
5182
  <xsl:param name="text"/>
5183
+ <xsl:param name="ratio"/>
5158
5184
  <xsl:variable name="char" select="substring($text,1,1)"/>
5159
5185
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5160
5186
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5161
5187
  <xsl:choose>
5162
5188
  <xsl:when test="$char=$upperCase">
5163
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5189
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5164
5190
  <xsl:value-of select="$upperCase"/>
5165
5191
  </fo:inline>
5166
5192
  </xsl:when>
@@ -5171,6 +5197,7 @@
5171
5197
  <xsl:if test="string-length($text) &gt; 1">
5172
5198
  <xsl:call-template name="recursiveSmallCaps">
5173
5199
  <xsl:with-param name="text" select="substring($text,2)"/>
5200
+ <xsl:with-param name="ratio" select="$ratio"/>
5174
5201
  </xsl:call-template>
5175
5202
  </xsl:if>
5176
5203
  </xsl:template>
@@ -5278,6 +5305,9 @@
5278
5305
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5279
5306
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5280
5307
  </xsl:if>
5308
+ <xsl:if test="$key = 'text-indent'">
5309
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5310
+ </xsl:if>
5281
5311
  </xsl:for-each>
5282
5312
  </xsl:variable>
5283
5313
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6680,6 +6710,11 @@
6680
6710
  </xsl:call-template>
6681
6711
  </xsl:template>
6682
6712
 
6713
+ <!-- command between two xref points to non-standard bibitem -->
6714
+ <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']]]">
6715
+ <xsl:value-of select="."/>
6716
+ </xsl:template>
6717
+
6683
6718
  <!-- ====== -->
6684
6719
  <!-- formula -->
6685
6720
  <!-- ====== -->
@@ -7321,16 +7356,44 @@
7321
7356
  </xsl:choose>
7322
7357
 
7323
7358
  <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"/>
7359
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7360
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7361
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7362
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7363
+
7364
+ <!-- Example: -->
7326
7365
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7327
7366
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7328
7367
  <!-- 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 -->
7368
+
7369
+ <xsl:variable name="scale_x">
7370
+ <xsl:choose>
7371
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7372
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7373
+ </xsl:when>
7374
+ <xsl:otherwise>1</xsl:otherwise>
7375
+ </xsl:choose>
7376
+ </xsl:variable>
7377
+ <xsl:variable name="scale_y">
7378
+ <xsl:choose>
7379
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7380
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7381
+ </xsl:when>
7382
+ <xsl:otherwise>1</xsl:otherwise>
7383
+ </xsl:choose>
7384
+ </xsl:variable>
7385
+
7386
+ <!-- for images with big height -->
7387
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7330
7388
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7331
7389
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7332
- </xsl:if>
7390
+ </xsl:if> -->
7333
7391
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7392
+
7393
+ <xsl:if test="$scale_y != 1">
7394
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7395
+ </xsl:if>
7396
+
7334
7397
  <xsl:copy-of select="$svg_content"/>
7335
7398
  </fo:instream-foreign-object>
7336
7399
  <!-- </fo:block> -->
@@ -7355,6 +7418,8 @@
7355
7418
  </xsl:attribute>
7356
7419
  </xsl:template>
7357
7420
 
7421
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
7422
+
7358
7423
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7359
7424
  <xsl:copy>
7360
7425
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -7368,8 +7433,13 @@
7368
7433
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7369
7434
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7370
7435
 
7436
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7437
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7438
+
7371
7439
  <xsl:attribute name="width">
7372
7440
  <xsl:choose>
7441
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7442
+ <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>
7373
7443
  <xsl:when test="$width != ''">
7374
7444
  <xsl:value-of select="round($width)"/>
7375
7445
  </xsl:when>
@@ -7378,6 +7448,8 @@
7378
7448
  </xsl:attribute>
7379
7449
  <xsl:attribute name="height">
7380
7450
  <xsl:choose>
7451
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7452
+ <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>
7381
7453
  <xsl:when test="$height != ''">
7382
7454
  <xsl:value-of select="round($height)"/>
7383
7455
  </xsl:when>
@@ -7389,6 +7461,28 @@
7389
7461
  </xsl:copy>
7390
7462
  </xsl:template>
7391
7463
 
7464
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7465
+ <!-- image[@width]/svg -->
7466
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7467
+ <xsl:attribute name="width">
7468
+ <xsl:choose>
7469
+ <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>
7470
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7471
+ </xsl:choose>
7472
+ </xsl:attribute>
7473
+ </xsl:template>
7474
+
7475
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7476
+ <!-- image[@height]/svg -->
7477
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7478
+ <xsl:attribute name="height">
7479
+ <xsl:choose>
7480
+ <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>
7481
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7482
+ </xsl:choose>
7483
+ </xsl:attribute>
7484
+ </xsl:template>
7485
+
7392
7486
  <!-- regex for 'display: inline-block;' -->
7393
7487
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7394
7488
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -8845,6 +8939,7 @@
8845
8939
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
8846
8940
  <xsl:if test="normalize-space() != ''">
8847
8941
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
8942
+ <xsl:call-template name="refine_termexample-name-style"/>
8848
8943
  <xsl:apply-templates/>
8849
8944
  </fo:inline>
8850
8945
  </xsl:if>
@@ -8995,6 +9090,7 @@
8995
9090
  </xsl:when>
8996
9091
  <xsl:otherwise>
8997
9092
  <fo:inline xsl:use-attribute-sets="example-name-style">
9093
+ <xsl:call-template name="refine_example-name-style"/>
8998
9094
  <xsl:apply-templates/>:
8999
9095
  </fo:inline>
9000
9096
  </xsl:otherwise>
@@ -9455,7 +9551,9 @@
9455
9551
  </xsl:template> <!-- sections_element_style -->
9456
9552
 
9457
9553
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9458
- <fo:block break-after="page"/>
9554
+
9555
+ <fo:block break-after="page"/>
9556
+
9459
9557
  <fo:block>
9460
9558
  <xsl:call-template name="setId"/>
9461
9559
  <xsl:apply-templates/>
@@ -9522,7 +9620,7 @@
9522
9620
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9523
9621
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9524
9622
  </xsl:when>
9525
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9623
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9526
9624
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9527
9625
  </xsl:when>
9528
9626
  </xsl:choose>
@@ -10244,6 +10342,7 @@
10244
10342
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10245
10343
  <xsl:otherwise>
10246
10344
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
10345
+
10247
10346
  <fo:list-item-label end-indent="label-end()">
10248
10347
  <fo:block role="SKIP">
10249
10348
  <fo:inline role="SKIP">
@@ -12006,4 +12105,6 @@
12006
12105
  </xsl:if>
12007
12106
  </xsl:template>
12008
12107
 
12108
+ <!-- update -->
12109
+
12009
12110
  </xsl:stylesheet>
@@ -1083,6 +1083,7 @@
1083
1083
  <xsl:variable name="zero_width_space">​</xsl:variable>
1084
1084
  <xsl:variable name="hair_space"> </xsl:variable>
1085
1085
  <xsl:variable name="en_dash">–</xsl:variable>
1086
+ <xsl:variable name="em_dash">—</xsl:variable>
1086
1087
 
1087
1088
  <xsl:template name="getTitle">
1088
1089
  <xsl:param name="name"/>
@@ -1404,6 +1405,10 @@
1404
1405
 
1405
1406
  </xsl:attribute-set> <!-- example-name-style -->
1406
1407
 
1408
+ <xsl:template name="refine_example-name-style">
1409
+
1410
+ </xsl:template>
1411
+
1407
1412
  <xsl:attribute-set name="example-p-style">
1408
1413
 
1409
1414
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1421,6 +1426,10 @@
1421
1426
 
1422
1427
  </xsl:attribute-set> <!-- termexample-name-style -->
1423
1428
 
1429
+ <xsl:template name="refine_termexample-name-style">
1430
+
1431
+ </xsl:template>
1432
+
1424
1433
  <!-- ========================== -->
1425
1434
  <!-- Table styles -->
1426
1435
  <!-- ========================== -->
@@ -1604,6 +1613,10 @@
1604
1613
 
1605
1614
  </xsl:attribute-set> <!-- table-fn-style -->
1606
1615
 
1616
+ <xsl:template name="refine_table-fn-style">
1617
+
1618
+ </xsl:template>
1619
+
1607
1620
  <xsl:attribute-set name="table-fn-number-style">
1608
1621
  <xsl:attribute name="font-size">80%</xsl:attribute>
1609
1622
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1612,6 +1625,10 @@
1612
1625
 
1613
1626
  </xsl:attribute-set> <!-- table-fn-number-style -->
1614
1627
 
1628
+ <xsl:template name="refine_table-fn-number-style">
1629
+
1630
+ </xsl:template>
1631
+
1615
1632
  <xsl:attribute-set name="fn-container-body-style">
1616
1633
  <xsl:attribute name="text-indent">0</xsl:attribute>
1617
1634
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -2928,6 +2945,7 @@
2928
2945
  <!-- centered table when table name is centered (see table-name-style) -->
2929
2946
 
2930
2947
  <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
2948
+
2931
2949
  <fo:table-column column-width="proportional-column-width(1)"/>
2932
2950
  <fo:table-column column-width="{@width}"/>
2933
2951
  <fo:table-column column-width="proportional-column-width(1)"/>
@@ -3969,8 +3987,9 @@
3969
3987
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3970
3988
 
3971
3989
  <fo:block xsl:use-attribute-sets="table-fn-style">
3972
-
3990
+ <xsl:call-template name="refine_table-fn-style"/>
3973
3991
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3992
+ <xsl:call-template name="refine_table-fn-number-style"/>
3974
3993
 
3975
3994
  <xsl:value-of select="@reference"/>
3976
3995
 
@@ -5113,12 +5132,18 @@
5113
5132
  </xsl:template>
5114
5133
 
5115
5134
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5116
- <xsl:variable name="text" select="normalize-space(.)"/>
5117
- <fo:inline font-size="75%" role="SKIP">
5135
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5136
+ <xsl:variable name="text" select="."/>
5137
+ <xsl:variable name="ratio_">
5138
+ 0.75
5139
+ </xsl:variable>
5140
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5141
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
5118
5142
  <xsl:if test="string-length($text) &gt; 0">
5119
5143
  <xsl:variable name="smallCapsText">
5120
5144
  <xsl:call-template name="recursiveSmallCaps">
5121
5145
  <xsl:with-param name="text" select="$text"/>
5146
+ <xsl:with-param name="ratio" select="$ratio"/>
5122
5147
  </xsl:call-template>
5123
5148
  </xsl:variable>
5124
5149
  <!-- merge neighboring fo:inline -->
@@ -5155,12 +5180,13 @@
5155
5180
 
5156
5181
  <xsl:template name="recursiveSmallCaps">
5157
5182
  <xsl:param name="text"/>
5183
+ <xsl:param name="ratio"/>
5158
5184
  <xsl:variable name="char" select="substring($text,1,1)"/>
5159
5185
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5160
5186
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5161
5187
  <xsl:choose>
5162
5188
  <xsl:when test="$char=$upperCase">
5163
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5189
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5164
5190
  <xsl:value-of select="$upperCase"/>
5165
5191
  </fo:inline>
5166
5192
  </xsl:when>
@@ -5171,6 +5197,7 @@
5171
5197
  <xsl:if test="string-length($text) &gt; 1">
5172
5198
  <xsl:call-template name="recursiveSmallCaps">
5173
5199
  <xsl:with-param name="text" select="substring($text,2)"/>
5200
+ <xsl:with-param name="ratio" select="$ratio"/>
5174
5201
  </xsl:call-template>
5175
5202
  </xsl:if>
5176
5203
  </xsl:template>
@@ -5278,6 +5305,9 @@
5278
5305
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5279
5306
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5280
5307
  </xsl:if>
5308
+ <xsl:if test="$key = 'text-indent'">
5309
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5310
+ </xsl:if>
5281
5311
  </xsl:for-each>
5282
5312
  </xsl:variable>
5283
5313
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6680,6 +6710,11 @@
6680
6710
  </xsl:call-template>
6681
6711
  </xsl:template>
6682
6712
 
6713
+ <!-- command between two xref points to non-standard bibitem -->
6714
+ <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']]]">
6715
+ <xsl:value-of select="."/>
6716
+ </xsl:template>
6717
+
6683
6718
  <!-- ====== -->
6684
6719
  <!-- formula -->
6685
6720
  <!-- ====== -->
@@ -7321,16 +7356,44 @@
7321
7356
  </xsl:choose>
7322
7357
 
7323
7358
  <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"/>
7359
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7360
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7361
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7362
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7363
+
7364
+ <!-- Example: -->
7326
7365
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7327
7366
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7328
7367
  <!-- 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 -->
7368
+
7369
+ <xsl:variable name="scale_x">
7370
+ <xsl:choose>
7371
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7372
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7373
+ </xsl:when>
7374
+ <xsl:otherwise>1</xsl:otherwise>
7375
+ </xsl:choose>
7376
+ </xsl:variable>
7377
+ <xsl:variable name="scale_y">
7378
+ <xsl:choose>
7379
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7380
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7381
+ </xsl:when>
7382
+ <xsl:otherwise>1</xsl:otherwise>
7383
+ </xsl:choose>
7384
+ </xsl:variable>
7385
+
7386
+ <!-- for images with big height -->
7387
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7330
7388
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7331
7389
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7332
- </xsl:if>
7390
+ </xsl:if> -->
7333
7391
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7392
+
7393
+ <xsl:if test="$scale_y != 1">
7394
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7395
+ </xsl:if>
7396
+
7334
7397
  <xsl:copy-of select="$svg_content"/>
7335
7398
  </fo:instream-foreign-object>
7336
7399
  <!-- </fo:block> -->
@@ -7355,6 +7418,8 @@
7355
7418
  </xsl:attribute>
7356
7419
  </xsl:template>
7357
7420
 
7421
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
7422
+
7358
7423
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7359
7424
  <xsl:copy>
7360
7425
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -7368,8 +7433,13 @@
7368
7433
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7369
7434
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7370
7435
 
7436
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7437
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7438
+
7371
7439
  <xsl:attribute name="width">
7372
7440
  <xsl:choose>
7441
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7442
+ <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>
7373
7443
  <xsl:when test="$width != ''">
7374
7444
  <xsl:value-of select="round($width)"/>
7375
7445
  </xsl:when>
@@ -7378,6 +7448,8 @@
7378
7448
  </xsl:attribute>
7379
7449
  <xsl:attribute name="height">
7380
7450
  <xsl:choose>
7451
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7452
+ <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>
7381
7453
  <xsl:when test="$height != ''">
7382
7454
  <xsl:value-of select="round($height)"/>
7383
7455
  </xsl:when>
@@ -7389,6 +7461,28 @@
7389
7461
  </xsl:copy>
7390
7462
  </xsl:template>
7391
7463
 
7464
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7465
+ <!-- image[@width]/svg -->
7466
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7467
+ <xsl:attribute name="width">
7468
+ <xsl:choose>
7469
+ <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>
7470
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7471
+ </xsl:choose>
7472
+ </xsl:attribute>
7473
+ </xsl:template>
7474
+
7475
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7476
+ <!-- image[@height]/svg -->
7477
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7478
+ <xsl:attribute name="height">
7479
+ <xsl:choose>
7480
+ <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>
7481
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7482
+ </xsl:choose>
7483
+ </xsl:attribute>
7484
+ </xsl:template>
7485
+
7392
7486
  <!-- regex for 'display: inline-block;' -->
7393
7487
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7394
7488
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -8845,6 +8939,7 @@
8845
8939
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
8846
8940
  <xsl:if test="normalize-space() != ''">
8847
8941
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
8942
+ <xsl:call-template name="refine_termexample-name-style"/>
8848
8943
  <xsl:apply-templates/>
8849
8944
  </fo:inline>
8850
8945
  </xsl:if>
@@ -8995,6 +9090,7 @@
8995
9090
  </xsl:when>
8996
9091
  <xsl:otherwise>
8997
9092
  <fo:inline xsl:use-attribute-sets="example-name-style">
9093
+ <xsl:call-template name="refine_example-name-style"/>
8998
9094
  <xsl:apply-templates/>:
8999
9095
  </fo:inline>
9000
9096
  </xsl:otherwise>
@@ -9455,7 +9551,9 @@
9455
9551
  </xsl:template> <!-- sections_element_style -->
9456
9552
 
9457
9553
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9458
- <fo:block break-after="page"/>
9554
+
9555
+ <fo:block break-after="page"/>
9556
+
9459
9557
  <fo:block>
9460
9558
  <xsl:call-template name="setId"/>
9461
9559
  <xsl:apply-templates/>
@@ -9522,7 +9620,7 @@
9522
9620
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9523
9621
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9524
9622
  </xsl:when>
9525
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9623
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9526
9624
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9527
9625
  </xsl:when>
9528
9626
  </xsl:choose>
@@ -10244,6 +10342,7 @@
10244
10342
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10245
10343
  <xsl:otherwise>
10246
10344
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
10345
+
10247
10346
  <fo:list-item-label end-indent="label-end()">
10248
10347
  <fo:block role="SKIP">
10249
10348
  <fo:inline role="SKIP">
@@ -12006,4 +12105,6 @@
12006
12105
  </xsl:if>
12007
12106
  </xsl:template>
12008
12107
 
12108
+ <!-- update -->
12109
+
12009
12110
  </xsl:stylesheet>
@@ -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">
@@ -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>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.9.3".freeze
3
+ VERSION = "0.9.5".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.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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic