metanorma-iso 2.3.4 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html2doc/lists.rb +9 -7
- data/lib/isodoc/iso/base_convert.rb +42 -10
- data/lib/isodoc/iso/html/style-human.css +4 -0
- data/lib/isodoc/iso/html/style-human.scss +6 -0
- data/lib/isodoc/iso/html/style-iso.css +4 -0
- data/lib/isodoc/iso/html/style-iso.scss +7 -0
- data/lib/isodoc/iso/html/wordstyle-dis.css +16 -0
- data/lib/isodoc/iso/html/wordstyle-dis.scss +14 -0
- data/lib/isodoc/iso/html/wordstyle.css +16 -0
- data/lib/isodoc/iso/html/wordstyle.scss +14 -0
- data/lib/isodoc/iso/html_convert.rb +12 -0
- data/lib/isodoc/iso/iso.amendment.xsl +147 -52
- data/lib/isodoc/iso/iso.international-standard.xsl +147 -52
- data/lib/isodoc/iso/presentation_bibdata.rb +1 -1
- data/lib/isodoc/iso/presentation_xml_convert.rb +5 -0
- data/lib/isodoc/iso/word_cleanup.rb +12 -2
- data/lib/isodoc/iso/word_convert.rb +44 -9
- data/lib/isodoc/iso/xref.rb +22 -4
- data/lib/metanorma/iso/base.rb +5 -0
- data/lib/metanorma/iso/biblio.rng +11 -1
- data/lib/metanorma/iso/cleanup.rb +0 -10
- data/lib/metanorma/iso/front_id.rb +8 -4
- data/lib/metanorma/iso/isodoc.rng +10 -0
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +2 -2
@@ -19,6 +19,7 @@
|
|
19
19
|
</xsl:if>
|
20
20
|
</xsl:variable>
|
21
21
|
<xsl:variable name="docidentifierISO" select="normalize-space($docidentifierISO_)"/>
|
22
|
+
<xsl:variable name="docidentifierISO_with_break" select="java:replaceAll(java:java.lang.String.new($docidentifierISO),'^([^\d]+) (\d)', concat('$1', $linebreak, '$2'))"/> <!-- add line break before 1st sequence 'space digit' -->
|
22
23
|
|
23
24
|
<xsl:variable name="all_rights_reserved">
|
24
25
|
<xsl:call-template name="getLocalizedString">
|
@@ -856,7 +857,7 @@
|
|
856
857
|
<xsl:if test="$font-size != ''">
|
857
858
|
<xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
|
858
859
|
</xsl:if>
|
859
|
-
<xsl:value-of select="$
|
860
|
+
<xsl:value-of select="$docidentifierISO_with_break"/>
|
860
861
|
</fo:block>
|
861
862
|
</fo:table-cell>
|
862
863
|
</fo:table-row>
|
@@ -1105,7 +1106,7 @@
|
|
1105
1106
|
</fo:table-cell>
|
1106
1107
|
<fo:table-cell>
|
1107
1108
|
<fo:block text-align="right" font-weight="bold" margin-bottom="13mm">
|
1108
|
-
<xsl:value-of select="$
|
1109
|
+
<xsl:value-of select="$docidentifierISO_with_break"/>
|
1109
1110
|
</fo:block>
|
1110
1111
|
</fo:table-cell>
|
1111
1112
|
</fo:table-row>
|
@@ -4102,7 +4103,7 @@
|
|
4102
4103
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
4103
4104
|
|
4104
4105
|
<xsl:choose>
|
4105
|
-
<xsl:when test="@width">
|
4106
|
+
<xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
|
4106
4107
|
|
4107
4108
|
<!-- centered table when table name is centered (see table-name-style) -->
|
4108
4109
|
|
@@ -4446,6 +4447,7 @@
|
|
4446
4447
|
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
4447
4448
|
<xsl:when test="(@width_max > $page_width and @width_min < $page_width) or (@width_min >= $page_width)">
|
4448
4449
|
<!-- difference between the available space and the minimum table width -->
|
4450
|
+
<_width_min><xsl:value-of select="@width_min"/></_width_min>
|
4449
4451
|
<xsl:variable name="W" select="$page_width - @width_min"/>
|
4450
4452
|
<W><xsl:value-of select="$W"/></W>
|
4451
4453
|
<!-- difference between maximum and minimum width of the table -->
|
@@ -5154,17 +5156,20 @@
|
|
5154
5156
|
<xsl:for-each select="xalan:nodeset($references)//fn">
|
5155
5157
|
<xsl:variable name="reference" select="@reference"/>
|
5156
5158
|
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
5157
|
-
<fo:block xsl:use-attribute-sets="table-fn-style">
|
5158
5159
|
|
5159
|
-
|
5160
|
+
<fo:block xsl:use-attribute-sets="table-fn-style">
|
5160
5161
|
|
5161
|
-
|
5162
|
+
<fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
|
5163
|
+
|
5164
|
+
<xsl:value-of select="@reference"/>
|
5165
|
+
|
5166
|
+
</fo:inline>
|
5167
|
+
<fo:inline xsl:use-attribute-sets="table-fn-body-style">
|
5168
|
+
<xsl:copy-of select="./node()"/>
|
5169
|
+
</fo:inline>
|
5170
|
+
|
5171
|
+
</fo:block>
|
5162
5172
|
|
5163
|
-
</fo:inline>
|
5164
|
-
<fo:inline xsl:use-attribute-sets="table-fn-body-style">
|
5165
|
-
<xsl:copy-of select="./node()"/>
|
5166
|
-
</fo:inline>
|
5167
|
-
</fo:block>
|
5168
5173
|
</xsl:if>
|
5169
5174
|
</xsl:for-each>
|
5170
5175
|
</xsl:template>
|
@@ -5363,7 +5368,7 @@
|
|
5363
5368
|
|
5364
5369
|
<xsl:variable name="key_iso">
|
5365
5370
|
|
5366
|
-
<xsl:if test="$parent = 'figure' or $parent = 'formula'">true</xsl:if>
|
5371
|
+
<xsl:if test="$parent = 'figure' or $parent = 'formula' or ../@key = 'true'">true</xsl:if>
|
5367
5372
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
5368
5373
|
</xsl:variable>
|
5369
5374
|
|
@@ -6123,12 +6128,12 @@
|
|
6123
6128
|
<xsl:param name="value"/>
|
6124
6129
|
<xsl:variable name="add_width" select="string-length($value) * 20"/>
|
6125
6130
|
<xsl:variable name="maxwidth" select="60 + $add_width"/>
|
6126
|
-
<fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-
|
6127
|
-
<xsl:attribute name="height">5mm</xsl:attribute>
|
6131
|
+
<fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
|
6132
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
|
6128
6133
|
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6129
6134
|
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6130
6135
|
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6131
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
|
6136
|
+
<!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
|
6132
6137
|
<g>
|
6133
6138
|
<xsl:if test="$type = 'closing' or $type = 'end'">
|
6134
6139
|
<xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
|
@@ -6142,6 +6147,27 @@
|
|
6142
6147
|
</xsl:if>
|
6143
6148
|
<xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
|
6144
6149
|
</text>
|
6150
|
+
</svg> -->
|
6151
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
|
6152
|
+
<g>
|
6153
|
+
<xsl:if test="$type = 'closing' or $type = 'end'">
|
6154
|
+
<xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
|
6155
|
+
</xsl:if>
|
6156
|
+
<polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
|
6157
|
+
<line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
|
6158
|
+
</g>
|
6159
|
+
<xsl:variable name="text_x">
|
6160
|
+
<xsl:choose>
|
6161
|
+
<xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
|
6162
|
+
<xsl:otherwise>22</xsl:otherwise>
|
6163
|
+
</xsl:choose>
|
6164
|
+
</xsl:variable>
|
6165
|
+
<text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
|
6166
|
+
<xsl:value-of select="$kind"/>
|
6167
|
+
</text>
|
6168
|
+
<text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
|
6169
|
+
<xsl:value-of select="$value"/>
|
6170
|
+
</text>
|
6145
6171
|
</svg>
|
6146
6172
|
</fo:instream-foreign-object>
|
6147
6173
|
</xsl:template>
|
@@ -6210,7 +6236,7 @@
|
|
6210
6236
|
</xsl:copy>
|
6211
6237
|
</xsl:template>
|
6212
6238
|
|
6213
|
-
<xsl:template match="*[local-name() = 'pagebreak']" mode="landscape_portrait">
|
6239
|
+
<xsl:template match="*[local-name() = 'pagebreak'][not(following-sibling::*[1][local-name() = 'pagebreak'])]" mode="landscape_portrait">
|
6214
6240
|
|
6215
6241
|
<!-- determine pagebreak is last element before </fo:flow> or not -->
|
6216
6242
|
<xsl:variable name="isLast">
|
@@ -6222,16 +6248,18 @@
|
|
6222
6248
|
<xsl:if test="contains($isLast, 'false')">
|
6223
6249
|
|
6224
6250
|
<xsl:variable name="orientation" select="normalize-space(@orientation)"/>
|
6225
|
-
|
6251
|
+
|
6252
|
+
<xsl:variable name="tree_">
|
6226
6253
|
<xsl:for-each select="ancestor::*[ancestor::fo:flow]">
|
6227
6254
|
<element pos="{position()}">
|
6228
6255
|
<xsl:value-of select="name()"/>
|
6229
6256
|
</element>
|
6230
6257
|
</xsl:for-each>
|
6231
6258
|
</xsl:variable>
|
6259
|
+
<xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
|
6232
6260
|
|
6233
6261
|
<!-- close fo:page-sequence (closing preceding fo elements) -->
|
6234
|
-
<xsl:for-each select="
|
6262
|
+
<xsl:for-each select="$tree//element">
|
6235
6263
|
<xsl:sort data-type="number" order="descending" select="@pos"/>
|
6236
6264
|
<xsl:text disable-output-escaping="yes"></</xsl:text>
|
6237
6265
|
<xsl:value-of select="."/>
|
@@ -6242,7 +6270,6 @@
|
|
6242
6270
|
|
6243
6271
|
<!-- <pagebreak/> -->
|
6244
6272
|
<!-- create a new fo:page-sequence (opening fo elements) -->
|
6245
|
-
|
6246
6273
|
<xsl:text disable-output-escaping="yes"><fo:page-sequence master-reference="document</xsl:text><xsl:if test="$orientation != ''">-<xsl:value-of select="$orientation"/></xsl:if><xsl:text disable-output-escaping="yes">"></xsl:text>
|
6247
6274
|
<fo:static-content flow-name="xsl-footnote-separator">
|
6248
6275
|
<fo:block>
|
@@ -6252,7 +6279,7 @@
|
|
6252
6279
|
<xsl:call-template name="insertHeaderFooter"/>
|
6253
6280
|
<xsl:text disable-output-escaping="yes"><fo:flow flow-name="xsl-region-body"></xsl:text>
|
6254
6281
|
|
6255
|
-
<xsl:for-each select="
|
6282
|
+
<xsl:for-each select="$tree//element">
|
6256
6283
|
<xsl:text disable-output-escaping="yes"><</xsl:text>
|
6257
6284
|
<xsl:value-of select="."/>
|
6258
6285
|
<xsl:for-each select="@*[local-name() != 'pos']">
|
@@ -6264,6 +6291,7 @@
|
|
6264
6291
|
</xsl:for-each>
|
6265
6292
|
<xsl:text disable-output-escaping="yes">></xsl:text>
|
6266
6293
|
</xsl:for-each>
|
6294
|
+
|
6267
6295
|
</xsl:if>
|
6268
6296
|
</xsl:template>
|
6269
6297
|
<!-- ================================================================ -->
|
@@ -6465,18 +6493,23 @@
|
|
6465
6493
|
|
6466
6494
|
<xsl:template name="add-zero-spaces-java">
|
6467
6495
|
<xsl:param name="text" select="."/>
|
6468
|
-
|
6469
|
-
|
6496
|
+
|
6497
|
+
<!-- add zero-width space (#x200B) after dot with next non-digit -->
|
6498
|
+
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1$2')"/>
|
6499
|
+
<!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
|
6500
|
+
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1')"/>
|
6501
|
+
<!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
|
6502
|
+
<xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1$2')"/>
|
6470
6503
|
<!-- add zero-width space (#x200B) after characters: 'great than' -->
|
6471
|
-
<xsl:variable name="
|
6504
|
+
<xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(\u003e)(?!\u003e)', '$1')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
|
6472
6505
|
<!-- add zero-width space (#x200B) before characters: 'less than' -->
|
6473
|
-
<xsl:variable name="
|
6506
|
+
<xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?<!\u003c)(\u003c)', '$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
|
6474
6507
|
<!-- add zero-width space (#x200B) before character: { -->
|
6475
|
-
<xsl:variable name="
|
6508
|
+
<xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?<!\W)(\{)', '$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
|
6476
6509
|
<!-- add zero-width space (#x200B) after character: , -->
|
6477
|
-
<xsl:variable name="
|
6510
|
+
<xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1')"/> <!-- negative lookahead: ',' not followed by digit -->
|
6478
6511
|
|
6479
|
-
<xsl:value-of select="$
|
6512
|
+
<xsl:value-of select="$text7"/>
|
6480
6513
|
</xsl:template>
|
6481
6514
|
|
6482
6515
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -6485,7 +6518,9 @@
|
|
6485
6518
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
|
6486
6519
|
<xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
|
6487
6520
|
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
|
6488
|
-
<xsl:
|
6521
|
+
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1')"/>
|
6522
|
+
<!-- remove zero-width space at the end -->
|
6523
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '$', '')"/>
|
6489
6524
|
</xsl:template>
|
6490
6525
|
|
6491
6526
|
<!-- add zero space after dash character (for table's entries) -->
|
@@ -6622,7 +6657,7 @@
|
|
6622
6657
|
</xsl:copy>
|
6623
6658
|
</xsl:template>
|
6624
6659
|
|
6625
|
-
<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">
|
6660
|
+
<xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
|
6626
6661
|
<xsl:copy>
|
6627
6662
|
<xsl:copy-of select="@*"/>
|
6628
6663
|
<p>
|
@@ -6698,6 +6733,14 @@
|
|
6698
6733
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
6699
6734
|
</xsl:template>
|
6700
6735
|
|
6736
|
+
<xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
|
6737
|
+
<xsl:apply-templates mode="table-without-br"/>
|
6738
|
+
</xsl:template>
|
6739
|
+
|
6740
|
+
<xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
|
6741
|
+
<xsl:apply-templates mode="table-without-br"/>
|
6742
|
+
</xsl:template>
|
6743
|
+
|
6701
6744
|
<!-- mode="table-without-br" -->
|
6702
6745
|
<!-- ================================== -->
|
6703
6746
|
<!-- END: Step 0. replace <br/> to <p>...</p> -->
|
@@ -7522,7 +7565,7 @@
|
|
7522
7565
|
<xsl:attribute name="font-size">inherit</xsl:attribute>
|
7523
7566
|
</xsl:if>
|
7524
7567
|
|
7525
|
-
<fo:block-container margin-left="0mm">
|
7568
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7526
7569
|
|
7527
7570
|
<fo:block>
|
7528
7571
|
|
@@ -7704,11 +7747,14 @@
|
|
7704
7747
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
7705
7748
|
</xsl:call-template>
|
7706
7749
|
|
7750
|
+
<!-- Example: Dimensions in millimeters -->
|
7751
|
+
<xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
|
7752
|
+
|
7707
7753
|
<fo:block xsl:use-attribute-sets="figure-style">
|
7708
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
7754
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
|
7709
7755
|
</fo:block>
|
7710
7756
|
<xsl:call-template name="fn_display_figure"/>
|
7711
|
-
<xsl:for-each select="*[local-name() = 'note']">
|
7757
|
+
<xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
|
7712
7758
|
<xsl:call-template name="note"/>
|
7713
7759
|
</xsl:for-each>
|
7714
7760
|
|
@@ -7965,24 +8011,47 @@
|
|
7965
8011
|
|
7966
8012
|
</xsl:when>
|
7967
8013
|
<xsl:otherwise>
|
7968
|
-
|
7969
|
-
|
7970
|
-
|
7971
|
-
<xsl:
|
7972
|
-
|
7973
|
-
|
7974
|
-
<xsl:
|
7975
|
-
|
7976
|
-
|
7977
|
-
|
7978
|
-
|
7979
|
-
|
7980
|
-
|
7981
|
-
|
7982
|
-
|
7983
|
-
|
7984
|
-
|
7985
|
-
|
8014
|
+
|
8015
|
+
<xsl:variable name="element">
|
8016
|
+
<xsl:choose>
|
8017
|
+
<xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
|
8018
|
+
<fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
|
8019
|
+
</xsl:when>
|
8020
|
+
<xsl:otherwise>
|
8021
|
+
<fo:block xsl:use-attribute-sets="image-style">
|
8022
|
+
<xsl:if test="ancestor::*[local-name() = 'dt']">
|
8023
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
8024
|
+
</xsl:if>
|
8025
|
+
</fo:block>
|
8026
|
+
</xsl:otherwise>
|
8027
|
+
</xsl:choose>
|
8028
|
+
</xsl:variable>
|
8029
|
+
|
8030
|
+
<xsl:for-each select="xalan:nodeset($element)/*">
|
8031
|
+
<xsl:copy>
|
8032
|
+
<xsl:copy-of select="@*"/>
|
8033
|
+
<!-- <fo:block xsl:use-attribute-sets="image-style"> -->
|
8034
|
+
<fo:instream-foreign-object fox:alt-text="{$alt-text}">
|
8035
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
8036
|
+
<xsl:attribute name="width">100%</xsl:attribute>
|
8037
|
+
</xsl:if>
|
8038
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
8039
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8040
|
+
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
|
8041
|
+
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
|
8042
|
+
<!-- effective height 297 - 27.4 - 13 = 256.6 -->
|
8043
|
+
<!-- effective width 210 - 12.5 - 25 = 172.5 -->
|
8044
|
+
<!-- effective height / width = 1.48, 1.4 - with title -->
|
8045
|
+
<xsl:if test="$svg_height > ($svg_width * 1.4)"> <!-- for images with big height -->
|
8046
|
+
<xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
|
8047
|
+
<xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
|
8048
|
+
</xsl:if>
|
8049
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8050
|
+
<xsl:copy-of select="$svg_content"/>
|
8051
|
+
</fo:instream-foreign-object>
|
8052
|
+
<!-- </fo:block> -->
|
8053
|
+
</xsl:copy>
|
8054
|
+
</xsl:for-each>
|
7986
8055
|
</xsl:otherwise>
|
7987
8056
|
</xsl:choose>
|
7988
8057
|
</xsl:template>
|
@@ -8074,6 +8143,13 @@
|
|
8074
8143
|
</xsl:for-each>
|
8075
8144
|
</xsl:template>
|
8076
8145
|
|
8146
|
+
<!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
|
8147
|
+
<xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
8148
|
+
<xsl:for-each select="*[local-name() = 'svg']">
|
8149
|
+
<xsl:call-template name="image_svg"/>
|
8150
|
+
</xsl:for-each>
|
8151
|
+
</xsl:template>
|
8152
|
+
|
8077
8153
|
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
|
8078
8154
|
<xsl:variable name="svg_content" select="document(@src)"/>
|
8079
8155
|
<xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
|
@@ -8212,6 +8288,8 @@
|
|
8212
8288
|
<xsl:value-of select="."/>
|
8213
8289
|
</xsl:template>
|
8214
8290
|
|
8291
|
+
<xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
|
8292
|
+
|
8215
8293
|
<xsl:template match="node()" mode="contents">
|
8216
8294
|
<xsl:apply-templates mode="contents"/>
|
8217
8295
|
</xsl:template>
|
@@ -8519,7 +8597,15 @@
|
|
8519
8597
|
<xsl:value-of select="@section"/>
|
8520
8598
|
<xsl:text> </xsl:text>
|
8521
8599
|
</xsl:if>
|
8522
|
-
<xsl:
|
8600
|
+
<xsl:variable name="title">
|
8601
|
+
<xsl:for-each select="title/node()">
|
8602
|
+
<xsl:choose>
|
8603
|
+
<xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
|
8604
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
8605
|
+
</xsl:choose>
|
8606
|
+
</xsl:for-each>
|
8607
|
+
</xsl:variable>
|
8608
|
+
<xsl:value-of select="normalize-space($title)"/>
|
8523
8609
|
</fo:bookmark-title>
|
8524
8610
|
<xsl:apply-templates mode="bookmark"/>
|
8525
8611
|
</fo:bookmark>
|
@@ -8545,6 +8631,12 @@
|
|
8545
8631
|
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
|
8546
8632
|
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
|
8547
8633
|
|
8634
|
+
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
|
8635
|
+
<fo:block text-align="right" keep-with-next="always">
|
8636
|
+
<xsl:apply-templates/>
|
8637
|
+
</fo:block>
|
8638
|
+
</xsl:template>
|
8639
|
+
|
8548
8640
|
<!-- ====== -->
|
8549
8641
|
<!-- ====== -->
|
8550
8642
|
<xsl:template match="*[local-name() = 'title']" mode="contents_item">
|
@@ -8694,6 +8786,10 @@
|
|
8694
8786
|
</xsl:for-each>
|
8695
8787
|
</xsl:template>
|
8696
8788
|
|
8789
|
+
<xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
|
8790
|
+
<xsl:value-of select="."/>
|
8791
|
+
</xsl:template>
|
8792
|
+
|
8697
8793
|
<!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
|
8698
8794
|
<xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
8699
8795
|
<xsl:apply-templates mode="contents_item"/>
|
@@ -10922,7 +11018,6 @@
|
|
10922
11018
|
<xsl:if test="@type = 'editorial'">
|
10923
11019
|
<xsl:attribute name="color">green</xsl:attribute>
|
10924
11020
|
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
10925
|
-
|
10926
11021
|
<!-- <xsl:variable name="note-style">
|
10927
11022
|
<style xsl:use-attribute-sets="note-style"></style>
|
10928
11023
|
</xsl:variable>
|
@@ -57,7 +57,7 @@ module IsoDoc
|
|
57
57
|
def editorialgroup_identifier2(group, level)
|
58
58
|
a = group.at(ns("./#{level}")) or return nil
|
59
59
|
type = a["type"]
|
60
|
-
type
|
60
|
+
type&.casecmp("other")&.zero? and type = ""
|
61
61
|
"#{type} #{a['number']}".strip
|
62
62
|
end
|
63
63
|
|
@@ -5,7 +5,7 @@ module IsoDoc
|
|
5
5
|
super
|
6
6
|
xml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
|
7
7
|
t["class"] = "figdl"
|
8
|
-
d = t.add_previous_sibling("<div class='figdl' "\
|
8
|
+
d = t.add_previous_sibling("<div class='figdl' " \
|
9
9
|
"style='page-break-after:avoid;'/>")
|
10
10
|
t.parent = d.first
|
11
11
|
end
|
@@ -38,6 +38,16 @@ module IsoDoc
|
|
38
38
|
word_annex_cleanup_h1(docxml)
|
39
39
|
figure_style(docxml)
|
40
40
|
new_styles(docxml)
|
41
|
+
index_cleanup(docxml)
|
42
|
+
end
|
43
|
+
|
44
|
+
def index_cleanup(docxml)
|
45
|
+
docxml.xpath("//div[@class = 'index']").each do |i|
|
46
|
+
i.xpath(".//p | .//li").each do |p|
|
47
|
+
p["style"] ||= ""
|
48
|
+
p["style"] += "margin-bottom:0px;"
|
49
|
+
end
|
50
|
+
end
|
41
51
|
end
|
42
52
|
|
43
53
|
def figure_style(docxml)
|
@@ -48,7 +58,7 @@ module IsoDoc
|
|
48
58
|
end
|
49
59
|
|
50
60
|
def quote_style(docxml)
|
51
|
-
docxml.xpath("//div[@class = 'Quote' or @class = 'Note' or "\
|
61
|
+
docxml.xpath("//div[@class = 'Quote' or @class = 'Note' or " \
|
52
62
|
"@class = 'Example' or @class = 'Admonition']").each do |d|
|
53
63
|
quote_style1(d)
|
54
64
|
end
|
@@ -10,10 +10,6 @@ module IsoDoc
|
|
10
10
|
def initialize(options)
|
11
11
|
@libdir = File.dirname(__FILE__)
|
12
12
|
super
|
13
|
-
@wordToClevels = options[:doctoclevels].to_i
|
14
|
-
@wordToClevels = 3 if @wordToClevels.zero?
|
15
|
-
@htmlToClevels = options[:htmltoclevels].to_i
|
16
|
-
@htmlToClevels = 3 if @htmlToClevels.zero?
|
17
13
|
init_dis(options)
|
18
14
|
end
|
19
15
|
|
@@ -74,17 +70,41 @@ module IsoDoc
|
|
74
70
|
make_body1(body, docxml)
|
75
71
|
make_body2(body, docxml)
|
76
72
|
make_body3(body, docxml)
|
73
|
+
indexsect(docxml, body)
|
77
74
|
colophon(body, docxml)
|
78
75
|
end
|
79
76
|
end
|
80
77
|
|
78
|
+
def br(out, pagebreak)
|
79
|
+
out.br clear: "all", style: "page-break-before:#{pagebreak};" \
|
80
|
+
"mso-break-type:section-break"
|
81
|
+
end
|
82
|
+
|
81
83
|
def colophon(body, _docxml)
|
82
84
|
stage = @meta.get[:stage_int]
|
83
85
|
return if !stage.nil? && stage < 60
|
84
86
|
|
85
|
-
body
|
86
|
-
|
87
|
-
|
87
|
+
br(body, "left")
|
88
|
+
body.div class: "colophon" do |div|
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def indexsect(isoxml, out)
|
93
|
+
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
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def indexsect_title(clause, out)
|
105
|
+
br(out, "always")
|
106
|
+
out.div class: "WordSection3" do |div|
|
107
|
+
clause_name(nil, clause.at(ns("./title")), div, nil)
|
88
108
|
end
|
89
109
|
end
|
90
110
|
|
@@ -181,7 +201,7 @@ module IsoDoc
|
|
181
201
|
return if name.nil?
|
182
202
|
|
183
203
|
name&.at(ns("./strong"))&.remove # supplied by CSS list numbering
|
184
|
-
div.h1
|
204
|
+
div.h1 class: "Annex" do |t|
|
185
205
|
annex_name1(name, t)
|
186
206
|
clause_parse_subtitle(name, t)
|
187
207
|
end
|
@@ -190,7 +210,7 @@ module IsoDoc
|
|
190
210
|
def annex_name1(name, out)
|
191
211
|
name.children.each do |c2|
|
192
212
|
if c2.name == "span" && c2["class"] == "obligation"
|
193
|
-
out.span
|
213
|
+
out.span style: "font-weight:normal;" do |s|
|
194
214
|
c2.children.each { |c3| parse(c3, s) }
|
195
215
|
end
|
196
216
|
else parse(c2, out)
|
@@ -204,6 +224,21 @@ module IsoDoc
|
|
204
224
|
ret
|
205
225
|
end
|
206
226
|
|
227
|
+
def table_parse(node, out)
|
228
|
+
@in_table = true
|
229
|
+
table_title_parse(node, out)
|
230
|
+
measurement_units(node, out)
|
231
|
+
out.div align: "center", class: "table_container" do |div|
|
232
|
+
div.table **table_attrs(node) do |t|
|
233
|
+
table_parse_core(node, t)
|
234
|
+
(dl = node.at(ns("./dl"))) && parse(dl, div)
|
235
|
+
node.xpath(ns("./note[not(@type = 'units')]"))
|
236
|
+
.each { |n| parse(n, div) }
|
237
|
+
end
|
238
|
+
end
|
239
|
+
@in_table = false
|
240
|
+
end
|
241
|
+
|
207
242
|
include BaseConvert
|
208
243
|
include Init
|
209
244
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -65,19 +65,24 @@ module IsoDoc
|
|
65
65
|
|
66
66
|
def figure_anchor(elem, sublabel, label, klass)
|
67
67
|
@anchors[elem["id"]] = anchor_struct(
|
68
|
-
|
68
|
+
"#{label}#{sublabel}",
|
69
69
|
nil, @labels[klass] || klass.capitalize, klass, elem["unnumbered"]
|
70
70
|
)
|
71
|
-
sublabel && elem["unnumbered"] != "true" and
|
71
|
+
!sublabel.empty? && elem["unnumbered"] != "true" and
|
72
72
|
@anchors[elem["id"]][:label] = sublabel
|
73
73
|
end
|
74
74
|
|
75
|
+
def subfigure_label(subfignum)
|
76
|
+
subfignum.zero? and return ""
|
77
|
+
" #{(subfignum + 96).chr})"
|
78
|
+
end
|
79
|
+
|
75
80
|
def sequential_figure_names(clause)
|
76
81
|
j = 0
|
77
82
|
clause.xpath(ns(FIGURE_NO_CLASS)).noblank
|
78
83
|
.each_with_object(IsoDoc::XrefGen::Counter.new) do |t, c|
|
79
84
|
j = subfigure_increment(j, c, t)
|
80
|
-
sublabel =
|
85
|
+
sublabel = subfigure_label(j)
|
81
86
|
figure_anchor(t, sublabel, c.print, "figure")
|
82
87
|
end
|
83
88
|
sequential_figure_class_names(clause)
|
@@ -101,7 +106,7 @@ module IsoDoc
|
|
101
106
|
clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
|
102
107
|
j = subfigure_increment(j, c, t)
|
103
108
|
label = "#{num}#{hiersep}#{c.print}"
|
104
|
-
sublabel =
|
109
|
+
sublabel = subfigure_label(j)
|
105
110
|
figure_anchor(t, sublabel, label, "figure")
|
106
111
|
end
|
107
112
|
hierarchical_figure_class_names(clause, num)
|
@@ -196,6 +201,19 @@ module IsoDoc
|
|
196
201
|
super
|
197
202
|
modspec_table_xrefs(clause) if @anchors_previous
|
198
203
|
end
|
204
|
+
|
205
|
+
def uncountable_note?(note)
|
206
|
+
@anchors[note["id"]] || blank?(note["id"]) || note["type"] == "units"
|
207
|
+
end
|
208
|
+
|
209
|
+
def note_anchor_names1(notes, counter)
|
210
|
+
countable = notes.reject { |n| uncountable_note?(n) }
|
211
|
+
countable.each do |n|
|
212
|
+
@anchors[n["id"]] =
|
213
|
+
anchor_struct(increment_label(countable, n, counter), n,
|
214
|
+
@labels["note_xref"], "note", false)
|
215
|
+
end
|
216
|
+
end
|
199
217
|
end
|
200
218
|
end
|
201
219
|
end
|
data/lib/metanorma/iso/base.rb
CHANGED
@@ -56,9 +56,14 @@ module Metanorma
|
|
56
56
|
@vocab = node.attr("docsubtype") == "vocabulary"
|
57
57
|
end
|
58
58
|
|
59
|
+
def toc_default
|
60
|
+
{ word_levels: 3, html_levels: 2 }
|
61
|
+
end
|
62
|
+
|
59
63
|
def ol_attrs(node)
|
60
64
|
attr_code(keep_attrs(node)
|
61
65
|
.merge(id: ::Metanorma::Utils::anchor_or_uuid(node),
|
66
|
+
"explicit-type": olist_style(node.attributes[1]),
|
62
67
|
start: node.attr("start")))
|
63
68
|
end
|
64
69
|
|