metanorma-iso 2.4.8 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aaa364a3a007ab13cb425bee0b000154d5d49d394db13f37945b18eb77a7d97
4
- data.tar.gz: 54974181bd0d2c29fc00299aaa0da54bc5749c741d4a63503003af1d46038c95
3
+ metadata.gz: b68e0ac152a02770b1ca677908a34d243a66ba8da955a98aac66391a6e1a73ae
4
+ data.tar.gz: 4122f534ef647b210a829dc1645240b79bc240a0059dec141ca3eec0f1c64efc
5
5
  SHA512:
6
- metadata.gz: 85dcbabb3fd13f5020003f4e5c59d8fad34287002f3e9fc03d4cc6c0fe37d0938bcf0ce1e3a3e6a0fc5a1937c756646662cd7d48eea65e3208e1650927ab3133
7
- data.tar.gz: 77268460b6cfbeda72397ec169dc82bfdfdd724214d138fe7f6621570cf01b881097baaebc36e0eadac9568e2b842e2fa068c5994f98fb228c9ef1146dfc3430
6
+ metadata.gz: bb2d619b3e439f33ac96fd63691a288730daed7aa3ed8d478898caca5f755d3aea436469499afd81aa318519be87f5f12e5d8b632d17f40cff1b67e2c20851ad
7
+ data.tar.gz: 2e37056accf0f22aa7a13702ff79c928c359c0188126a10e165e8c448a9a7f110acf743b29fed45b5b972c54d77f7a8a7610a6da889f8ef9ca43d3b77bbfa501
@@ -130,22 +130,13 @@ module IsoDoc
130
130
  end
131
131
  end
132
132
 
133
- def middle(isoxml, out)
134
- middle_title(isoxml, out)
135
- middle_admonitions(isoxml, out)
136
- i = scope isoxml, out, 0
137
- i = norm_ref isoxml, out, i
138
- clause_etc isoxml, out, i
139
- annex isoxml, out
140
- bibliography isoxml, out
141
- end
142
-
143
- def clause_etc(isoxml, out, num)
144
- isoxml.xpath(ns("//sections/clause[not(@type = 'scope')] | " \
145
- "//sections/terms | //sections/definitions"))
146
- .each do |f|
147
- clause_etc1(f, out, num)
148
- end
133
+ def top_element_render(elem, out)
134
+ if %w(clause terms definitions).include?(elem.name) &&
135
+ elem.parent.name == "sections" &&
136
+ elem["type"] != "scope"
137
+ clause_etc1(elem, out, 0)
138
+ else super
139
+ end
149
140
  end
150
141
 
151
142
  def clause_etc1(clause, out, num)
@@ -161,12 +152,6 @@ module IsoDoc
161
152
  end
162
153
  end
163
154
 
164
- def indexsect(isoxml, out)
165
- isoxml.xpath(ns("//indexsect")).each do |i|
166
- clause_parse(i, out)
167
- end
168
- end
169
-
170
155
  def ol_attrs(node)
171
156
  super.merge(start: node["start"]).compact
172
157
  end
@@ -81,18 +81,6 @@ module IsoDoc
81
81
  docxml
82
82
  end
83
83
 
84
- def middle(isoxml, out)
85
- middle_title(isoxml, out)
86
- middle_admonitions(isoxml, out)
87
- scope isoxml, out, 0
88
- norm_ref isoxml, out, 0
89
- clause_etc isoxml, out, 0
90
- annex isoxml, out
91
- bibliography isoxml, out
92
- indexsect isoxml, out
93
- end
94
-
95
-
96
84
  def html_toc1(ulist)
97
85
  u2 = nil
98
86
  ulist.xpath("./li").each do |l|
@@ -1353,38 +1353,35 @@
1353
1353
  <xsl:call-template name="insertHeaderFooter"/>
1354
1354
  <fo:flow flow-name="xsl-region-body">
1355
1355
 
1356
- <fo:block-container>
1357
- <!-- Information and documentation — Codes for transcription systems -->
1358
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1359
- <xsl:value-of select="$title-en"/>
1360
- </fo:block>
1361
- -->
1356
+ <!-- Information and documentation — Codes for transcription systems -->
1357
+ <!-- <fo:block-container>
1358
+
1362
1359
  <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1" role="H1">
1363
-
1360
+
1364
1361
  <fo:block role="SKIP">
1365
-
1362
+
1366
1363
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1367
-
1364
+
1368
1365
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1369
-
1366
+
1370
1367
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
1371
1368
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1372
1369
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1373
1370
  </xsl:apply-templates>
1374
-
1371
+
1375
1372
  </fo:block>
1376
1373
  <fo:block role="SKIP">
1377
1374
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1378
1375
  </fo:block>
1379
-
1376
+
1380
1377
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
1381
1378
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1382
1379
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1383
1380
  </xsl:apply-templates>
1384
-
1381
+
1385
1382
  </fo:block>
1386
-
1387
- </fo:block-container>
1383
+
1384
+ </fo:block-container> -->
1388
1385
  <!-- Clause(s) -->
1389
1386
  <fo:block>
1390
1387
 
@@ -1757,6 +1754,31 @@
1757
1754
  </xsl:if>
1758
1755
  </xsl:template>
1759
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
+
1760
1782
  <!-- ==================== -->
1761
1783
  <!-- END display titles -->
1762
1784
  <!-- ==================== -->
@@ -6429,6 +6451,9 @@
6429
6451
  <!-- END Definition List -->
6430
6452
  <!-- ===================== -->
6431
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
+
6432
6457
  <!-- ========================= -->
6433
6458
  <!-- Rich text formatting -->
6434
6459
  <!-- ========================= -->
@@ -6512,7 +6537,7 @@
6512
6537
  <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
6513
6538
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
6514
6539
  <xsl:choose>
6515
- <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') != ''">
6516
6541
  <!-- url -->
6517
6542
  <xsl:call-template name="add-zero-spaces-link-java"/>
6518
6543
  </xsl:when>
@@ -7045,10 +7070,13 @@
7045
7070
  </xsl:choose>
7046
7071
  </xsl:variable>
7047
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
+
7048
7076
  <!-- replace sequence #x200B and space TO space -->
7049
- <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 ', ' ')"/>
7050
7078
 
7051
- <xsl:value-of select="$text10"/>
7079
+ <xsl:value-of select="$text11"/>
7052
7080
  </xsl:template>
7053
7081
 
7054
7082
  <xsl:template name="add-zero-spaces-link-java">
@@ -7058,8 +7086,12 @@
7058
7086
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7059
7087
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
7060
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
+
7061
7093
  <!-- remove zero-width space at the end -->
7062
- <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), '​$', '')"/>
7063
7095
  </xsl:template>
7064
7096
 
7065
7097
  <!-- add zero space after dash character (for table's entries) -->
@@ -8590,25 +8622,45 @@
8590
8622
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8591
8623
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8592
8624
 
8593
- <xsl:variable name="img_src">
8594
- <xsl:choose>
8595
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8596
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8597
- </xsl:choose>
8598
- </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>
8599
8630
 
8600
- <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>
8601
8636
 
8602
- <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>
8603
8642
 
8604
- </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>
8605
8649
 
8606
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8607
- <xsl:if test="number($scale) &lt; 100">
8650
+ <xsl:variable name="image_width_effective">
8608
8651
 
8609
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8652
+ <xsl:value-of select="$width_effective"/>
8610
8653
 
8611
- </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>
8612
8664
 
8613
8665
  </xsl:if>
8614
8666
 
@@ -12266,7 +12318,7 @@
12266
12318
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12267
12319
  <xsl:apply-templates mode="update_xml_step1"/>
12268
12320
  </xsl:template>
12269
- <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">
12270
12322
  <xsl:copy>
12271
12323
  <xsl:copy-of select="@*"/>
12272
12324
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -1353,38 +1353,35 @@
1353
1353
  <xsl:call-template name="insertHeaderFooter"/>
1354
1354
  <fo:flow flow-name="xsl-region-body">
1355
1355
 
1356
- <fo:block-container>
1357
- <!-- Information and documentation — Codes for transcription systems -->
1358
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1359
- <xsl:value-of select="$title-en"/>
1360
- </fo:block>
1361
- -->
1356
+ <!-- Information and documentation — Codes for transcription systems -->
1357
+ <!-- <fo:block-container>
1358
+
1362
1359
  <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1" role="H1">
1363
-
1360
+
1364
1361
  <fo:block role="SKIP">
1365
-
1362
+
1366
1363
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1367
-
1364
+
1368
1365
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1369
-
1366
+
1370
1367
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
1371
1368
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1372
1369
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1373
1370
  </xsl:apply-templates>
1374
-
1371
+
1375
1372
  </fo:block>
1376
1373
  <fo:block role="SKIP">
1377
1374
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1378
1375
  </fo:block>
1379
-
1376
+
1380
1377
  <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
1381
1378
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1382
1379
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1383
1380
  </xsl:apply-templates>
1384
-
1381
+
1385
1382
  </fo:block>
1386
-
1387
- </fo:block-container>
1383
+
1384
+ </fo:block-container> -->
1388
1385
  <!-- Clause(s) -->
1389
1386
  <fo:block>
1390
1387
 
@@ -1757,6 +1754,31 @@
1757
1754
  </xsl:if>
1758
1755
  </xsl:template>
1759
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
+
1760
1782
  <!-- ==================== -->
1761
1783
  <!-- END display titles -->
1762
1784
  <!-- ==================== -->
@@ -6429,6 +6451,9 @@
6429
6451
  <!-- END Definition List -->
6430
6452
  <!-- ===================== -->
6431
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
+
6432
6457
  <!-- ========================= -->
6433
6458
  <!-- Rich text formatting -->
6434
6459
  <!-- ========================= -->
@@ -6512,7 +6537,7 @@
6512
6537
  <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
6513
6538
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
6514
6539
  <xsl:choose>
6515
- <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') != ''">
6516
6541
  <!-- url -->
6517
6542
  <xsl:call-template name="add-zero-spaces-link-java"/>
6518
6543
  </xsl:when>
@@ -7045,10 +7070,13 @@
7045
7070
  </xsl:choose>
7046
7071
  </xsl:variable>
7047
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
+
7048
7076
  <!-- replace sequence #x200B and space TO space -->
7049
- <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 ', ' ')"/>
7050
7078
 
7051
- <xsl:value-of select="$text10"/>
7079
+ <xsl:value-of select="$text11"/>
7052
7080
  </xsl:template>
7053
7081
 
7054
7082
  <xsl:template name="add-zero-spaces-link-java">
@@ -7058,8 +7086,12 @@
7058
7086
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7059
7087
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
7060
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
+
7061
7093
  <!-- remove zero-width space at the end -->
7062
- <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), '​$', '')"/>
7063
7095
  </xsl:template>
7064
7096
 
7065
7097
  <!-- add zero space after dash character (for table's entries) -->
@@ -8590,25 +8622,45 @@
8590
8622
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8591
8623
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8592
8624
 
8593
- <xsl:variable name="img_src">
8594
- <xsl:choose>
8595
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8596
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8597
- </xsl:choose>
8598
- </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>
8599
8630
 
8600
- <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>
8601
8636
 
8602
- <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>
8603
8642
 
8604
- </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>
8605
8649
 
8606
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8607
- <xsl:if test="number($scale) &lt; 100">
8650
+ <xsl:variable name="image_width_effective">
8608
8651
 
8609
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8652
+ <xsl:value-of select="$width_effective"/>
8610
8653
 
8611
- </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>
8612
8664
 
8613
8665
  </xsl:if>
8614
8666
 
@@ -12266,7 +12318,7 @@
12266
12318
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12267
12319
  <xsl:apply-templates mode="update_xml_step1"/>
12268
12320
  </xsl:template>
12269
- <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">
12270
12322
  <xsl:copy>
12271
12323
  <xsl:copy-of select="@*"/>
12272
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--']" \
@@ -46,12 +46,6 @@ module IsoDoc
46
46
  { class: "TableTitle", style: "text-align:center;" }
47
47
  end
48
48
 
49
- def span_parse(node, out)
50
- out.span class: node["class"] do |x|
51
- node.children.each { |n| parse(n, x) }
52
- end
53
- end
54
-
55
49
  def word_toc_preface(level)
56
50
  <<~TOC.freeze
57
51
  <span lang="EN-GB"><span
@@ -68,7 +62,7 @@ module IsoDoc
68
62
 
69
63
  def toWord(result, filename, dir, header)
70
64
  result = from_xhtml(word_cleanup(to_xhtml(result)))
71
- .gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
65
+ .gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
72
66
  @wordstylesheet = wordstylesheet_update
73
67
  ::Html2Doc::IsoDIS.new(
74
68
  filename: filename,
@@ -86,30 +80,39 @@ module IsoDoc
86
80
  middle_title_dis(out)
87
81
  end
88
82
 
89
- def middle_title_dis(out)
83
+ def middle_title_dis(node, out)
90
84
  out.p(class: "zzSTDTitle") do |p|
91
- p << @meta.get[:doctitleintro]
92
- @meta.get[:doctitleintro] && @meta.get[:doctitlemain] and p << " &#x2014; "
93
- p << @meta.get[:doctitlemain]
94
- @meta.get[:doctitlemain] && @meta.get[:doctitlepart] and p << " &#x2014; "
95
- if @meta.get[:doctitlepart]
96
- b = @meta.get[:doctitlepartlabel] and
97
- p << "<span style='font-weight:normal'>#{b}:</span> "
98
- p << " #{@meta.get[:doctitlepart]}"
85
+ node.children.each { |n| parse(n, p) }
86
+ end
87
+ end
88
+
89
+ def middle_title_amd(node, out)
90
+ out.p(class: "zzSTDTitle2") do |p|
91
+ p.span(style: "font-weight:normal") do |s|
92
+ node.children.each { |n| parse(n, s) }
99
93
  end
100
- @meta.get[:doctitleamdlabel] || @meta.get[:doctitleamd] ||
101
- @meta.get[:doctitlecorrlabel] and middle_title_dis_amd(p)
102
94
  end
103
95
  end
104
96
 
105
- def middle_title_dis_amd(para)
106
- para.span(style: "font-weight:normal") do |p|
107
- if a = @meta.get[:doctitleamdlabel]
108
- p << " #{a}"
109
- a = @meta.get[:doctitleamd] and p << ": #{a}"
97
+ def para_parse(node, out)
98
+ case node["class"]
99
+ when "zzSTDTitle1" then middle_title_dis(node, out)
100
+ when "zzSTDTitle2" then middle_title_amd(node, out)
101
+ else super
102
+ end
103
+ end
104
+
105
+ def span_parse(node, out)
106
+ case node["class"]
107
+ when "nonboldtitle"
108
+ out.span(style: "font-weight:normal") do |s|
109
+ node.children.each { |n| parse(n, s) }
110
110
  end
111
- if a = @meta.get[:doctitlecorrlabel]
112
- p << " #{a}"
111
+ when "boldtitle"
112
+ node.children.each { |n| parse(n, out) }
113
+ else
114
+ out.span class: node["class"] do |x|
115
+ node.children.each { |n| parse(n, x) }
113
116
  end
114
117
  end
115
118
  end
@@ -43,7 +43,7 @@ module IsoDoc
43
43
  n = Counter.new
44
44
  n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
45
45
  n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
46
- doc.xpath(ns("//sections/clause[not(@type = 'scope')] | " \
46
+ doc.xpath(ns("//sections/clause[not(@type = 'scope')][not(.//references)] | " \
47
47
  "//sections/terms | //sections/definitions")).each do |c|
48
48
  n = section_names(c, n, 1)
49
49
  end
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.2.2 -->
20
+ <!-- VERSION v1.2.3 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -192,9 +192,11 @@
192
192
  </attribute>
193
193
  </optional>
194
194
  <attribute name="citeas"/>
195
- <attribute name="type">
196
- <ref name="ReferenceFormat"/>
197
- </attribute>
195
+ <optional>
196
+ <attribute name="type">
197
+ <ref name="ReferenceFormat"/>
198
+ </attribute>
199
+ </optional>
198
200
  <optional>
199
201
  <attribute name="alt"/>
200
202
  </optional>
@@ -836,6 +838,26 @@
836
838
  <ref name="paragraph"/>
837
839
  </element>
838
840
  </define>
841
+ <define name="stem">
842
+ <element name="stem">
843
+ <attribute name="type">
844
+ <choice>
845
+ <value>MathML</value>
846
+ <value>AsciiMath</value>
847
+ <value>LatexMath</value>
848
+ </choice>
849
+ </attribute>
850
+ <attribute name="block">
851
+ <data type="boolean"/>
852
+ </attribute>
853
+ <oneOrMore>
854
+ <choice>
855
+ <text/>
856
+ <ref name="AnyElement"/>
857
+ </choice>
858
+ </oneOrMore>
859
+ </element>
860
+ </define>
839
861
  <define name="em">
840
862
  <element name="em">
841
863
  <zeroOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.4.8".freeze
3
+ VERSION = "2.5.0".freeze
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
33
33
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
34
34
 
35
- spec.add_dependency "metanorma-standoc", "~> 2.4.3"
35
+ spec.add_dependency "metanorma-standoc", "~> 2.5.0"
36
36
  spec.add_dependency "mnconvert", "~> 1.14"
37
37
  spec.add_dependency "pubid-iso", "~> 0.5.0"
38
38
  spec.add_dependency "ruby-jing"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.8
4
+ version: 2.5.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: 2023-07-24 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.3
19
+ version: 2.5.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.4.3
26
+ version: 2.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement