metanorma-iec 2.1.12 → 2.2.0

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: bfa8c3f25aec456954c3d70a6c1b35c887e60e99383c7f119f3ecfb1c5d6c545
4
- data.tar.gz: 787ad1b610bec9f60e5559f3cd721a3eadde25d327b5d2848d0905caaf5e0e7e
3
+ metadata.gz: fe5f071488c1b489abdf32da76363aaa976af39d6bfb84631225a3d08ad630bd
4
+ data.tar.gz: 94c952903d02e5de6934ed33ec9a45caa1fe930025c6391cc94d857c386e6ce5
5
5
  SHA512:
6
- metadata.gz: a4b3de46192f7fea611f9a091fdf9d40e6075270ba1422938e3ce60038f33a0828693ae95f98c0eb30b50142c5ed2baad982e5347c41f5722e10b155057fe75e
7
- data.tar.gz: 9308306c16d237d36d56ded5719f880df58564f74230e0f57c77d4a49acb8edf349bea24ca7303972a394f7c05e8a75d82ba368d266e8f8e346a6bde0b960e84
6
+ metadata.gz: b60c7395b02c317a03675b08f70be8b09b75d19b963aebcbf2355caa0f6ed7b832ede96e628aa3203546c0f27daaa75999e629b4cd89ff4473dc8ddcf34588d3
7
+ data.tar.gz: 0c13485be861d7abef84dadce587fbbc1306c2f2a4a95faefbcdd6029905a7e27534d14f1c9b551a1c950d939abbb56a7ccd67d034c8883dcd29bee25a264877
data/.gitignore CHANGED
@@ -5,7 +5,6 @@ coverage/
5
5
 
6
6
  .rubocop-https--*
7
7
 
8
- /Gemfile.devel
9
8
  /Gemfile.lock
10
9
  /spec/assets/iso.doc
11
10
  /spec/assets/iso.html
@@ -446,6 +446,12 @@ p.TermNum {
446
446
  padding-left: 30px; }
447
447
  #toc .h3, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h3 {
448
448
  padding-left: 50px; }
449
+ #toc .h4, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h4 {
450
+ padding-left: 70px; }
451
+ #toc .h5, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h5 {
452
+ padding-left: 90px; }
453
+ #toc .h6, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h6 {
454
+ padding-left: 110px; }
449
455
  #toc .toc-active, #toc li:hover, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .toc-active, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) li:hover {
450
456
  background: black;
451
457
  box-shadow: inset -5px 0px 10px -5px black !important; }
@@ -1972,6 +1972,8 @@
1972
1972
  </xsl:copy>
1973
1973
  </xsl:template> -->
1974
1974
 
1975
+ <xsl:strip-space elements="iec:xref"/>
1976
+
1975
1977
  <!-- external parameters -->
1976
1978
 
1977
1979
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -3406,17 +3408,22 @@
3406
3408
  </xsl:for-each>
3407
3409
  </xsl:template>
3408
3410
 
3411
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3409
3412
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3410
3413
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
3411
3414
  <xsl:template match="text()" name="text">
3412
3415
 
3413
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3414
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
3415
- <xsl:call-template name="replace_fo_inline_tags">
3416
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
3417
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
3418
- <xsl:with-param name="text" select="$text"/>
3419
- </xsl:call-template>
3416
+ <xsl:choose>
3417
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
3418
+ <xsl:otherwise>
3419
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
3420
+ <xsl:call-template name="replace_fo_inline_tags">
3421
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
3422
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
3423
+ <xsl:with-param name="text" select="$text"/>
3424
+ </xsl:call-template>
3425
+ </xsl:otherwise>
3426
+ </xsl:choose>
3420
3427
 
3421
3428
  </xsl:template>
3422
3429
 
@@ -3796,7 +3803,7 @@
3796
3803
 
3797
3804
  <!-- centered table when table name is centered (see table-name-style) -->
3798
3805
 
3799
- <fo:table table-layout="fixed" width="100%">
3806
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
3800
3807
  <fo:table-column column-width="proportional-column-width(1)"/>
3801
3808
  <fo:table-column column-width="{@width}"/>
3802
3809
  <fo:table-column column-width="proportional-column-width(1)"/>
@@ -4459,7 +4466,7 @@
4459
4466
  <xsl:template match="*[local-name()='tr']">
4460
4467
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
4461
4468
 
4462
- <xsl:if test="*[local-name() = 'th']">
4469
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
4463
4470
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4464
4471
  </xsl:if>
4465
4472
 
@@ -4630,6 +4637,10 @@
4630
4637
  <xsl:variable name="footnote_inline">
4631
4638
  <fo:inline xsl:use-attribute-sets="fn-num-style">
4632
4639
 
4640
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4641
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4642
+ </xsl:if>
4643
+
4633
4644
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4634
4645
  <xsl:value-of select="$current_fn_number_text"/>
4635
4646
  </fo:basic-link>
@@ -5447,7 +5458,8 @@
5447
5458
  <xsl:copy-of select="node()"/>
5448
5459
  </td>
5449
5460
  <td>
5450
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5461
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
5462
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
5451
5463
  <!-- get paragraphs from nested 'dl' -->
5452
5464
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5453
5465
  </td>
@@ -5455,6 +5467,53 @@
5455
5467
  </xsl:template>
5456
5468
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
5457
5469
 
5470
+ <xsl:template match="*" mode="dl_if">
5471
+ <xsl:copy-of select="."/>
5472
+ </xsl:template>
5473
+
5474
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
5475
+ <xsl:param name="indent"/>
5476
+ <p>
5477
+ <xsl:copy-of select="@*"/>
5478
+ <xsl:value-of select="$indent"/>
5479
+ <xsl:copy-of select="node()"/>
5480
+ </p>
5481
+
5482
+ </xsl:template>
5483
+
5484
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
5485
+ <xsl:variable name="list_rendered_">
5486
+ <xsl:apply-templates select="."/>
5487
+ </xsl:variable>
5488
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
5489
+
5490
+ <xsl:variable name="indent">
5491
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
5492
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
5493
+ </xsl:for-each>
5494
+ </xsl:variable>
5495
+
5496
+ <xsl:apply-templates mode="dl_if">
5497
+ <xsl:with-param name="indent" select="$indent"/>
5498
+ </xsl:apply-templates>
5499
+ </xsl:template>
5500
+
5501
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
5502
+ <xsl:param name="indent"/>
5503
+ <xsl:apply-templates mode="dl_if">
5504
+ <xsl:with-param name="indent" select="$indent"/>
5505
+ </xsl:apply-templates>
5506
+ </xsl:template>
5507
+
5508
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
5509
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
5510
+ <!-- emulate left indent for list item -->
5511
+ <xsl:call-template name="repeat">
5512
+ <xsl:with-param name="char" select="'x'"/>
5513
+ <xsl:with-param name="count" select="$value"/>
5514
+ </xsl:call-template>
5515
+ </xsl:template>
5516
+
5458
5517
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5459
5518
  <xsl:for-each select="*[local-name() = 'dt']">
5460
5519
  <p>
@@ -5752,6 +5811,23 @@
5752
5811
  <xsl:apply-templates/>
5753
5812
  </xsl:template>
5754
5813
 
5814
+ <!-- Don't break standard's numbers -->
5815
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
5816
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
5817
+ <xsl:choose>
5818
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5819
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5820
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5821
+ </xsl:when>
5822
+ <xsl:otherwise>
5823
+ <xsl:apply-templates/>
5824
+ </xsl:otherwise>
5825
+ </xsl:choose>
5826
+ </xsl:template>
5827
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
5828
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5829
+ </xsl:template>
5830
+
5755
5831
  <!-- ========================= -->
5756
5832
  <!-- END Rich text formatting -->
5757
5833
  <!-- ========================= -->
@@ -5850,6 +5926,7 @@
5850
5926
  </word>
5851
5927
  <xsl:call-template name="tokenize_with_tags">
5852
5928
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5929
+ <xsl:with-param name="tags" select="$tags"/>
5853
5930
  </xsl:call-template>
5854
5931
  </xsl:otherwise>
5855
5932
  </xsl:choose>
@@ -5889,8 +5966,18 @@
5889
5966
 
5890
5967
  <xsl:template name="add-zero-spaces-java">
5891
5968
  <xsl:param name="text" select="."/>
5892
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5893
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
5969
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
5970
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
5971
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
5972
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
5973
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
5974
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
5975
+ <!-- add zero-width space (#x200B) before character: { -->
5976
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5977
+ <!-- add zero-width space (#x200B) after character: , -->
5978
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5979
+
5980
+ <xsl:value-of select="$text5"/>
5894
5981
  </xsl:template>
5895
5982
 
5896
5983
  <xsl:template name="add-zero-spaces-link-java">
@@ -6036,7 +6123,7 @@
6036
6123
  </xsl:copy>
6037
6124
  </xsl:template>
6038
6125
 
6039
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
6126
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
6040
6127
  <xsl:copy>
6041
6128
  <xsl:copy-of select="@*"/>
6042
6129
  <p>
@@ -6084,6 +6171,28 @@
6084
6171
  </xsl:for-each>
6085
6172
  </xsl:template>
6086
6173
 
6174
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
6175
+ <xsl:apply-templates mode="table-without-br"/>
6176
+ </xsl:template>
6177
+
6178
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
6179
+
6180
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
6181
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
6182
+ <xsl:variable name="items">
6183
+ <xsl:call-template name="split">
6184
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
6185
+ <xsl:with-param name="sep" select="$sep"/>
6186
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6187
+ </xsl:call-template>
6188
+ </xsl:variable>
6189
+ <xsl:for-each select="xalan:nodeset($items)/*">
6190
+ <p>
6191
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
6192
+ </p>
6193
+ </xsl:for-each>
6194
+ </xsl:template>
6195
+
6087
6196
  <!-- remove redundant white spaces -->
6088
6197
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
6089
6198
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -6114,7 +6223,7 @@
6114
6223
  <xsl:choose>
6115
6224
  <xsl:when test="@colspan">
6116
6225
  <xsl:variable name="td">
6117
- <xsl:element name="td">
6226
+ <xsl:element name="{local-name()}">
6118
6227
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
6119
6228
  <xsl:if test="local-name()='th'">
6120
6229
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -6129,7 +6238,7 @@
6129
6238
  </xsl:call-template>
6130
6239
  </xsl:when>
6131
6240
  <xsl:otherwise>
6132
- <xsl:element name="td">
6241
+ <xsl:element name="{local-name()}">
6133
6242
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
6134
6243
  <xsl:if test="local-name()='th'">
6135
6244
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -6196,7 +6305,7 @@
6196
6305
  <xsl:variable name="currentRow" select="."/>
6197
6306
 
6198
6307
  <xsl:variable name="normalizedTDs">
6199
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
6308
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
6200
6309
  <xsl:choose>
6201
6310
  <xsl:when test="@rowspan &gt; 1">
6202
6311
  <xsl:copy>
@@ -6208,7 +6317,7 @@
6208
6317
  </xsl:copy>
6209
6318
  </xsl:when>
6210
6319
  <xsl:otherwise>
6211
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
6320
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
6212
6321
  </xsl:otherwise>
6213
6322
  </xsl:choose>
6214
6323
  </xsl:for-each>
@@ -6394,6 +6503,7 @@
6394
6503
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
6395
6504
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
6396
6505
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6506
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
6397
6507
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6398
6508
  </tags>
6399
6509
  </xsl:template>
@@ -7384,6 +7494,31 @@
7384
7494
  <xsl:apply-templates mode="svg_update"/>
7385
7495
  </xsl:copy>
7386
7496
  </xsl:template>
7497
+
7498
+ <!-- regex for 'display: inline-block;' -->
7499
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7500
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
7501
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
7502
+ </xsl:template>
7503
+
7504
+ <!-- replace
7505
+ stroke="rgba(r, g, b, alpha)" to
7506
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
7507
+ fill="rgba(r, g, b, alpha)" to
7508
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
7509
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
7510
+ <xsl:variable name="components_">
7511
+ <xsl:call-template name="split">
7512
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
7513
+ <xsl:with-param name="sep" select="','"/>
7514
+ </xsl:call-template>
7515
+ </xsl:variable>
7516
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
7517
+ <xsl:variable name="att_name" select="local-name()"/>
7518
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
7519
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
7520
+ </xsl:template>
7521
+
7387
7522
  <!-- ============== -->
7388
7523
  <!-- END: svg_update -->
7389
7524
  <!-- ============== -->
@@ -8033,39 +8168,17 @@
8033
8168
  <!-- =============== -->
8034
8169
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
8035
8170
 
8036
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
8037
-
8038
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
8039
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
8040
- </xsl:if>
8041
-
8042
- <xsl:if test="ancestor::*[local-name() = 'example']">
8043
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
8044
- </xsl:if>
8045
-
8046
- <xsl:copy-of select="@id"/>
8047
-
8048
- <xsl:if test="parent::*[local-name() = 'note']">
8049
- <xsl:attribute name="margin-left">
8050
- <xsl:choose>
8051
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
8052
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
8053
- </xsl:choose>
8054
- </xsl:attribute>
8055
-
8056
- </xsl:if>
8057
- <fo:block-container margin-left="0mm">
8058
-
8059
- <fo:block xsl:use-attribute-sets="sourcecode-style">
8060
- <xsl:variable name="_font-size">
8171
+ <xsl:variable name="sourcecode_attributes">
8172
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
8173
+ <xsl:variable name="_font-size">
8061
8174
 
8062
- 9
8175
+ 9
8063
8176
 
8064
- <!-- 9 -->
8177
+ <!-- 9 -->
8065
8178
 
8066
- <!-- <xsl:if test="$namespace = 'ieee'">
8067
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
8068
- </xsl:if> -->
8179
+ <!-- <xsl:if test="$namespace = 'ieee'">
8180
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
8181
+ </xsl:if> -->
8069
8182
 
8070
8183
  </xsl:variable>
8071
8184
 
@@ -8080,14 +8193,60 @@
8080
8193
  </xsl:choose>
8081
8194
  </xsl:attribute>
8082
8195
  </xsl:if>
8196
+ </xsl:element>
8197
+ </xsl:variable>
8083
8198
 
8199
+ <xsl:choose>
8200
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
8201
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
8202
+ <xsl:attribute name="{local-name()}">
8203
+ <xsl:value-of select="."/>
8204
+ </xsl:attribute>
8205
+ </xsl:for-each>
8084
8206
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8085
- </fo:block>
8207
+ </xsl:when>
8086
8208
 
8087
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8209
+ <xsl:otherwise>
8210
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
8088
8211
 
8089
- </fo:block-container>
8090
- </fo:block-container>
8212
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
8213
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
8214
+ </xsl:if>
8215
+
8216
+ <xsl:if test="ancestor::*[local-name() = 'example']">
8217
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
8218
+ </xsl:if>
8219
+
8220
+ <xsl:copy-of select="@id"/>
8221
+
8222
+ <xsl:if test="parent::*[local-name() = 'note']">
8223
+ <xsl:attribute name="margin-left">
8224
+ <xsl:choose>
8225
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
8226
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
8227
+ </xsl:choose>
8228
+ </xsl:attribute>
8229
+
8230
+ </xsl:if>
8231
+ <fo:block-container margin-left="0mm">
8232
+
8233
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
8234
+
8235
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
8236
+ <xsl:attribute name="{local-name()}">
8237
+ <xsl:value-of select="."/>
8238
+ </xsl:attribute>
8239
+ </xsl:for-each>
8240
+
8241
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8242
+ </fo:block>
8243
+
8244
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8245
+
8246
+ </fo:block-container>
8247
+ </fo:block-container>
8248
+ </xsl:otherwise>
8249
+ </xsl:choose>
8091
8250
  </xsl:template>
8092
8251
 
8093
8252
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -10320,7 +10479,11 @@
10320
10479
  <!-- ===================================== -->
10321
10480
  <!-- Update xml -->
10322
10481
  <!-- ===================================== -->
10323
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10482
+ <!-- =========================================================================== -->
10483
+ <!-- STEP1: -->
10484
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
10485
+ <!-- - Ignore 'span' without style -->
10486
+ <!-- =========================================================================== -->
10324
10487
  <xsl:template match="@*|node()" mode="update_xml_step1">
10325
10488
  <xsl:copy>
10326
10489
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -10402,7 +10565,8 @@
10402
10565
  </xsl:copy>
10403
10566
  </xsl:template>
10404
10567
 
10405
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
10568
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
10569
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
10406
10570
  <xsl:copy>
10407
10571
  <xsl:copy-of select="@*"/>
10408
10572
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -10412,10 +10576,15 @@
10412
10576
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10413
10577
  <xsl:apply-templates mode="update_xml_step1"/>
10414
10578
  </xsl:template>
10415
-
10579
+ <!-- =========================================================================== -->
10416
10580
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10581
+ <!-- =========================================================================== -->
10417
10582
 
10583
+ <!-- =========================================================================== -->
10418
10584
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10585
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
10586
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10587
+ <!-- =========================================================================== -->
10419
10588
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
10420
10589
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
10421
10590
  <xsl:copy>
@@ -10431,10 +10600,15 @@
10431
10600
  <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
10432
10601
 
10433
10602
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
10434
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
10435
10603
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
10436
10604
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
10437
- <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
10605
+ <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
10606
+ <xsl:variable name="text_">
10607
+ <xsl:choose>
10608
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
10609
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
10610
+ </xsl:choose>
10611
+ </xsl:variable>
10438
10612
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
10439
10613
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
10440
10614
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -10450,7 +10624,11 @@
10450
10624
  </xsl:variable>
10451
10625
 
10452
10626
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
10453
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
10627
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10628
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10629
+ <!-- add &lt; and &gt; to \S -->
10630
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
10631
+ <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
10454
10632
  <xsl:variable name="text3">
10455
10633
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
10456
10634
  <xsl:choose>
@@ -10514,9 +10692,8 @@
10514
10692
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
10515
10693
  </xsl:choose>
10516
10694
  </xsl:template>
10517
-
10518
10695
  <!-- ===================================== -->
10519
- <!-- End Update xml -->
10696
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10520
10697
  <!-- ===================================== -->
10521
10698
 
10522
10699
  <!-- for correct rendering combining chars -->
@@ -124,7 +124,7 @@ module IsoDoc
124
124
  p = d.parent
125
125
  designation_annotate(p, d.at(ns("./name")))
126
126
  m << { lang: lg, script: Metanorma::Utils.default_script(lg),
127
- designation: l10n_recursive(p.remove, lg).to_xml.strip }
127
+ designation: to_xml(l10n_recursive(p.remove, lg)).strip }
128
128
  end
129
129
  end
130
130
 
@@ -183,7 +183,7 @@ module IsoDoc
183
183
  ref = node.at(ns("./xref | ./eref | ./termref"))
184
184
  label = @i18n.relatedterms[node["type"]].upcase
185
185
  node.replace(l10n("<p>#{label}: " \
186
- "#{p.children.to_xml} (#{ref.to_xml})</p>"))
186
+ "#{to_xml(p.children)} (#{to_xml(ref)})</p>"))
187
187
  @i18n = @i18n_lg["default"]
188
188
  end
189
189
 
@@ -205,9 +205,9 @@ module IsoDoc
205
205
 
206
206
  def termsource1_iev(elem)
207
207
  while elem&.next_element&.name == "termsource"
208
- elem << "; #{elem.next_element.remove.children.to_xml}"
208
+ elem << "; #{to_xml(elem.next_element.remove.children)}"
209
209
  end
210
- elem.children = l10n("#{@i18n.source}: #{elem.children.to_xml.strip}")
210
+ elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
211
211
  end
212
212
 
213
213
  def termexample(docxml)
@@ -42,50 +42,24 @@ module IsoDoc
42
42
  }
43
43
  end
44
44
 
45
- def insert_toc(intro, docxml, level)
45
+ def make_table_word_toc(docxml)
46
+ docxml.at(table_toc_xpath) or return ""
46
47
  toc = ""
47
- toc += make_WordToC(docxml, level)
48
- if docxml.at("//p[@class = 'TableTitle']")
49
- toc += make_TableWordToC(docxml)
50
- end
51
- if docxml.at("//p[@class = 'FigureTitle']")
52
- toc += make_FigureWordToC(docxml)
53
- end
54
- intro.sub(/WORDTOC/, toc)
55
- end
56
-
57
- WORD_TOC_TABLE_PREFACE1 = <<~TOC.freeze
58
- <span lang="EN-GB"><span
59
- style='mso-element:field-begin'></span><span
60
- style='mso-spacerun:yes'>&#xA0;</span>TOC
61
- \\h \\z \\t "TableTitle,tabletitle" <span
62
- style='mso-element:field-separator'></span></span>
63
- TOC
64
-
65
- WORD_TOC_FIGURE_PREFACE1 = <<~TOC.freeze
66
- <span lang="EN-GB"><span
67
- style='mso-element:field-begin'></span><span
68
- style='mso-spacerun:yes'>&#xA0;</span>TOC
69
- \\h \\z \\t "FigureTitle,figuretitle" <span
70
- style='mso-element:field-separator'></span></span>
71
- TOC
72
-
73
- def make_TableWordToC(docxml)
74
- toc = ""
75
- docxml.xpath("//p[@class = 'TableTitle']").each do |h|
48
+ docxml.xpath(table_toc_xpath).each do |h|
76
49
  toc += word_toc_entry(1, header_strip(h))
77
50
  end
78
51
  toc.sub(/(<p class="MsoToc1">)/,
79
- %{\\1#{WORD_TOC_TABLE_PREFACE1}}) + WORD_TOC_SUFFIX1
52
+ %{\\1#{word_toc_table_preface1}}) + WORD_TOC_SUFFIX1
80
53
  end
81
54
 
82
- def make_FigureWordToC(docxml)
55
+ def make_figure_word_toc(docxml)
56
+ docxml.at(figure_toc_xpath) or return ""
83
57
  toc = ""
84
- docxml.xpath("//p[@class = 'FigureTitle']").each do |h|
58
+ docxml.xpath(figure_toc_xpath).each do |h|
85
59
  toc += word_toc_entry(1, header_strip(h))
86
60
  end
87
61
  toc.sub(/(<p class="MsoToc1">)/,
88
- %{\\1#{WORD_TOC_FIGURE_PREFACE1}}) + WORD_TOC_SUFFIX1
62
+ %{\\1#{word_toc_figure_preface1}}) + WORD_TOC_SUFFIX1
89
63
  end
90
64
 
91
65
  def word_toc_preface(level)
@@ -185,7 +159,7 @@ module IsoDoc
185
159
  end
186
160
 
187
161
  def authority_cleanup(docxml)
188
- auth = docxml.at("//div[@id = 'boilerplate-feedback' or "\
162
+ auth = docxml.at("//div[@id = 'boilerplate-feedback' or " \
189
163
  "@class = 'boilerplate-feedback']")
190
164
  auth&.remove
191
165
  super
@@ -683,6 +683,9 @@
683
683
  </define>
684
684
  <define name="underline">
685
685
  <element name="underline">
686
+ <optional>
687
+ <attribute name="style"/>
688
+ </optional>
686
689
  <zeroOrMore>
687
690
  <ref name="PureTextElement"/>
688
691
  </zeroOrMore>
@@ -1152,7 +1152,7 @@
1152
1152
  <data type="boolean"/>
1153
1153
  </attribute>
1154
1154
  </optional>
1155
- <ref name="BibliographicItem"/>
1155
+ <ref name="ReducedBibliographicItem"/>
1156
1156
  </element>
1157
1157
  </define>
1158
1158
  <define name="image" combine="choice">
@@ -2653,6 +2653,7 @@
2653
2653
  <value>full</value>
2654
2654
  <value>short</value>
2655
2655
  <value>id</value>
2656
+ <value>modspec</value>
2656
2657
  </choice>
2657
2658
  </define>
2658
2659
  <define name="erefTypeWithConnective">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.1.12".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
6
6
 
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
32
32
 
33
- spec.add_dependency "metanorma-iso", "~> 2.2.0"
33
+ spec.add_dependency "metanorma-iso", "~> 2.3.0"
34
34
  spec.add_dependency "ruby-jing"
35
35
 
36
36
  spec.add_development_dependency "debug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.12
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.0
19
+ version: 2.3.0
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.2.0
26
+ version: 2.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-jing
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.3.7
273
+ rubygems_version: 3.3.26
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: metanorma-iec lets you write IEC standards in AsciiDoc.