metanorma-itu 2.1.11 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/html/html_itu_titlepage.html +1 -1
  3. data/lib/isodoc/itu/html/htmlstyle.css +6 -0
  4. data/lib/isodoc/itu/html_convert.rb +1 -1
  5. data/lib/isodoc/itu/i18n-ar.yaml +6 -0
  6. data/lib/isodoc/itu/i18n-de.yaml +6 -0
  7. data/lib/isodoc/itu/i18n-en.yaml +6 -0
  8. data/lib/isodoc/itu/i18n-es.yaml +13 -0
  9. data/lib/isodoc/itu/i18n-fr.yaml +6 -0
  10. data/lib/isodoc/itu/i18n-ru.yaml +6 -0
  11. data/lib/isodoc/itu/i18n-zh-Hans.yaml +2 -0
  12. data/lib/isodoc/itu/init.rb +1 -1
  13. data/lib/isodoc/itu/itu.implementers-guide.xsl +312 -73
  14. data/lib/isodoc/itu/itu.in-force.xsl +312 -73
  15. data/lib/isodoc/itu/itu.recommendation-annex.xsl +312 -73
  16. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +312 -73
  17. data/lib/isodoc/itu/itu.recommendation.xsl +312 -73
  18. data/lib/isodoc/itu/itu.resolution.xsl +312 -73
  19. data/lib/isodoc/itu/itu.service-publication.xsl +312 -73
  20. data/lib/isodoc/itu/itu.technical-paper.xsl +312 -73
  21. data/lib/isodoc/itu/itu.technical-report.xsl +312 -73
  22. data/lib/isodoc/itu/pdf_convert.rb +1 -1
  23. data/lib/isodoc/itu/presentation_bibdata.rb +87 -0
  24. data/lib/isodoc/itu/presentation_xml_convert.rb +79 -106
  25. data/lib/isodoc/itu/word_convert.rb +1 -1
  26. data/lib/isodoc/itu/xref.rb +5 -5
  27. data/lib/metanorma/itu/biblio.rng +5 -0
  28. data/lib/metanorma/itu/converter.rb +2 -2
  29. data/lib/metanorma/itu/isodoc.rng +47 -13
  30. data/lib/metanorma/itu/version.rb +1 -1
  31. data/metanorma-itu.gemspec +3 -2
  32. metadata +5 -11
  33. data/.github/workflows/automerge.yml +0 -31
  34. data/.github/workflows/rake.yml +0 -15
  35. data/.github/workflows/release.yml +0 -24
  36. data/Rakefile +0 -8
  37. data/bin/console +0 -14
  38. data/bin/rspec +0 -17
  39. data/bin/setup +0 -8
@@ -219,7 +219,7 @@
219
219
  <fo:page-sequence master-reference="TR-first-page">
220
220
  <fo:flow flow-name="xsl-region-body">
221
221
  <fo:block>
222
- <fo:table width="175mm" table-layout="fixed" border-top="1.5pt solid black">
222
+ <fo:table width="175mm" table-layout="fixed" border-top="1.5pt solid black" id="__internal_layout__meeting_{generate-id()}">
223
223
  <fo:table-column column-width="29mm"/>
224
224
  <fo:table-column column-width="45mm"/>
225
225
  <fo:table-column column-width="28mm"/>
@@ -252,7 +252,7 @@
252
252
  </fo:table-body>
253
253
  </fo:table>
254
254
 
255
- <fo:table width="175mm" table-layout="fixed">
255
+ <fo:table width="175mm" table-layout="fixed" id="__internal_layout__groups_{generate-id()}">
256
256
  <fo:table-column column-width="29mm"/>
257
257
  <fo:table-column column-width="10mm"/>
258
258
  <fo:table-column column-width="35mm"/>
@@ -300,7 +300,7 @@
300
300
  </fo:table>
301
301
 
302
302
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:person">
303
- <fo:table width="175mm" table-layout="fixed" line-height="110%">
303
+ <fo:table width="175mm" table-layout="fixed" line-height="110%" id="__internal_layout__person_{generate-id()}">
304
304
  <fo:table-column column-width="29mm"/>
305
305
  <fo:table-column column-width="75mm"/>
306
306
  <fo:table-column column-width="71mm"/>
@@ -538,7 +538,7 @@
538
538
  </fo:block-container>
539
539
  <fo:block-container font-family="Arial">
540
540
  <xsl:variable name="annexid" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid)"/>
541
- <fo:table width="100%" table-layout="fixed"> <!-- 175.4mm-->
541
+ <fo:table width="100%" table-layout="fixed" id="__internal_layout__coverpage_{generate-id()}"> <!-- 175.4mm-->
542
542
  <fo:table-column column-width="25.2mm"/>
543
543
  <fo:table-column column-width="44.4mm"/>
544
544
  <fo:table-column column-width="35.8mm"/>
@@ -2049,6 +2049,8 @@
2049
2049
  </xsl:if>
2050
2050
  </xsl:template>
2051
2051
 
2052
+ <xsl:strip-space elements="itu:xref"/>
2053
+
2052
2054
  <!-- external parameters -->
2053
2055
 
2054
2056
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -2467,6 +2469,14 @@
2467
2469
 
2468
2470
  </xsl:attribute-set>
2469
2471
 
2472
+ <xsl:attribute-set name="pre-style">
2473
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2474
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2475
+
2476
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2477
+
2478
+ </xsl:attribute-set>
2479
+
2470
2480
  <xsl:attribute-set name="permission-style">
2471
2481
 
2472
2482
  </xsl:attribute-set>
@@ -2570,6 +2580,11 @@
2570
2580
  </xsl:variable>
2571
2581
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
2572
2582
 
2583
+ <xsl:variable name="table-cell-border_">
2584
+
2585
+ </xsl:variable>
2586
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
2587
+
2573
2588
  <xsl:attribute-set name="table-container-style">
2574
2589
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2575
2590
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -2582,8 +2597,6 @@
2582
2597
  <xsl:attribute-set name="table-style">
2583
2598
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2584
2599
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
2585
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2586
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2587
2600
 
2588
2601
  </xsl:attribute-set><!-- table-style -->
2589
2602
 
@@ -3415,17 +3428,22 @@
3415
3428
  </xsl:for-each>
3416
3429
  </xsl:template>
3417
3430
 
3431
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3418
3432
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3419
3433
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
3420
3434
  <xsl:template match="text()" name="text">
3421
3435
 
3422
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3423
- <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))"/>
3424
- <xsl:call-template name="replace_fo_inline_tags">
3425
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
3426
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
3427
- <xsl:with-param name="text" select="$text"/>
3428
- </xsl:call-template>
3436
+ <xsl:choose>
3437
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
3438
+ <xsl:otherwise>
3439
+ <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))"/>
3440
+ <xsl:call-template name="replace_fo_inline_tags">
3441
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
3442
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
3443
+ <xsl:with-param name="text" select="$text"/>
3444
+ </xsl:call-template>
3445
+ </xsl:otherwise>
3446
+ </xsl:choose>
3429
3447
 
3430
3448
  </xsl:template>
3431
3449
 
@@ -3698,6 +3716,12 @@
3698
3716
  <xsl:variable name="table_attributes">
3699
3717
 
3700
3718
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
3719
+
3720
+ <xsl:if test="$margin-side != 0">
3721
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3722
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3723
+ </xsl:if>
3724
+
3701
3725
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3702
3726
 
3703
3727
  <xsl:if test="$doctype = 'service-publication'">
@@ -3805,7 +3829,7 @@
3805
3829
 
3806
3830
  <!-- centered table when table name is centered (see table-name-style) -->
3807
3831
 
3808
- <fo:table table-layout="fixed" width="100%">
3832
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
3809
3833
  <fo:table-column column-width="proportional-column-width(1)"/>
3810
3834
  <fo:table-column column-width="{@width}"/>
3811
3835
  <fo:table-column column-width="proportional-column-width(1)"/>
@@ -4481,6 +4505,10 @@
4481
4505
  <xsl:template match="*[local-name()='tr']">
4482
4506
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
4483
4507
 
4508
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
4509
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4510
+ </xsl:if>
4511
+
4484
4512
  <xsl:call-template name="setTableRowAttributes"/>
4485
4513
  <xsl:apply-templates/>
4486
4514
  </fo:table-row>
@@ -5485,7 +5513,8 @@
5485
5513
  <xsl:copy-of select="node()"/>
5486
5514
  </td>
5487
5515
  <td>
5488
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5516
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
5517
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
5489
5518
  <!-- get paragraphs from nested 'dl' -->
5490
5519
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5491
5520
  </td>
@@ -5493,6 +5522,53 @@
5493
5522
  </xsl:template>
5494
5523
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
5495
5524
 
5525
+ <xsl:template match="*" mode="dl_if">
5526
+ <xsl:copy-of select="."/>
5527
+ </xsl:template>
5528
+
5529
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
5530
+ <xsl:param name="indent"/>
5531
+ <p>
5532
+ <xsl:copy-of select="@*"/>
5533
+ <xsl:value-of select="$indent"/>
5534
+ <xsl:copy-of select="node()"/>
5535
+ </p>
5536
+
5537
+ </xsl:template>
5538
+
5539
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
5540
+ <xsl:variable name="list_rendered_">
5541
+ <xsl:apply-templates select="."/>
5542
+ </xsl:variable>
5543
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
5544
+
5545
+ <xsl:variable name="indent">
5546
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
5547
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
5548
+ </xsl:for-each>
5549
+ </xsl:variable>
5550
+
5551
+ <xsl:apply-templates mode="dl_if">
5552
+ <xsl:with-param name="indent" select="$indent"/>
5553
+ </xsl:apply-templates>
5554
+ </xsl:template>
5555
+
5556
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
5557
+ <xsl:param name="indent"/>
5558
+ <xsl:apply-templates mode="dl_if">
5559
+ <xsl:with-param name="indent" select="$indent"/>
5560
+ </xsl:apply-templates>
5561
+ </xsl:template>
5562
+
5563
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
5564
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
5565
+ <!-- emulate left indent for list item -->
5566
+ <xsl:call-template name="repeat">
5567
+ <xsl:with-param name="char" select="'x'"/>
5568
+ <xsl:with-param name="count" select="$value"/>
5569
+ </xsl:call-template>
5570
+ </xsl:template>
5571
+
5496
5572
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5497
5573
  <xsl:for-each select="*[local-name() = 'dt']">
5498
5574
  <p>
@@ -5886,6 +5962,7 @@
5886
5962
  </word>
5887
5963
  <xsl:call-template name="tokenize_with_tags">
5888
5964
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5965
+ <xsl:with-param name="tags" select="$tags"/>
5889
5966
  </xsl:call-template>
5890
5967
  </xsl:otherwise>
5891
5968
  </xsl:choose>
@@ -5925,8 +6002,18 @@
5925
6002
 
5926
6003
  <xsl:template name="add-zero-spaces-java">
5927
6004
  <xsl:param name="text" select="."/>
5928
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5929
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
6005
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
6006
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
6007
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
6008
+ <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' -->
6009
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
6010
+ <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' -->
6011
+ <!-- add zero-width space (#x200B) before character: { -->
6012
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
6013
+ <!-- add zero-width space (#x200B) after character: , -->
6014
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
6015
+
6016
+ <xsl:value-of select="$text5"/>
5930
6017
  </xsl:template>
5931
6018
 
5932
6019
  <xsl:template name="add-zero-spaces-link-java">
@@ -6072,7 +6159,7 @@
6072
6159
  </xsl:copy>
6073
6160
  </xsl:template>
6074
6161
 
6075
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
6162
+ <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">
6076
6163
  <xsl:copy>
6077
6164
  <xsl:copy-of select="@*"/>
6078
6165
  <p>
@@ -6120,6 +6207,28 @@
6120
6207
  </xsl:for-each>
6121
6208
  </xsl:template>
6122
6209
 
6210
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
6211
+ <xsl:apply-templates mode="table-without-br"/>
6212
+ </xsl:template>
6213
+
6214
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
6215
+
6216
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
6217
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
6218
+ <xsl:variable name="items">
6219
+ <xsl:call-template name="split">
6220
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
6221
+ <xsl:with-param name="sep" select="$sep"/>
6222
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6223
+ </xsl:call-template>
6224
+ </xsl:variable>
6225
+ <xsl:for-each select="xalan:nodeset($items)/*">
6226
+ <p>
6227
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
6228
+ </p>
6229
+ </xsl:for-each>
6230
+ </xsl:template>
6231
+
6123
6232
  <!-- remove redundant white spaces -->
6124
6233
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
6125
6234
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -6430,6 +6539,7 @@
6430
6539
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
6431
6540
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
6432
6541
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6542
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
6433
6543
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6434
6544
  </tags>
6435
6545
  </xsl:template>
@@ -6492,6 +6602,9 @@
6492
6602
  <xsl:value-of select="substring($str, 2)"/>
6493
6603
  </xsl:template>
6494
6604
 
6605
+ <!-- ======================================= -->
6606
+ <!-- math -->
6607
+ <!-- ======================================= -->
6495
6608
  <xsl:template match="mathml:math">
6496
6609
  <xsl:variable name="isAdded" select="@added"/>
6497
6610
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -6542,14 +6655,57 @@
6542
6655
  <xsl:value-of select="$comment_text"/>
6543
6656
  </xsl:template>
6544
6657
 
6658
+ <xsl:template match="*[local-name() = 'asciimath']">
6659
+ <xsl:param name="process" select="'false'"/>
6660
+ <xsl:if test="$process = 'true'">
6661
+ <xsl:apply-templates/>
6662
+ </xsl:if>
6663
+ </xsl:template>
6664
+
6665
+ <xsl:template match="*[local-name() = 'latexmath']"/>
6666
+
6667
+ <xsl:template name="getMathml_asciimath_text">
6668
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
6669
+ <xsl:variable name="latexmath">
6670
+
6671
+ </xsl:variable>
6672
+ <xsl:variable name="asciimath_text_following">
6673
+ <xsl:choose>
6674
+ <xsl:when test="normalize-space($latexmath) != ''">
6675
+ <xsl:value-of select="$latexmath"/>
6676
+ </xsl:when>
6677
+ <xsl:when test="normalize-space($asciimath) != ''">
6678
+ <xsl:value-of select="$asciimath"/>
6679
+ </xsl:when>
6680
+ <xsl:otherwise>
6681
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
6682
+ </xsl:otherwise>
6683
+ </xsl:choose>
6684
+ </xsl:variable>
6685
+ <xsl:variable name="asciimath_text_">
6686
+ <xsl:choose>
6687
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
6688
+ <xsl:value-of select="$asciimath_text_following"/>
6689
+ </xsl:when>
6690
+ <xsl:otherwise>
6691
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
6692
+ </xsl:otherwise>
6693
+ </xsl:choose>
6694
+ </xsl:variable>
6695
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
6696
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
6697
+ <xsl:value-of select="$asciimath_text"/>
6698
+ </xsl:template>
6699
+
6545
6700
  <xsl:template name="mathml_instream_object">
6546
- <xsl:param name="comment_text"/>
6701
+ <xsl:param name="asciimath_text"/>
6547
6702
  <xsl:param name="mathml_content"/>
6548
6703
 
6549
- <xsl:variable name="comment_text_">
6704
+ <xsl:variable name="asciimath_text_">
6550
6705
  <xsl:choose>
6551
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
6552
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
6706
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
6707
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
6708
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
6553
6709
  </xsl:choose>
6554
6710
  </xsl:variable>
6555
6711
 
@@ -6566,10 +6722,10 @@
6566
6722
  </xsl:attribute>
6567
6723
 
6568
6724
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6569
- <xsl:if test="normalize-space($comment_text_) != ''">
6725
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
6570
6726
  <!-- put Mathin Alternate Text -->
6571
6727
  <xsl:attribute name="fox:alt-text">
6572
- <xsl:value-of select="$comment_text_"/>
6728
+ <xsl:value-of select="$asciimath_text_"/>
6573
6729
  </xsl:attribute>
6574
6730
  </xsl:if>
6575
6731
  <!-- </xsl:if> -->
@@ -6642,6 +6798,29 @@
6642
6798
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6643
6799
  </xsl:template>
6644
6800
 
6801
+ <!-- Examples:
6802
+ <stem type="AsciiMath">x = 1</stem>
6803
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
6804
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
6805
+ -->
6806
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6807
+ <fo:inline xsl:use-attribute-sets="mathml-style">
6808
+
6809
+ <xsl:choose>
6810
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6811
+ <xsl:otherwise>
6812
+ <xsl:apply-templates>
6813
+ <xsl:with-param name="process">true</xsl:with-param>
6814
+ </xsl:apply-templates>
6815
+ </xsl:otherwise>
6816
+ </xsl:choose>
6817
+
6818
+ </fo:inline>
6819
+ </xsl:template>
6820
+ <!-- ======================================= -->
6821
+ <!-- END: math -->
6822
+ <!-- ======================================= -->
6823
+
6645
6824
  <xsl:template match="*[local-name()='localityStack']"/>
6646
6825
 
6647
6826
  <xsl:template match="*[local-name()='link']" name="link">
@@ -6844,6 +7023,12 @@
6844
7023
 
6845
7024
  <fo:block-container margin-left="0mm">
6846
7025
 
7026
+ <!-- <xsl:if test="$namespace = 'iho'">
7027
+ <xsl:if test="ancestor::iho:td">
7028
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
7029
+ </xsl:if>
7030
+ </xsl:if> -->
7031
+
6847
7032
  <fo:block>
6848
7033
 
6849
7034
  <xsl:if test="ancestor::itu:figure">
@@ -7986,43 +8171,21 @@
7986
8171
  <xsl:apply-templates mode="contents_item"/>
7987
8172
  </xsl:template>
7988
8173
 
7989
- <!-- ====== -->
7990
- <!-- sourcecode -->
7991
- <!-- ====== -->
8174
+ <!-- =============== -->
8175
+ <!-- sourcecode -->
8176
+ <!-- =============== -->
7992
8177
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7993
8178
 
7994
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
8179
+ <xsl:variable name="sourcecode_attributes">
8180
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
8181
+ <xsl:variable name="_font-size">
7995
8182
 
7996
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
7997
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
7998
- </xsl:if>
7999
-
8000
- <xsl:if test="ancestor::*[local-name() = 'example']">
8001
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
8002
- </xsl:if>
8003
-
8004
- <xsl:copy-of select="@id"/>
8183
+ <!-- 9 -->
8005
8184
 
8006
- <xsl:if test="parent::*[local-name() = 'note']">
8007
- <xsl:attribute name="margin-left">
8008
- <xsl:choose>
8009
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
8010
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
8011
- </xsl:choose>
8012
- </xsl:attribute>
8013
-
8014
- </xsl:if>
8015
- <fo:block-container margin-left="0mm">
8016
-
8017
- <fo:block xsl:use-attribute-sets="sourcecode-style">
8018
- <xsl:variable name="_font-size">
8019
-
8020
- <!-- 9 -->
8021
-
8022
- <!-- <xsl:if test="$namespace = 'ieee'">
8023
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
8024
- </xsl:if> -->
8025
- 10
8185
+ <!-- <xsl:if test="$namespace = 'ieee'">
8186
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
8187
+ </xsl:if> -->
8188
+ 10
8026
8189
 
8027
8190
 
8028
8191
  </xsl:variable>
@@ -8038,14 +8201,60 @@
8038
8201
  </xsl:choose>
8039
8202
  </xsl:attribute>
8040
8203
  </xsl:if>
8204
+ </xsl:element>
8205
+ </xsl:variable>
8041
8206
 
8207
+ <xsl:choose>
8208
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
8209
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
8210
+ <xsl:attribute name="{local-name()}">
8211
+ <xsl:value-of select="."/>
8212
+ </xsl:attribute>
8213
+ </xsl:for-each>
8042
8214
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8043
- </fo:block>
8215
+ </xsl:when>
8044
8216
 
8045
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8217
+ <xsl:otherwise>
8218
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
8046
8219
 
8047
- </fo:block-container>
8048
- </fo:block-container>
8220
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
8221
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
8222
+ </xsl:if>
8223
+
8224
+ <xsl:if test="ancestor::*[local-name() = 'example']">
8225
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
8226
+ </xsl:if>
8227
+
8228
+ <xsl:copy-of select="@id"/>
8229
+
8230
+ <xsl:if test="parent::*[local-name() = 'note']">
8231
+ <xsl:attribute name="margin-left">
8232
+ <xsl:choose>
8233
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
8234
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
8235
+ </xsl:choose>
8236
+ </xsl:attribute>
8237
+
8238
+ </xsl:if>
8239
+ <fo:block-container margin-left="0mm">
8240
+
8241
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
8242
+
8243
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
8244
+ <xsl:attribute name="{local-name()}">
8245
+ <xsl:value-of select="."/>
8246
+ </xsl:attribute>
8247
+ </xsl:for-each>
8248
+
8249
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8250
+ </fo:block>
8251
+
8252
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8253
+
8254
+ </fo:block-container>
8255
+ </fo:block-container>
8256
+ </xsl:otherwise>
8257
+ </xsl:choose>
8049
8258
  </xsl:template>
8050
8259
 
8051
8260
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -8287,8 +8496,22 @@
8287
8496
  </fo:block>
8288
8497
  </xsl:if>
8289
8498
  </xsl:template>
8290
- <!-- ====== -->
8291
- <!-- ====== -->
8499
+ <!-- =============== -->
8500
+ <!-- END sourcecode -->
8501
+ <!-- =============== -->
8502
+
8503
+ <!-- =============== -->
8504
+ <!-- pre -->
8505
+ <!-- =============== -->
8506
+ <xsl:template match="*[local-name()='pre']" name="pre">
8507
+ <fo:block xsl:use-attribute-sets="pre-style">
8508
+ <xsl:copy-of select="@id"/>
8509
+ <xsl:apply-templates/>
8510
+ </fo:block>
8511
+ </xsl:template>
8512
+ <!-- =============== -->
8513
+ <!-- pre -->
8514
+ <!-- =============== -->
8292
8515
 
8293
8516
  <!-- ========== -->
8294
8517
  <!-- permission -->
@@ -9786,7 +10009,7 @@
9786
10009
  <fo:table-column column-width="80%"/>
9787
10010
  <fo:table-body>
9788
10011
  <fo:table-row>
9789
- <fo:table-cell><fo:block><xsl:copy-of select="$bibitem_label"/></fo:block></fo:table-cell>
10012
+ <fo:table-cell><fo:block><xsl:value-of select="$bibitem_label"/></fo:block></fo:table-cell>
9790
10013
  <fo:table-cell><fo:block><xsl:copy-of select="$bibitem_body"/></fo:block></fo:table-cell>
9791
10014
  </fo:table-row>
9792
10015
  </fo:table-body>
@@ -9803,7 +10026,7 @@
9803
10026
  <fo:list-item>
9804
10027
  <fo:list-item-label end-indent="label-end()">
9805
10028
  <fo:block>
9806
- <xsl:copy-of select="$bibitem_label"/>
10029
+ <xsl:value-of select="$bibitem_label"/>
9807
10030
  </fo:block>
9808
10031
  </fo:list-item-label>
9809
10032
  <fo:list-item-body start-indent="body-start()">
@@ -10292,7 +10515,9 @@
10292
10515
  <!-- ===================================== -->
10293
10516
  <!-- Update xml -->
10294
10517
  <!-- ===================================== -->
10518
+ <!-- =========================================================================== -->
10295
10519
  <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10520
+ <!-- =========================================================================== -->
10296
10521
  <xsl:template match="@*|node()" mode="update_xml_step1">
10297
10522
  <xsl:copy>
10298
10523
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -10384,10 +10609,15 @@
10384
10609
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10385
10610
  <xsl:apply-templates mode="update_xml_step1"/>
10386
10611
  </xsl:template>
10387
-
10612
+ <!-- =========================================================================== -->
10388
10613
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10614
+ <!-- =========================================================================== -->
10389
10615
 
10616
+ <!-- =========================================================================== -->
10390
10617
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10618
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
10619
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10620
+ <!-- =========================================================================== -->
10391
10621
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
10392
10622
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
10393
10623
  <xsl:copy>
@@ -10403,10 +10633,15 @@
10403
10633
  <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">
10404
10634
 
10405
10635
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
10406
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
10407
10636
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
10408
10637
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
10409
- <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))"/>
10638
+ <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))"/>
10639
+ <xsl:variable name="text_">
10640
+ <xsl:choose>
10641
+ <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 -->
10642
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
10643
+ </xsl:choose>
10644
+ </xsl:variable>
10410
10645
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
10411
10646
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
10412
10647
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -10422,7 +10657,11 @@
10422
10657
  </xsl:variable>
10423
10658
 
10424
10659
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
10425
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
10660
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10661
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10662
+ <!-- add &lt; and &gt; to \S -->
10663
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
10664
+ <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>
10426
10665
  <xsl:variable name="text3">
10427
10666
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
10428
10667
  <xsl:choose>
@@ -10486,9 +10725,8 @@
10486
10725
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
10487
10726
  </xsl:choose>
10488
10727
  </xsl:template>
10489
-
10490
10728
  <!-- ===================================== -->
10491
- <!-- End Update xml -->
10729
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10492
10730
  <!-- ===================================== -->
10493
10731
 
10494
10732
  <!-- for correct rendering combining chars -->
@@ -10876,13 +11114,14 @@
10876
11114
  </xsl:template>
10877
11115
 
10878
11116
  <xsl:template name="setId">
11117
+ <xsl:param name="prefix"/>
10879
11118
  <xsl:attribute name="id">
10880
11119
  <xsl:choose>
10881
11120
  <xsl:when test="@id">
10882
- <xsl:value-of select="@id"/>
11121
+ <xsl:value-of select="concat($prefix, @id)"/>
10883
11122
  </xsl:when>
10884
11123
  <xsl:otherwise>
10885
- <xsl:value-of select="generate-id()"/>
11124
+ <xsl:value-of select="concat($prefix, generate-id())"/>
10886
11125
  </xsl:otherwise>
10887
11126
  </xsl:choose>
10888
11127
  </xsl:attribute>
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  class PdfConvert < IsoDoc::XslfoPdfConvert
9
9
  def initialize(options)
10
10
  @libdir = File.dirname(__FILE__)
11
- @hierarchical_assets = options[:hierarchical_assets]
11
+ @hierarchical_assets = options[:hierarchicalassets]
12
12
  super
13
13
  end
14
14