metanorma-iso 1.9.5 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/basicdoc.rng +32 -5
- data/lib/asciidoctor/iso/biblio.rng +2 -0
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +9 -1
- data/lib/asciidoctor/iso/isodoc.rng +421 -76
- data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
- data/lib/asciidoctor/iso/isostandard.rng +9 -23
- data/lib/asciidoctor/iso/reqt.rng +24 -3
- data/lib/asciidoctor/iso/validate.rb +7 -7
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +1 -2
- data/lib/isodoc/iso/html/isodoc.scss +1 -1
- data/lib/isodoc/iso/html/wordstyle.css +16 -4
- data/lib/isodoc/iso/html/wordstyle.scss +16 -4
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +50 -13
- data/lib/isodoc/iso/iso.international-standard.xsl +50 -13
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -3
- data/spec/asciidoctor/base_spec.rb +685 -124
- data/spec/asciidoctor/blocks_spec.rb +22 -47
- data/spec/asciidoctor/cleanup_spec.rb +34 -20
- data/spec/asciidoctor/inline_spec.rb +10 -2
- data/spec/asciidoctor/refs_spec.rb +87 -4
- data/spec/asciidoctor/section_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +29 -15
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/section_spec.rb +1 -1
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +11 -11
- data/spec/isodoc/xref_spec.rb +1397 -1376
- data/spec/metanorma/processor_spec.rb +4 -1
- data/spec/spec_helper.rb +14 -1
- data/spec/vcr_cassettes/docrels.yml +783 -0
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +37 -19
@@ -1798,7 +1798,7 @@
|
|
1798
1798
|
</xsl:variable>
|
1799
1799
|
<fo:block line-height="1.1" role="H{$levelTerm}">
|
1800
1800
|
<fo:block font-weight="bold" keep-with-next="always">
|
1801
|
-
<xsl:apply-templates select="ancestor::iso:term/iso:name" mode="presentation"/>
|
1801
|
+
<xsl:apply-templates select="ancestor::iso:term[1]/iso:name" mode="presentation"/>
|
1802
1802
|
</fo:block>
|
1803
1803
|
<fo:block font-weight="bold" keep-with-next="always">
|
1804
1804
|
<xsl:apply-templates/>
|
@@ -2260,6 +2260,8 @@
|
|
2260
2260
|
|
2261
2261
|
<title-list-figures lang="en">List of Figures</title-list-figures>
|
2262
2262
|
|
2263
|
+
<title-table-figures lang="en">Table of Figures</title-table-figures>
|
2264
|
+
|
2263
2265
|
<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
|
2264
2266
|
|
2265
2267
|
<title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
|
@@ -2558,6 +2560,11 @@
|
|
2558
2560
|
|
2559
2561
|
|
2560
2562
|
|
2563
|
+
</xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
|
2564
|
+
|
2565
|
+
|
2566
|
+
|
2567
|
+
|
2561
2568
|
</xsl:attribute-set><xsl:attribute-set name="note-p-style">
|
2562
2569
|
|
2563
2570
|
|
@@ -3757,9 +3764,8 @@
|
|
3757
3764
|
|
3758
3765
|
<!-- Table's note name (NOTE, for example) -->
|
3759
3766
|
|
3760
|
-
<fo:inline padding-right="2mm">
|
3767
|
+
<fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
|
3761
3768
|
|
3762
|
-
|
3763
3769
|
|
3764
3770
|
|
3765
3771
|
|
@@ -4289,6 +4295,7 @@
|
|
4289
4295
|
<fo:table-cell>
|
4290
4296
|
|
4291
4297
|
<fo:block margin-top="6pt">
|
4298
|
+
<xsl:copy-of select="@id"/>
|
4292
4299
|
|
4293
4300
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
4294
4301
|
|
@@ -4394,6 +4401,8 @@
|
|
4394
4401
|
<xsl:if test="$font-size != ''">
|
4395
4402
|
<xsl:attribute name="font-size">
|
4396
4403
|
<xsl:choose>
|
4404
|
+
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4405
|
+
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4397
4406
|
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4398
4407
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4399
4408
|
</xsl:choose>
|
@@ -5133,14 +5142,20 @@
|
|
5133
5142
|
</xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
|
5134
5143
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
5135
5144
|
</xsl:template><xsl:template match="*[local-name() = 'terms']">
|
5145
|
+
<!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
|
5136
5146
|
<fo:block id="{@id}">
|
5137
5147
|
<xsl:apply-templates/>
|
5138
5148
|
</fo:block>
|
5139
5149
|
</xsl:template><xsl:template match="*[local-name() = 'term']">
|
5150
|
+
<!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
|
5140
5151
|
<fo:block id="{@id}" xsl:use-attribute-sets="term-style">
|
5141
5152
|
|
5142
5153
|
|
5143
|
-
|
5154
|
+
<xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
|
5155
|
+
|
5156
|
+
<xsl:attribute name="space-before">12pt</xsl:attribute>
|
5157
|
+
|
5158
|
+
</xsl:if>
|
5144
5159
|
<xsl:apply-templates/>
|
5145
5160
|
</fo:block>
|
5146
5161
|
</xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
|
@@ -5202,6 +5217,7 @@
|
|
5202
5217
|
<xsl:otherwise>
|
5203
5218
|
<fo:block xsl:use-attribute-sets="image-style">
|
5204
5219
|
|
5220
|
+
|
5205
5221
|
<xsl:variable name="src">
|
5206
5222
|
<xsl:call-template name="image_src"/>
|
5207
5223
|
</xsl:variable>
|
@@ -5568,7 +5584,7 @@
|
|
5568
5584
|
<xsl:text> </xsl:text>
|
5569
5585
|
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
|
5570
5586
|
<xsl:value-of select="."/>
|
5571
|
-
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']
|
5587
|
+
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
|
5572
5588
|
<xsl:value-of select="."/>
|
5573
5589
|
</xsl:template><xsl:template match="node()" mode="contents">
|
5574
5590
|
<xsl:apply-templates mode="contents"/>
|
@@ -5666,6 +5682,8 @@
|
|
5666
5682
|
|
5667
5683
|
|
5668
5684
|
|
5685
|
+
|
5686
|
+
|
5669
5687
|
</fo:bookmark-tree>
|
5670
5688
|
</xsl:if>
|
5671
5689
|
</xsl:template><xsl:template name="insertFigureBookmarks">
|
@@ -5859,12 +5877,16 @@
|
|
5859
5877
|
<xsl:if test="$font-size != ''">
|
5860
5878
|
<xsl:attribute name="font-size">
|
5861
5879
|
<xsl:choose>
|
5880
|
+
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
5881
|
+
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
5862
5882
|
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
5863
5883
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
5864
5884
|
</xsl:choose>
|
5865
5885
|
</xsl:attribute>
|
5866
5886
|
</xsl:if>
|
5867
5887
|
|
5888
|
+
|
5889
|
+
|
5868
5890
|
<xsl:apply-templates/>
|
5869
5891
|
</fo:block>
|
5870
5892
|
|
@@ -6107,7 +6129,8 @@
|
|
6107
6129
|
</fo:block>
|
6108
6130
|
</fo:table-cell>
|
6109
6131
|
</xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
|
6110
|
-
<fo:block font-size="11pt"
|
6132
|
+
<fo:block font-size="11pt">
|
6133
|
+
|
6111
6134
|
<xsl:apply-templates/>
|
6112
6135
|
</fo:block>
|
6113
6136
|
</xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
|
@@ -6217,6 +6240,7 @@
|
|
6217
6240
|
</xsl:choose>
|
6218
6241
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
|
6219
6242
|
<fo:block xsl:use-attribute-sets="termsource-style">
|
6243
|
+
|
6220
6244
|
<!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
|
6221
6245
|
<xsl:variable name="termsource_text">
|
6222
6246
|
<xsl:apply-templates/>
|
@@ -6227,13 +6251,15 @@
|
|
6227
6251
|
<!-- <xsl:apply-templates /> -->
|
6228
6252
|
<xsl:copy-of select="$termsource_text"/>
|
6229
6253
|
</xsl:when>
|
6230
|
-
<xsl:otherwise>
|
6254
|
+
<xsl:otherwise>
|
6255
|
+
|
6231
6256
|
|
6232
6257
|
<xsl:text>[</xsl:text>
|
6233
6258
|
|
6234
6259
|
<!-- <xsl:apply-templates /> -->
|
6235
6260
|
<xsl:copy-of select="$termsource_text"/>
|
6236
6261
|
|
6262
|
+
|
6237
6263
|
<xsl:text>]</xsl:text>
|
6238
6264
|
|
6239
6265
|
</xsl:otherwise>
|
@@ -6315,12 +6341,20 @@
|
|
6315
6341
|
</xsl:template><xsl:template match="*[local-name() = 'author']">
|
6316
6342
|
<xsl:text>— </xsl:text>
|
6317
6343
|
<xsl:apply-templates/>
|
6318
|
-
</xsl:template><xsl:
|
6344
|
+
</xsl:template><xsl:variable name="bibitem_hidden_">
|
6345
|
+
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
|
6346
|
+
<xsl:copy-of select="."/>
|
6347
|
+
</xsl:for-each>
|
6348
|
+
<xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
|
6349
|
+
<xsl:copy-of select="."/>
|
6350
|
+
</xsl:for-each>
|
6351
|
+
</xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
|
6319
6352
|
|
6320
6353
|
<xsl:variable name="bibitemid">
|
6321
6354
|
<xsl:choose>
|
6322
|
-
<xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"
|
6323
|
-
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"
|
6355
|
+
<!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
|
6356
|
+
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
|
6357
|
+
<xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
|
6324
6358
|
<xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
|
6325
6359
|
</xsl:choose>
|
6326
6360
|
</xsl:variable>
|
@@ -6409,10 +6443,10 @@
|
|
6409
6443
|
</xsl:choose>
|
6410
6444
|
</xsl:variable>
|
6411
6445
|
|
6412
|
-
<xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
|
6446
|
+
<!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
|
6413
6447
|
|
6414
6448
|
<xsl:choose>
|
6415
|
-
<xsl:when test="$
|
6449
|
+
<xsl:when test="$lang = 'zh'">
|
6416
6450
|
<fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
|
6417
6451
|
</xsl:when>
|
6418
6452
|
<xsl:when test="../../@inline-header = 'true'">
|
@@ -7423,12 +7457,15 @@
|
|
7423
7457
|
<xsl:param name="default">left</xsl:param>
|
7424
7458
|
<xsl:attribute name="text-align">
|
7425
7459
|
<xsl:choose>
|
7426
|
-
<xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
|
7460
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
7427
7461
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
7428
7462
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
7429
7463
|
<xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
|
7430
7464
|
</xsl:choose>
|
7431
7465
|
</xsl:attribute>
|
7466
|
+
<xsl:if test="@align = 'indent'">
|
7467
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
7468
|
+
</xsl:if>
|
7432
7469
|
</xsl:template><xsl:template name="number-to-words">
|
7433
7470
|
<xsl:param name="number"/>
|
7434
7471
|
<xsl:param name="first"/>
|
@@ -1798,7 +1798,7 @@
|
|
1798
1798
|
</xsl:variable>
|
1799
1799
|
<fo:block line-height="1.1" role="H{$levelTerm}">
|
1800
1800
|
<fo:block font-weight="bold" keep-with-next="always">
|
1801
|
-
<xsl:apply-templates select="ancestor::iso:term/iso:name" mode="presentation"/>
|
1801
|
+
<xsl:apply-templates select="ancestor::iso:term[1]/iso:name" mode="presentation"/>
|
1802
1802
|
</fo:block>
|
1803
1803
|
<fo:block font-weight="bold" keep-with-next="always">
|
1804
1804
|
<xsl:apply-templates/>
|
@@ -2260,6 +2260,8 @@
|
|
2260
2260
|
|
2261
2261
|
<title-list-figures lang="en">List of Figures</title-list-figures>
|
2262
2262
|
|
2263
|
+
<title-table-figures lang="en">Table of Figures</title-table-figures>
|
2264
|
+
|
2263
2265
|
<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
|
2264
2266
|
|
2265
2267
|
<title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
|
@@ -2558,6 +2560,11 @@
|
|
2558
2560
|
|
2559
2561
|
|
2560
2562
|
|
2563
|
+
</xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
|
2564
|
+
|
2565
|
+
|
2566
|
+
|
2567
|
+
|
2561
2568
|
</xsl:attribute-set><xsl:attribute-set name="note-p-style">
|
2562
2569
|
|
2563
2570
|
|
@@ -3757,9 +3764,8 @@
|
|
3757
3764
|
|
3758
3765
|
<!-- Table's note name (NOTE, for example) -->
|
3759
3766
|
|
3760
|
-
<fo:inline padding-right="2mm">
|
3767
|
+
<fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
|
3761
3768
|
|
3762
|
-
|
3763
3769
|
|
3764
3770
|
|
3765
3771
|
|
@@ -4289,6 +4295,7 @@
|
|
4289
4295
|
<fo:table-cell>
|
4290
4296
|
|
4291
4297
|
<fo:block margin-top="6pt">
|
4298
|
+
<xsl:copy-of select="@id"/>
|
4292
4299
|
|
4293
4300
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
4294
4301
|
|
@@ -4394,6 +4401,8 @@
|
|
4394
4401
|
<xsl:if test="$font-size != ''">
|
4395
4402
|
<xsl:attribute name="font-size">
|
4396
4403
|
<xsl:choose>
|
4404
|
+
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4405
|
+
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4397
4406
|
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4398
4407
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4399
4408
|
</xsl:choose>
|
@@ -5133,14 +5142,20 @@
|
|
5133
5142
|
</xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
|
5134
5143
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
5135
5144
|
</xsl:template><xsl:template match="*[local-name() = 'terms']">
|
5145
|
+
<!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
|
5136
5146
|
<fo:block id="{@id}">
|
5137
5147
|
<xsl:apply-templates/>
|
5138
5148
|
</fo:block>
|
5139
5149
|
</xsl:template><xsl:template match="*[local-name() = 'term']">
|
5150
|
+
<!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
|
5140
5151
|
<fo:block id="{@id}" xsl:use-attribute-sets="term-style">
|
5141
5152
|
|
5142
5153
|
|
5143
|
-
|
5154
|
+
<xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
|
5155
|
+
|
5156
|
+
<xsl:attribute name="space-before">12pt</xsl:attribute>
|
5157
|
+
|
5158
|
+
</xsl:if>
|
5144
5159
|
<xsl:apply-templates/>
|
5145
5160
|
</fo:block>
|
5146
5161
|
</xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
|
@@ -5202,6 +5217,7 @@
|
|
5202
5217
|
<xsl:otherwise>
|
5203
5218
|
<fo:block xsl:use-attribute-sets="image-style">
|
5204
5219
|
|
5220
|
+
|
5205
5221
|
<xsl:variable name="src">
|
5206
5222
|
<xsl:call-template name="image_src"/>
|
5207
5223
|
</xsl:variable>
|
@@ -5568,7 +5584,7 @@
|
|
5568
5584
|
<xsl:text> </xsl:text>
|
5569
5585
|
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
|
5570
5586
|
<xsl:value-of select="."/>
|
5571
|
-
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']
|
5587
|
+
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
|
5572
5588
|
<xsl:value-of select="."/>
|
5573
5589
|
</xsl:template><xsl:template match="node()" mode="contents">
|
5574
5590
|
<xsl:apply-templates mode="contents"/>
|
@@ -5666,6 +5682,8 @@
|
|
5666
5682
|
|
5667
5683
|
|
5668
5684
|
|
5685
|
+
|
5686
|
+
|
5669
5687
|
</fo:bookmark-tree>
|
5670
5688
|
</xsl:if>
|
5671
5689
|
</xsl:template><xsl:template name="insertFigureBookmarks">
|
@@ -5859,12 +5877,16 @@
|
|
5859
5877
|
<xsl:if test="$font-size != ''">
|
5860
5878
|
<xsl:attribute name="font-size">
|
5861
5879
|
<xsl:choose>
|
5880
|
+
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
5881
|
+
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
5862
5882
|
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
5863
5883
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
5864
5884
|
</xsl:choose>
|
5865
5885
|
</xsl:attribute>
|
5866
5886
|
</xsl:if>
|
5867
5887
|
|
5888
|
+
|
5889
|
+
|
5868
5890
|
<xsl:apply-templates/>
|
5869
5891
|
</fo:block>
|
5870
5892
|
|
@@ -6107,7 +6129,8 @@
|
|
6107
6129
|
</fo:block>
|
6108
6130
|
</fo:table-cell>
|
6109
6131
|
</xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
|
6110
|
-
<fo:block font-size="11pt"
|
6132
|
+
<fo:block font-size="11pt">
|
6133
|
+
|
6111
6134
|
<xsl:apply-templates/>
|
6112
6135
|
</fo:block>
|
6113
6136
|
</xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
|
@@ -6217,6 +6240,7 @@
|
|
6217
6240
|
</xsl:choose>
|
6218
6241
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
|
6219
6242
|
<fo:block xsl:use-attribute-sets="termsource-style">
|
6243
|
+
|
6220
6244
|
<!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
|
6221
6245
|
<xsl:variable name="termsource_text">
|
6222
6246
|
<xsl:apply-templates/>
|
@@ -6227,13 +6251,15 @@
|
|
6227
6251
|
<!-- <xsl:apply-templates /> -->
|
6228
6252
|
<xsl:copy-of select="$termsource_text"/>
|
6229
6253
|
</xsl:when>
|
6230
|
-
<xsl:otherwise>
|
6254
|
+
<xsl:otherwise>
|
6255
|
+
|
6231
6256
|
|
6232
6257
|
<xsl:text>[</xsl:text>
|
6233
6258
|
|
6234
6259
|
<!-- <xsl:apply-templates /> -->
|
6235
6260
|
<xsl:copy-of select="$termsource_text"/>
|
6236
6261
|
|
6262
|
+
|
6237
6263
|
<xsl:text>]</xsl:text>
|
6238
6264
|
|
6239
6265
|
</xsl:otherwise>
|
@@ -6315,12 +6341,20 @@
|
|
6315
6341
|
</xsl:template><xsl:template match="*[local-name() = 'author']">
|
6316
6342
|
<xsl:text>— </xsl:text>
|
6317
6343
|
<xsl:apply-templates/>
|
6318
|
-
</xsl:template><xsl:
|
6344
|
+
</xsl:template><xsl:variable name="bibitem_hidden_">
|
6345
|
+
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
|
6346
|
+
<xsl:copy-of select="."/>
|
6347
|
+
</xsl:for-each>
|
6348
|
+
<xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
|
6349
|
+
<xsl:copy-of select="."/>
|
6350
|
+
</xsl:for-each>
|
6351
|
+
</xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
|
6319
6352
|
|
6320
6353
|
<xsl:variable name="bibitemid">
|
6321
6354
|
<xsl:choose>
|
6322
|
-
<xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"
|
6323
|
-
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"
|
6355
|
+
<!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
|
6356
|
+
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
|
6357
|
+
<xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
|
6324
6358
|
<xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
|
6325
6359
|
</xsl:choose>
|
6326
6360
|
</xsl:variable>
|
@@ -6409,10 +6443,10 @@
|
|
6409
6443
|
</xsl:choose>
|
6410
6444
|
</xsl:variable>
|
6411
6445
|
|
6412
|
-
<xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
|
6446
|
+
<!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
|
6413
6447
|
|
6414
6448
|
<xsl:choose>
|
6415
|
-
<xsl:when test="$
|
6449
|
+
<xsl:when test="$lang = 'zh'">
|
6416
6450
|
<fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
|
6417
6451
|
</xsl:when>
|
6418
6452
|
<xsl:when test="../../@inline-header = 'true'">
|
@@ -7423,12 +7457,15 @@
|
|
7423
7457
|
<xsl:param name="default">left</xsl:param>
|
7424
7458
|
<xsl:attribute name="text-align">
|
7425
7459
|
<xsl:choose>
|
7426
|
-
<xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
|
7460
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
7427
7461
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
7428
7462
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
7429
7463
|
<xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
|
7430
7464
|
</xsl:choose>
|
7431
7465
|
</xsl:attribute>
|
7466
|
+
<xsl:if test="@align = 'indent'">
|
7467
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
7468
|
+
</xsl:if>
|
7432
7469
|
</xsl:template><xsl:template name="number-to-words">
|
7433
7470
|
<xsl:param name="number"/>
|
7434
7471
|
<xsl:param name="first"/>
|
data/lib/isodoc/iso/sections.rb
CHANGED
@@ -49,12 +49,14 @@ module IsoDoc
|
|
49
49
|
|
50
50
|
def foreword(isoxml, out)
|
51
51
|
f = isoxml.at(ns("//foreword")) || return
|
52
|
+
@foreword = true
|
52
53
|
page_break(out)
|
53
54
|
out.div **attr_code(id: f["id"]) do |s|
|
54
55
|
clause_name(nil, f.at(ns("./title")) || @i18n.foreword, s,
|
55
56
|
{ class: "ForewordTitle" })
|
56
57
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
57
58
|
end
|
59
|
+
@foreword = false
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
class WordConvert < IsoDoc::WordConvert
|
4
|
+
def figure_cleanup(xml)
|
5
|
+
super
|
6
|
+
xml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
|
7
|
+
t["class"] = "figdl"
|
8
|
+
d = t.add_previous_sibling("<div class='figdl' "\
|
9
|
+
"style='page-break-after:avoid;'/>")
|
10
|
+
t.parent = d.first
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
|
15
|
+
def word_annex_cleanup1(docxml, lvl)
|
16
|
+
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
17
|
+
h2.name = "p"
|
18
|
+
h2["class"] = "h#{lvl}Annex"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def word_annex_cleanup(docxml)
|
23
|
+
(2..6).each { |i| word_annex_cleanup1(docxml, i) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def word_annex_cleanup_h1(docxml)
|
27
|
+
docxml.xpath("//h1[@class = 'Annex']").each do |h|
|
28
|
+
h.name = "p"
|
29
|
+
h["class"] = "ANNEX"
|
30
|
+
end
|
31
|
+
%w(BiblioTitle ForewordTitle IntroTitle).each do |s|
|
32
|
+
docxml.xpath("//*[@class = '#{s}']").each do |h|
|
33
|
+
h.name = "p"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def style_cleanup(docxml)
|
39
|
+
word_annex_cleanup_h1(docxml)
|
40
|
+
style_cleanup1(docxml)
|
41
|
+
end
|
42
|
+
|
43
|
+
def style_cleanup1(docxml)
|
44
|
+
docxml.xpath("//*[@class = 'example']").each do |p|
|
45
|
+
p["class"] = "Example"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def authority_hdr_cleanup(docxml)
|
50
|
+
docxml&.xpath("//div[@class = 'boilerplate-license']")&.each do |d|
|
51
|
+
d.xpath(".//h1").each do |p|
|
52
|
+
p.name = "p"
|
53
|
+
p["class"] = "zzWarningHdr"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
docxml&.xpath("//div[@class = 'boilerplate-copyright']")&.each do |d|
|
57
|
+
d.xpath(".//h1").each do |p|
|
58
|
+
p.name = "p"
|
59
|
+
p["class"] = "zzCopyrightHdr"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def authority_cleanup(docxml)
|
65
|
+
insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
|
66
|
+
auth = docxml&.at("//div[@class = 'boilerplate-license']")&.remove
|
67
|
+
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
|
68
|
+
auth and insert.children = auth
|
69
|
+
insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
|
70
|
+
auth = docxml&.at("//div[@class = 'boilerplate-copyright']")&.remove
|
71
|
+
auth&.xpath(".//p[not(@class)]")&.each do |p|
|
72
|
+
p["class"] = "zzCopyright"
|
73
|
+
end
|
74
|
+
auth&.xpath(".//p[@id = 'boilerplate-message']")&.each do |p|
|
75
|
+
p["class"] = "zzCopyright1"
|
76
|
+
end
|
77
|
+
auth&.xpath(".//p[@id = 'boilerplate-address']")&.each do |p|
|
78
|
+
p["class"] = "zzAddress"
|
79
|
+
end
|
80
|
+
auth&.xpath(".//p[@id = 'boilerplate-place']")&.each do |p|
|
81
|
+
p["class"] = "zzCopyright1"
|
82
|
+
end
|
83
|
+
auth and insert.children = auth
|
84
|
+
end
|
85
|
+
|
86
|
+
def word_cleanup(docxml)
|
87
|
+
authority_hdr_cleanup(docxml)
|
88
|
+
super
|
89
|
+
style_cleanup(docxml)
|
90
|
+
docxml
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative "base_convert"
|
2
2
|
require "isodoc"
|
3
3
|
require_relative "init"
|
4
|
+
require_relative "word_cleanup"
|
4
5
|
|
5
6
|
module IsoDoc
|
6
7
|
module Iso
|
@@ -59,92 +60,11 @@ module IsoDoc
|
|
59
60
|
return if !stage.nil? && stage < 60
|
60
61
|
|
61
62
|
body.br **{ clear: "all", style: "page-break-before:left;"\
|
62
|
-
|
63
|
+
"mso-break-type:section-break" }
|
63
64
|
body.div **{ class: "colophon" } do |div|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
67
|
-
def figure_cleanup(xml)
|
68
|
-
super
|
69
|
-
xml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
|
70
|
-
t["class"] = "figdl"
|
71
|
-
d = t.add_previous_sibling("<div class='figdl' "\
|
72
|
-
"style='page-break-after:avoid;'/>")
|
73
|
-
t.parent = d.first
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
|
78
|
-
def word_annex_cleanup1(docxml, lvl)
|
79
|
-
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
80
|
-
h2.name = "p"
|
81
|
-
h2["class"] = "h#{lvl}Annex"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def word_annex_cleanup(docxml)
|
86
|
-
(2..6).each { |i| word_annex_cleanup1(docxml, i) }
|
87
|
-
end
|
88
|
-
|
89
|
-
def word_annex_cleanup_h1(docxml)
|
90
|
-
docxml.xpath("//h1[@class = 'Annex']").each do |h|
|
91
|
-
h.name = "p"
|
92
|
-
h["class"] = "ANNEX"
|
93
|
-
end
|
94
|
-
%w(BiblioTitle ForewordTitle IntroTitle).each do |s|
|
95
|
-
docxml.xpath("//*[@class = '#{s}']").each do |h|
|
96
|
-
h.name = "p"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def style_cleanup(docxml)
|
102
|
-
word_annex_cleanup_h1(docxml)
|
103
|
-
style_cleanup1(docxml)
|
104
|
-
end
|
105
|
-
|
106
|
-
def style_cleanup1(docxml)
|
107
|
-
docxml.xpath("//*[@class = 'example']").each do |p|
|
108
|
-
p["class"] = "Example"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def authority_hdr_cleanup(docxml)
|
113
|
-
docxml&.xpath("//div[@class = 'boilerplate-license']")&.each do |d|
|
114
|
-
d.xpath(".//h1").each do |p|
|
115
|
-
p.name = "p"
|
116
|
-
p["class"] = "zzWarningHdr"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
docxml&.xpath("//div[@class = 'boilerplate-copyright']")&.each do |d|
|
120
|
-
d.xpath(".//h1").each do |p|
|
121
|
-
p.name = "p"
|
122
|
-
p["class"] = "zzCopyrightHdr"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def authority_cleanup(docxml)
|
128
|
-
insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
|
129
|
-
auth = docxml&.at("//div[@class = 'boilerplate-license']")&.remove
|
130
|
-
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
|
131
|
-
auth and insert.children = auth
|
132
|
-
insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
|
133
|
-
auth = docxml&.at("//div[@class = 'boilerplate-copyright']")&.remove
|
134
|
-
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzCopyright" }
|
135
|
-
auth&.xpath(".//p[@id = 'boilerplate-message']")&.each { |p| p["class"] = "zzCopyright1" }
|
136
|
-
auth&.xpath(".//p[@id = 'boilerplate-address']")&.each { |p| p["class"] = "zzAddress" }
|
137
|
-
auth&.xpath(".//p[@id = 'boilerplate-place']")&.each { |p| p["class"] = "zzCopyright1" }
|
138
|
-
auth and insert.children = auth
|
139
|
-
end
|
140
|
-
|
141
|
-
def word_cleanup(docxml)
|
142
|
-
authority_hdr_cleanup(docxml)
|
143
|
-
super
|
144
|
-
style_cleanup(docxml)
|
145
|
-
docxml
|
146
|
-
end
|
147
|
-
|
148
68
|
def word_toc_preface(level)
|
149
69
|
<<~TOC.freeze
|
150
70
|
<span lang="EN-GB"><span
|
@@ -166,7 +86,7 @@ module IsoDoc
|
|
166
86
|
end
|
167
87
|
|
168
88
|
def bibliography(xml, out)
|
169
|
-
f = xml.at(ns(bibliography_xpath)) and f["hidden"] != "true" or return
|
89
|
+
(f = xml.at(ns(bibliography_xpath)) and f["hidden"] != "true") or return
|
170
90
|
page_break(out)
|
171
91
|
out.div do |div|
|
172
92
|
div.h1 **bibliography_attrs do |h1|
|
@@ -185,13 +105,16 @@ module IsoDoc
|
|
185
105
|
end
|
186
106
|
end
|
187
107
|
|
108
|
+
def definition_parse(node, out)
|
109
|
+
@definition = true
|
110
|
+
super
|
111
|
+
@definition = false
|
112
|
+
end
|
113
|
+
|
188
114
|
def para_class(node)
|
189
|
-
if
|
190
|
-
|
191
|
-
|
192
|
-
"ForewordText"
|
193
|
-
else
|
194
|
-
super
|
115
|
+
if @definition && !@in_footnote then "Definition"
|
116
|
+
elsif @foreword && !@in_footnote then "ForewordText"
|
117
|
+
else super
|
195
118
|
end
|
196
119
|
end
|
197
120
|
|