metanorma-iso 2.4.7 → 2.5.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.
@@ -719,10 +719,20 @@
719
719
  <fo:block> </fo:block>
720
720
  </fo:table-cell>
721
721
  <fo:table-cell>
722
- <fo:block>Voting begins on:</fo:block>
722
+ <fo:block>
723
+ <!-- Voting begins on: -->
724
+ <xsl:call-template name="getLocalizedString">
725
+ <xsl:with-param name="key">voting_begins_on</xsl:with-param>
726
+ </xsl:call-template><xsl:text>:</xsl:text>
727
+ </fo:block>
723
728
  </fo:table-cell>
724
729
  <fo:table-cell>
725
- <fo:block>Voting terminates on:</fo:block>
730
+ <fo:block>
731
+ <!-- Voting terminates on: -->
732
+ <xsl:call-template name="getLocalizedString">
733
+ <xsl:with-param name="key">voting_terminates_on</xsl:with-param>
734
+ </xsl:call-template><xsl:text>:</xsl:text>
735
+ </fo:block>
726
736
  </fo:table-cell>
727
737
  </fo:table-row>
728
738
  <fo:table-row>
@@ -955,7 +965,12 @@
955
965
  <fo:block margin="2mm" role="SKIP">
956
966
  <fo:block margin-bottom="8pt"><xsl:copy-of select="$editorialgroup"/></fo:block>
957
967
  <fo:block margin-bottom="6pt"><xsl:copy-of select="$secretariat"/></fo:block>
958
- <fo:block margin-bottom="6pt">Voting begins on:<xsl:value-of select="$linebreak"/>
968
+ <fo:block margin-bottom="6pt">
969
+ <!-- Voting begins on: -->
970
+ <xsl:call-template name="getLocalizedString">
971
+ <xsl:with-param name="key">voting_begins_on</xsl:with-param>
972
+ </xsl:call-template><xsl:text>:</xsl:text>
973
+ <xsl:value-of select="$linebreak"/>
959
974
  <fo:inline font-weight="bold">
960
975
  <xsl:choose>
961
976
  <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on">
@@ -965,7 +980,12 @@
965
980
  </xsl:choose>
966
981
  </fo:inline>
967
982
  </fo:block>
968
- <fo:block>Voting terminates on:<xsl:value-of select="$linebreak"/>
983
+ <fo:block>
984
+ <!-- Voting terminates on: -->
985
+ <xsl:call-template name="getLocalizedString">
986
+ <xsl:with-param name="key">voting_terminates_on</xsl:with-param>
987
+ </xsl:call-template><xsl:text>:</xsl:text>
988
+ <xsl:value-of select="$linebreak"/>
969
989
  <fo:inline font-weight="bold">
970
990
  <xsl:choose>
971
991
  <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on">
@@ -1333,38 +1353,35 @@
1333
1353
  <xsl:call-template name="insertHeaderFooter"/>
1334
1354
  <fo:flow flow-name="xsl-region-body">
1335
1355
 
1336
- <fo:block-container>
1337
- <!-- Information and documentation — Codes for transcription systems -->
1338
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1339
- <xsl:value-of select="$title-en"/>
1340
- </fo:block>
1341
- -->
1356
+ <!-- Information and documentation — Codes for transcription systems -->
1357
+ <!-- <fo:block-container>
1358
+
1342
1359
  <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1" role="H1">
1343
-
1360
+
1344
1361
  <fo:block role="SKIP">
1345
-
1362
+
1346
1363
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1347
-
1364
+
1348
1365
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1349
-
1366
+
1350
1367
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
1351
1368
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1352
1369
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1353
1370
  </xsl:apply-templates>
1354
-
1371
+
1355
1372
  </fo:block>
1356
1373
  <fo:block role="SKIP">
1357
1374
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1358
1375
  </fo:block>
1359
-
1376
+
1360
1377
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
1361
1378
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1362
1379
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1363
1380
  </xsl:apply-templates>
1364
-
1381
+
1365
1382
  </fo:block>
1366
-
1367
- </fo:block-container>
1383
+
1384
+ </fo:block-container> -->
1368
1385
  <!-- Clause(s) -->
1369
1386
  <fo:block>
1370
1387
 
@@ -1446,8 +1463,8 @@
1446
1463
  <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1447
1464
  <fo:block font-size="9pt" margin-bottom="6pt">
1448
1465
  <xsl:variable name="title-descriptors">
1449
- <xsl:call-template name="getTitle">
1450
- <xsl:with-param name="name" select="'title-descriptors'"/>
1466
+ <xsl:call-template name="getLocalizedString">
1467
+ <xsl:with-param name="key">Descriptor.pl</xsl:with-param>
1451
1468
  </xsl:call-template>
1452
1469
  </xsl:variable>
1453
1470
  <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
@@ -1737,6 +1754,31 @@
1737
1754
  </xsl:if>
1738
1755
  </xsl:template>
1739
1756
 
1757
+ <xsl:template match="iso:sections/iso:p[@class = 'zzSTDTitle1']" priority="4">
1758
+ <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1" role="H1">
1759
+ <xsl:if test="following-sibling::*[1][self::iso:p][starts-with(@class, 'zzSTDTitle')]">
1760
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1761
+ </xsl:if>
1762
+ <xsl:apply-templates/>
1763
+ </fo:block>
1764
+ </xsl:template>
1765
+
1766
+ <xsl:template match="iso:sections/iso:p[@class = 'zzSTDTitle1']/iso:span[@class = 'nonboldtitle']" priority="3">
1767
+ <!-- Example: <span class="nonboldtitle">Part 1:</span> -->
1768
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1" role="SKIP">
1769
+ <xsl:apply-templates/>
1770
+ </fo:block>
1771
+ </xsl:template>
1772
+
1773
+ <xsl:template match="iso:sections/iso:p[@class = 'zzSTDTitle2']" priority="4">
1774
+ <!-- Example: <p class="zzSTDTitle2" displayorder="3">AMENDMENT 1: Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions</p> -->
1775
+ <xsl:if test="$doctype = 'amendment'">
1776
+ <fo:block font-size="18pt" margin-top="12pt" margin-bottom="20pt" margin-right="0mm" font-weight="normal" line-height="1.1" role="H1">
1777
+ <xsl:apply-templates/>
1778
+ </fo:block>
1779
+ </xsl:if>
1780
+ </xsl:template>
1781
+
1740
1782
  <!-- ==================== -->
1741
1783
  <!-- END display titles -->
1742
1784
  <!-- ==================== -->
@@ -2047,10 +2089,17 @@
2047
2089
  <xsl:if test="ancestor::*[local-name() = 'li' or local-name() = 'td' or local-name() = 'th' or local-name() = 'dd']">
2048
2090
  <xsl:attribute name="role">SKIP</xsl:attribute>
2049
2091
  </xsl:if>
2050
- <xsl:apply-templates>
2092
+ <!-- <xsl:apply-templates>
2093
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
2094
+ </xsl:apply-templates> -->
2095
+ <!-- <xsl:apply-templates select="node()[not(self::iso:note[not(following-sibling::*) or count(following-sibling::*) = count(../iso:note) - 1])]"> -->
2096
+ <xsl:apply-templates select="node()[not(self::iso:note)]"> <!-- note renders below paragraph for correct PDF tags order (see https://github.com/metanorma/metanorma-iso/issues/1003) -->
2051
2097
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
2052
2098
  </xsl:apply-templates>
2053
2099
  </xsl:element>
2100
+
2101
+ <xsl:apply-templates select="iso:note"/> <!-- [not(following-sibling::*) or count(following-sibling::*) = count(../iso:note) - 1] -->
2102
+
2054
2103
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
2055
2104
  <fo:block margin-bottom="12pt" role="SKIP">
2056
2105
  <xsl:if test="ancestor::iso:annex or following-sibling::iso:table">
@@ -2444,19 +2493,32 @@
2444
2493
  <xsl:variable name="titles_">
2445
2494
 
2446
2495
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
2447
- <title-toc lang="en">
2448
-
2449
- </title-toc>
2450
- <title-toc lang="fr">
2496
+ <!-- <title-toc lang="en">
2497
+ <xsl:if test="$namespace = 'csd' or $namespace = 'ieee' or $namespace = 'iho' or $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'unece-rec'">
2498
+ <xsl:text>Contents</xsl:text>
2499
+ </xsl:if>
2500
+ <xsl:if test="$namespace = 'csa' or $namespace = 'm3d' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper'">
2501
+ <xsl:text>Table of Contents</xsl:text>
2502
+ </xsl:if>
2503
+ <xsl:if test="$namespace = 'gb'">
2504
+ <xsl:text>Table of contents</xsl:text>
2505
+ </xsl:if>
2506
+ </title-toc> -->
2507
+ <title-toc lang="en">Table of contents</title-toc>
2508
+ <!-- <title-toc lang="fr">
2451
2509
  <xsl:text>Sommaire</xsl:text>
2452
- </title-toc>
2453
- <title-toc lang="zh">
2454
-
2510
+ </title-toc> -->
2511
+ <!-- <title-toc lang="zh">
2512
+ <xsl:choose>
2513
+ <xsl:when test="$namespace = 'gb'">
2514
+ <xsl:text>目次</xsl:text>
2515
+ </xsl:when>
2516
+ <xsl:otherwise>
2455
2517
  <xsl:text>Contents</xsl:text>
2456
-
2457
- </title-toc>
2458
-
2459
- <title-descriptors lang="en">Descriptors</title-descriptors>
2518
+ </xsl:otherwise>
2519
+ </xsl:choose>
2520
+ </title-toc> -->
2521
+ <title-toc lang="zh">目次</title-toc>
2460
2522
 
2461
2523
  <title-part lang="en">
2462
2524
 
@@ -2478,20 +2540,6 @@
2478
2540
  <title-subpart lang="en">Sub-part #</title-subpart>
2479
2541
  <title-subpart lang="fr">Partie de sub #</title-subpart>
2480
2542
 
2481
- <title-list-tables lang="en">List of Tables</title-list-tables>
2482
-
2483
- <title-list-figures lang="en">List of Figures</title-list-figures>
2484
-
2485
- <title-table-figures lang="en">Table of Figures</title-table-figures>
2486
-
2487
- <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2488
-
2489
- <title-summary lang="en">Summary</title-summary>
2490
-
2491
- <title-continued lang="ru">(продолжение)</title-continued>
2492
- <title-continued lang="en">(continued)</title-continued>
2493
- <title-continued lang="fr">(continué)</title-continued>
2494
-
2495
2543
  </xsl:variable>
2496
2544
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
2497
2545
 
@@ -2499,8 +2547,8 @@
2499
2547
  <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
2500
2548
  <xsl:value-of select="$toc_table_title"/>
2501
2549
  <xsl:if test="normalize-space($toc_table_title) = ''">
2502
- <xsl:call-template name="getTitle">
2503
- <xsl:with-param name="name" select="'title-list-tables'"/>
2550
+ <xsl:call-template name="getLocalizedString">
2551
+ <xsl:with-param name="key">toc_tables</xsl:with-param>
2504
2552
  </xsl:call-template>
2505
2553
  </xsl:if>
2506
2554
  </xsl:variable>
@@ -2509,8 +2557,8 @@
2509
2557
  <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
2510
2558
  <xsl:value-of select="$toc_figure_title"/>
2511
2559
  <xsl:if test="normalize-space($toc_figure_title) = ''">
2512
- <xsl:call-template name="getTitle">
2513
- <xsl:with-param name="name" select="'title-list-figures'"/>
2560
+ <xsl:call-template name="getLocalizedString">
2561
+ <xsl:with-param name="key">toc_figures</xsl:with-param>
2514
2562
  </xsl:call-template>
2515
2563
  </xsl:if>
2516
2564
  </xsl:variable>
@@ -2519,8 +2567,8 @@
2519
2567
  <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
2520
2568
  <xsl:value-of select="$toc_requirement_title"/>
2521
2569
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
2522
- <xsl:call-template name="getTitle">
2523
- <xsl:with-param name="name" select="'title-list-recommendations'"/>
2570
+ <xsl:call-template name="getLocalizedString">
2571
+ <xsl:with-param name="key">toc_recommendations</xsl:with-param>
2524
2572
  </xsl:call-template>
2525
2573
  </xsl:if>
2526
2574
  </xsl:variable>
@@ -5064,13 +5112,13 @@
5064
5112
  <fo:table-body>
5065
5113
 
5066
5114
  <xsl:variable name="title_continued_">
5067
- <xsl:call-template name="getTitle">
5068
- <xsl:with-param name="name" select="'title-continued'"/>
5115
+ <xsl:call-template name="getLocalizedString">
5116
+ <xsl:with-param name="key">continued</xsl:with-param>
5069
5117
  </xsl:call-template>
5070
5118
  </xsl:variable>
5071
-
5119
+ <xsl:variable name="title_continued_in_parenthesis" select="concat('(',$title_continued_,')')"/>
5072
5120
  <xsl:variable name="title_continued">
5073
- <xsl:value-of select="$title_continued_"/>
5121
+ <xsl:value-of select="$title_continued_in_parenthesis"/>
5074
5122
 
5075
5123
  </xsl:variable>
5076
5124
 
@@ -6403,6 +6451,9 @@
6403
6451
  <!-- END Definition List -->
6404
6452
  <!-- ===================== -->
6405
6453
 
6454
+ <!-- default: ignore title in sections/p -->
6455
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
6456
+
6406
6457
  <!-- ========================= -->
6407
6458
  <!-- Rich text formatting -->
6408
6459
  <!-- ========================= -->
@@ -6486,7 +6537,7 @@
6486
6537
  <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
6487
6538
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
6488
6539
  <xsl:choose>
6489
- <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
6540
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), $regex_url_start, '$2') != ''">
6490
6541
  <!-- url -->
6491
6542
  <xsl:call-template name="add-zero-spaces-link-java"/>
6492
6543
  </xsl:when>
@@ -7019,10 +7070,13 @@
7019
7070
  </xsl:choose>
7020
7071
  </xsl:variable>
7021
7072
 
7073
+ <!-- replace sequence #x200B to one &#x200B -->
7074
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b{2,}', '​')"/>
7075
+
7022
7076
  <!-- replace sequence #x200B and space TO space -->
7023
- <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
7077
+ <xsl:variable name="text11" select="java:replaceAll(java:java.lang.String.new($text10), '\u200b ', ' ')"/>
7024
7078
 
7025
- <xsl:value-of select="$text10"/>
7079
+ <xsl:value-of select="$text11"/>
7026
7080
  </xsl:template>
7027
7081
 
7028
7082
  <xsl:template name="add-zero-spaces-link-java">
@@ -7032,8 +7086,12 @@
7032
7086
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7033
7087
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
7034
7088
  <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
7089
+
7090
+ <!-- replace sequence #x200B to one &#x200B -->
7091
+ <xsl:variable name="url2" select="java:replaceAll(java:java.lang.String.new($url), '\u200b{2,}', '​')"/>
7092
+
7035
7093
  <!-- remove zero-width space at the end -->
7036
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
7094
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url2), '​$', '')"/>
7037
7095
  </xsl:template>
7038
7096
 
7039
7097
  <!-- add zero space after dash character (for table's entries) -->
@@ -8303,7 +8361,7 @@
8303
8361
 
8304
8362
  <xsl:call-template name="refine_note_block_style"/>
8305
8363
 
8306
- <fo:inline xsl:use-attribute-sets="note-name-style">
8364
+ <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
8307
8365
 
8308
8366
  <xsl:call-template name="refine_note-name-style"/>
8309
8367
 
@@ -8340,12 +8398,12 @@
8340
8398
  <xsl:variable name="num"><xsl:number/></xsl:variable>
8341
8399
  <xsl:choose>
8342
8400
  <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
8343
- <fo:inline xsl:use-attribute-sets="note-p-style">
8401
+ <fo:inline xsl:use-attribute-sets="note-p-style" role="SKIP">
8344
8402
  <xsl:apply-templates/>
8345
8403
  </fo:inline>
8346
8404
  </xsl:when>
8347
8405
  <xsl:otherwise>
8348
- <fo:block xsl:use-attribute-sets="note-p-style">
8406
+ <fo:block xsl:use-attribute-sets="note-p-style" role="SKIP">
8349
8407
  <xsl:apply-templates/>
8350
8408
  </fo:block>
8351
8409
  </xsl:otherwise>
@@ -8564,25 +8622,45 @@
8564
8622
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8565
8623
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8566
8624
 
8567
- <xsl:variable name="img_src">
8568
- <xsl:choose>
8569
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8570
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8571
- </xsl:choose>
8572
- </xsl:variable>
8625
+ <xsl:if test="@width != '' and @width != 'auto'">
8626
+ <xsl:attribute name="width">
8627
+ <xsl:value-of select="@width"/>
8628
+ </xsl:attribute>
8629
+ </xsl:if>
8573
8630
 
8574
- <xsl:variable name="image_width_effective">
8631
+ <xsl:if test="@height != '' and @height != 'auto'">
8632
+ <xsl:attribute name="height">
8633
+ <xsl:value-of select="@height"/>
8634
+ </xsl:attribute>
8635
+ </xsl:if>
8575
8636
 
8576
- <xsl:value-of select="$width_effective"/>
8637
+ <xsl:choose>
8638
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
8639
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
8640
+ </xsl:when>
8641
+ <xsl:otherwise>
8577
8642
 
8578
- </xsl:variable>
8643
+ <xsl:variable name="img_src">
8644
+ <xsl:choose>
8645
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8646
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8647
+ </xsl:choose>
8648
+ </xsl:variable>
8579
8649
 
8580
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8581
- <xsl:if test="number($scale) &lt; 100">
8650
+ <xsl:variable name="image_width_effective">
8582
8651
 
8583
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8652
+ <xsl:value-of select="$width_effective"/>
8584
8653
 
8585
- </xsl:if>
8654
+ </xsl:variable>
8655
+
8656
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8657
+ <xsl:if test="number($scale) &lt; 100">
8658
+
8659
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8660
+
8661
+ </xsl:if>
8662
+ </xsl:otherwise>
8663
+ </xsl:choose>
8586
8664
 
8587
8665
  </xsl:if>
8588
8666
 
@@ -12240,7 +12318,7 @@
12240
12318
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12241
12319
  <xsl:apply-templates mode="update_xml_step1"/>
12242
12320
  </xsl:template>
12243
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12321
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12244
12322
  <xsl:copy>
12245
12323
  <xsl:copy-of select="@*"/>
12246
12324
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -95,7 +95,7 @@ module IsoDoc
95
95
  i = display_order_at(docxml, "//clause[@type = 'scope']", i)
96
96
  i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
97
97
  i = display_order_xpath(docxml,
98
- "//sections/clause[not(@type = 'scope')] | " \
98
+ "//sections/clause[not(@type = 'scope')][not(.//references)] | " \
99
99
  "//sections/terms | //sections/definitions", i)
100
100
  i = display_order_xpath(docxml, "//annex", i)
101
101
  i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
@@ -161,6 +161,39 @@ module IsoDoc
161
161
  super
162
162
  end
163
163
 
164
+ def middle_title(docxml)
165
+ @meta.get[:doctitlemain].nil? || @meta.get[:doctitlemain].empty? and
166
+ return
167
+ s = docxml.at(ns("//sections")) or return
168
+ ret = "#{middle_title_main}#{middle_title_amd}"
169
+ s.children.first.previous = ret
170
+ end
171
+
172
+ def middle_title_main
173
+ ret = "<span class='boldtitle'>#{@meta.get[:doctitleintro]}"
174
+ ret += " &#x2014; " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
175
+ ret += @meta.get[:doctitlemain]
176
+ ret += " &#x2014; " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
177
+ ret += "</span>"
178
+ if a = @meta.get[:doctitlepart]
179
+ b = @meta.get[:doctitlepartlabel] and ret += "<span class='nonboldtitle'>#{b}:</span> "
180
+ ret += "<span class='boldtitle'>#{a}</span>"
181
+ end
182
+ "<p class='zzSTDTitle1'>#{ret}</p>"
183
+ end
184
+
185
+ def middle_title_amd
186
+ ret = ""
187
+ if a = @meta.get[:doctitleamdlabel]
188
+ ret += "<p class='zzSTDTitle2'>#{a}"
189
+ a = @meta.get[:doctitleamd] and ret += ": #{a}"
190
+ ret += "</p>"
191
+ end
192
+ a = @meta.get[:doctitlecorrlabel] and
193
+ ret += "<p class='zzSTDTitle2'>#{a}</p>"
194
+ ret
195
+ end
196
+
164
197
  include Init
165
198
  end
166
199
  end
@@ -1,52 +1,12 @@
1
1
  module IsoDoc
2
2
  module Iso
3
3
  module BaseConvert
4
- def middle_title(_isoxml, out)
5
- middle_title_main(out)
6
- middle_title_amd(out)
7
- end
8
-
9
- def middle_title_main(out)
10
- out.p(class: "zzSTDTitle1") do |p|
11
- p << @meta.get[:doctitleintro]
12
- p << " &#x2014; " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
13
- p << @meta.get[:doctitlemain]
14
- p << " &#x2014; " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
15
- end
16
- a = @meta.get[:doctitlepart] and out.p(class: "zzSTDTitle2") do |p|
17
- b = @meta.get[:doctitlepartlabel] and p << "#{b}: "
18
- p << "<br/><b>#{a}</b>"
19
- end
20
- end
21
-
22
- def middle_title_amd(out)
23
- a = @meta.get[:doctitleamdlabel] and out.p(class: "zzSTDTitle2") do |p|
24
- p << a
25
- a = @meta.get[:doctitleamd] and p << ": #{a}"
26
- end
27
- a = @meta.get[:doctitlecorrlabel] and out.p(class: "zzSTDTitle2") do |p|
28
- p << a
29
- end
30
- end
31
-
32
- def annex(isoxml, out)
33
- amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
4
+ def annex(node, out)
5
+ amd(node.document) and
6
+ @suppressheadingnumbers = @oldsuppressheadingnumbers
34
7
  super
35
- amd(isoxml) and @suppressheadingnumbers = true
36
- end
37
-
38
- =begin
39
- def introduction(clause, out)
40
- title_attr = { class: "IntroTitle" }
41
- page_break(out)
42
- out.div class: "Section3", id: clause["id"] do |div|
43
- clause_name(clause, clause.at(ns("./title")), div, title_attr)
44
- clause.elements.each do |e|
45
- parse(e, div) unless e.name == "title"
46
- end
47
- end
8
+ amd(node.document) and @suppressheadingnumbers = true
48
9
  end
49
- =end
50
10
 
51
11
  def foreword(clause, out)
52
12
  @foreword = true
@@ -70,8 +70,8 @@ module IsoDoc
70
70
  make_body1(body, docxml)
71
71
  make_body2(body, docxml)
72
72
  make_body3(body, docxml)
73
- indexsect(docxml, body)
74
- colophon(body, docxml)
73
+ indexsect_section(docxml, body)
74
+ colophon_section(docxml, body)
75
75
  end
76
76
  end
77
77
 
@@ -80,23 +80,31 @@ module IsoDoc
80
80
  "mso-break-type:section-break"
81
81
  end
82
82
 
83
- def colophon(body, _docxml)
83
+ MAIN_ELEMENTS =
84
+ "//sections/*[@displayorder] | //annex[@displayorder] | " \
85
+ "//bibliography/*[@displayorder]".freeze
86
+
87
+ def colophon_section(_isoxml, out)
84
88
  stage = @meta.get[:stage_int]
85
89
  return if !stage.nil? && stage < 60
86
90
 
87
- br(body, "left")
88
- body.div class: "colophon" do |div|
91
+ br(out, "left")
92
+ out.div class: "colophon" do |div|
89
93
  end
90
94
  end
91
95
 
92
- def indexsect(isoxml, out)
96
+ def indexsect_section(isoxml, out)
93
97
  isoxml.xpath(ns("//indexsect")).each do |i|
94
- indexsect_title(i, out)
95
- br(out, "auto")
96
- out.div class: "index" do |div|
97
- i.children.each do |e|
98
- parse(e, div) unless e.name == "title"
99
- end
98
+ indexsect(i, out)
99
+ end
100
+ end
101
+
102
+ def indexsect(elem, out)
103
+ indexsect_title(elem, out)
104
+ br(out, "auto")
105
+ out.div class: "index" do |div|
106
+ elem.children.each do |e|
107
+ parse(e, div) unless e.name == "title"
100
108
  end
101
109
  end
102
110
  end
@@ -128,14 +136,14 @@ module IsoDoc
128
136
  { class: "BiblioTitle" }
129
137
  end
130
138
 
131
- def bibliography(xml, out)
132
- (f = xml.at(ns(bibliography_xpath)) and f["hidden"] != "true") or return
139
+ def bibliography(node, out)
140
+ node["hidden"] != "true" or return
133
141
  page_break(out)
134
142
  out.div do |div|
135
143
  div.h1 **bibliography_attrs do |h1|
136
- f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
144
+ node&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
137
145
  end
138
- biblio_list(f, div, true)
146
+ biblio_list(node, div, true)
139
147
  end
140
148
  end
141
149
 
@@ -197,7 +205,6 @@ module IsoDoc
197
205
  end
198
206
 
199
207
  def annex_name(_annex, name, div)
200
- preceding_floating_titles(name, div)
201
208
  return if name.nil?
202
209
 
203
210
  name&.at(ns("./strong"))&.remove # supplied by CSS list numbering
@@ -41,6 +41,7 @@ module IsoDoc
41
41
 
42
42
  def dis_styles1(docxml)
43
43
  amd_style(docxml)
44
+ middle_title_style(docxml)
44
45
  code_style(docxml)
45
46
  figure_style(docxml)
46
47
  formula_style(docxml)
@@ -71,6 +72,14 @@ module IsoDoc
71
72
  end
72
73
  end
73
74
 
75
+ def middle_title_style(docxml)
76
+ docxml.xpath("//p[@class = 'zzSTDTitle2']").each do |p|
77
+ p1 = p.previous_element && p1.name == p &&
78
+ p1["class"] = "zzSTDTitle2" or next
79
+ p1 << " #{p.remove.children.to_xml}"
80
+ end
81
+ end
82
+
74
83
  def dis_style_interactions(docxml)
75
84
  docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or " \
76
85
  "@class = 'Code--']" \