metanorma-iso 1.9.6 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +2 -2
- data/lib/asciidoctor/iso/isodoc.rng +254 -27
- data/lib/asciidoctor/iso/section.rb +1 -1
- data/lib/asciidoctor/iso/validate.rb +7 -7
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +0 -1
- data/lib/isodoc/iso/html/isodoc.scss +0 -1
- data/lib/isodoc/iso/html/style-human.css +0 -1
- data/lib/isodoc/iso/html/style-human.scss +0 -1
- data/lib/isodoc/iso/html/style-iso.css +0 -1
- data/lib/isodoc/iso/html/style-iso.scss +0 -1
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +57 -17
- data/lib/isodoc/iso/iso.international-standard.xsl +57 -17
- data/lib/isodoc/iso/isosts_convert.rb +6 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +19 -9
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/sts_convert.rb +5 -2
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/processor.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -5
- data/spec/asciidoctor/base_spec.rb +543 -209
- data/spec/asciidoctor/blocks_spec.rb +22 -47
- data/spec/asciidoctor/cleanup_spec.rb +37 -20
- data/spec/asciidoctor/inline_spec.rb +10 -2
- data/spec/asciidoctor/refs_spec.rb +174 -88
- data/spec/asciidoctor/section_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +36 -22
- data/spec/isodoc/inline_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +4 -4
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +25 -25
- data/spec/isodoc/xref_spec.rb +1397 -1376
- data/spec/metanorma/processor_spec.rb +114 -15
- data/spec/spec_helper.rb +2 -1
- data/spec/vcr_cassettes/docrels.yml +427 -37
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +13 -24
data/lib/isodoc/iso/i18n.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Iso
|
3
3
|
class I18n < IsoDoc::I18n
|
4
|
+
def load_file(fname)
|
5
|
+
YAML.load_file(File.join(File.dirname(__FILE__), fname))
|
6
|
+
end
|
7
|
+
|
4
8
|
def load_yaml1(lang, script)
|
5
|
-
y = if lang == "en"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else
|
12
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
13
|
-
end
|
9
|
+
y = if lang == "en" then load_file("i18n-en.yaml")
|
10
|
+
elsif lang == "fr" then load_file("i18n-fr.yaml")
|
11
|
+
elsif lang == "zh" && script == "Hans"
|
12
|
+
load_file("i18n-zh-Hans.yaml")
|
13
|
+
else load_file("i18n-en.yaml")
|
14
|
+
end
|
14
15
|
super.merge(y)
|
15
16
|
end
|
16
17
|
end
|
@@ -1798,9 +1798,10 @@
|
|
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
|
+
<xsl:call-template name="setStyle_preferred"/>
|
1804
1805
|
<xsl:apply-templates/>
|
1805
1806
|
</fo:block>
|
1806
1807
|
</fo:block>
|
@@ -2260,6 +2261,8 @@
|
|
2260
2261
|
|
2261
2262
|
<title-list-figures lang="en">List of Figures</title-list-figures>
|
2262
2263
|
|
2264
|
+
<title-table-figures lang="en">Table of Figures</title-table-figures>
|
2265
|
+
|
2263
2266
|
<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
|
2264
2267
|
|
2265
2268
|
<title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
|
@@ -2763,7 +2766,8 @@
|
|
2763
2766
|
<xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
|
2764
2767
|
|
2765
2768
|
</xsl:template><xsl:template name="processMainSectionsDefault_Contents">
|
2766
|
-
|
2769
|
+
|
2770
|
+
<xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
|
2767
2771
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2768
2772
|
<xsl:apply-templates select="." mode="contents"/>
|
2769
2773
|
</xsl:for-each>
|
@@ -2773,7 +2777,7 @@
|
|
2773
2777
|
<xsl:apply-templates select="." mode="contents"/>
|
2774
2778
|
</xsl:for-each>
|
2775
2779
|
|
2776
|
-
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
2780
|
+
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
2777
2781
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2778
2782
|
<xsl:apply-templates select="." mode="contents"/>
|
2779
2783
|
</xsl:for-each>
|
@@ -4293,6 +4297,7 @@
|
|
4293
4297
|
<fo:table-cell>
|
4294
4298
|
|
4295
4299
|
<fo:block margin-top="6pt">
|
4300
|
+
<xsl:copy-of select="@id"/>
|
4296
4301
|
|
4297
4302
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
4298
4303
|
|
@@ -5139,14 +5144,20 @@
|
|
5139
5144
|
</xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
|
5140
5145
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
5141
5146
|
</xsl:template><xsl:template match="*[local-name() = 'terms']">
|
5147
|
+
<!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
|
5142
5148
|
<fo:block id="{@id}">
|
5143
5149
|
<xsl:apply-templates/>
|
5144
5150
|
</fo:block>
|
5145
5151
|
</xsl:template><xsl:template match="*[local-name() = 'term']">
|
5152
|
+
<!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
|
5146
5153
|
<fo:block id="{@id}" xsl:use-attribute-sets="term-style">
|
5147
5154
|
|
5148
5155
|
|
5149
|
-
|
5156
|
+
<xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
|
5157
|
+
|
5158
|
+
<xsl:attribute name="space-before">12pt</xsl:attribute>
|
5159
|
+
|
5160
|
+
</xsl:if>
|
5150
5161
|
<xsl:apply-templates/>
|
5151
5162
|
</fo:block>
|
5152
5163
|
</xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
|
@@ -5208,6 +5219,7 @@
|
|
5208
5219
|
<xsl:otherwise>
|
5209
5220
|
<fo:block xsl:use-attribute-sets="image-style">
|
5210
5221
|
|
5222
|
+
|
5211
5223
|
<xsl:variable name="src">
|
5212
5224
|
<xsl:call-template name="image_src"/>
|
5213
5225
|
</xsl:variable>
|
@@ -5569,12 +5581,12 @@
|
|
5569
5581
|
</xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
|
5570
5582
|
<xsl:apply-templates mode="contents"/>
|
5571
5583
|
<xsl:text> </xsl:text>
|
5572
|
-
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
|
5584
|
+
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
|
5573
5585
|
<xsl:apply-templates mode="bookmarks"/>
|
5574
5586
|
<xsl:text> </xsl:text>
|
5575
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="contents" priority="2">
|
5576
5588
|
<xsl:value-of select="."/>
|
5577
|
-
</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']
|
5589
|
+
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
|
5578
5590
|
<xsl:value-of select="."/>
|
5579
5591
|
</xsl:template><xsl:template match="node()" mode="contents">
|
5580
5592
|
<xsl:apply-templates mode="contents"/>
|
@@ -5672,6 +5684,8 @@
|
|
5672
5684
|
|
5673
5685
|
|
5674
5686
|
|
5687
|
+
|
5688
|
+
|
5675
5689
|
</fo:bookmark-tree>
|
5676
5690
|
</xsl:if>
|
5677
5691
|
</xsl:template><xsl:template name="insertFigureBookmarks">
|
@@ -5842,6 +5856,8 @@
|
|
5842
5856
|
|
5843
5857
|
|
5844
5858
|
|
5859
|
+
|
5860
|
+
|
5845
5861
|
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
5846
5862
|
<xsl:variable name="_font-size">
|
5847
5863
|
|
@@ -5875,13 +5891,17 @@
|
|
5875
5891
|
|
5876
5892
|
|
5877
5893
|
|
5894
|
+
|
5895
|
+
|
5878
5896
|
<xsl:apply-templates/>
|
5879
5897
|
</fo:block>
|
5880
|
-
|
5898
|
+
|
5881
5899
|
|
5882
5900
|
<xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
|
5883
5901
|
|
5884
5902
|
|
5903
|
+
|
5904
|
+
|
5885
5905
|
</fo:block-container>
|
5886
5906
|
</fo:block-container>
|
5887
5907
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
|
@@ -6117,7 +6137,8 @@
|
|
6117
6137
|
</fo:block>
|
6118
6138
|
</fo:table-cell>
|
6119
6139
|
</xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
|
6120
|
-
<fo:block font-size="11pt"
|
6140
|
+
<fo:block font-size="11pt">
|
6141
|
+
|
6121
6142
|
<xsl:apply-templates/>
|
6122
6143
|
</fo:block>
|
6123
6144
|
</xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
|
@@ -6227,6 +6248,7 @@
|
|
6227
6248
|
</xsl:choose>
|
6228
6249
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
|
6229
6250
|
<fo:block xsl:use-attribute-sets="termsource-style">
|
6251
|
+
|
6230
6252
|
<!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
|
6231
6253
|
<xsl:variable name="termsource_text">
|
6232
6254
|
<xsl:apply-templates/>
|
@@ -6237,13 +6259,15 @@
|
|
6237
6259
|
<!-- <xsl:apply-templates /> -->
|
6238
6260
|
<xsl:copy-of select="$termsource_text"/>
|
6239
6261
|
</xsl:when>
|
6240
|
-
<xsl:otherwise>
|
6262
|
+
<xsl:otherwise>
|
6263
|
+
|
6241
6264
|
|
6242
6265
|
<xsl:text>[</xsl:text>
|
6243
6266
|
|
6244
6267
|
<!-- <xsl:apply-templates /> -->
|
6245
6268
|
<xsl:copy-of select="$termsource_text"/>
|
6246
6269
|
|
6270
|
+
|
6247
6271
|
<xsl:text>]</xsl:text>
|
6248
6272
|
|
6249
6273
|
</xsl:otherwise>
|
@@ -6325,12 +6349,20 @@
|
|
6325
6349
|
</xsl:template><xsl:template match="*[local-name() = 'author']">
|
6326
6350
|
<xsl:text>— </xsl:text>
|
6327
6351
|
<xsl:apply-templates/>
|
6328
|
-
</xsl:template><xsl:
|
6352
|
+
</xsl:template><xsl:variable name="bibitem_hidden_">
|
6353
|
+
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
|
6354
|
+
<xsl:copy-of select="."/>
|
6355
|
+
</xsl:for-each>
|
6356
|
+
<xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
|
6357
|
+
<xsl:copy-of select="."/>
|
6358
|
+
</xsl:for-each>
|
6359
|
+
</xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
|
6329
6360
|
|
6330
6361
|
<xsl:variable name="bibitemid">
|
6331
6362
|
<xsl:choose>
|
6332
|
-
<xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"
|
6333
|
-
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"
|
6363
|
+
<!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
|
6364
|
+
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
|
6365
|
+
<xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
|
6334
6366
|
<xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
|
6335
6367
|
</xsl:choose>
|
6336
6368
|
</xsl:variable>
|
@@ -6419,10 +6451,10 @@
|
|
6419
6451
|
</xsl:choose>
|
6420
6452
|
</xsl:variable>
|
6421
6453
|
|
6422
|
-
<xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
|
6454
|
+
<!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
|
6423
6455
|
|
6424
6456
|
<xsl:choose>
|
6425
|
-
<xsl:when test="$
|
6457
|
+
<xsl:when test="$lang = 'zh'">
|
6426
6458
|
<fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
|
6427
6459
|
</xsl:when>
|
6428
6460
|
<xsl:when test="../../@inline-header = 'true'">
|
@@ -6465,15 +6497,20 @@
|
|
6465
6497
|
<fo:block xsl:use-attribute-sets="deprecates-style">
|
6466
6498
|
<xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
|
6467
6499
|
</fo:block>
|
6500
|
+
</xsl:template><xsl:template name="setStyle_preferred">
|
6501
|
+
<xsl:if test="*[local-name() = 'strong']">
|
6502
|
+
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
6503
|
+
</xsl:if>
|
6468
6504
|
</xsl:template><xsl:template match="*[local-name() = 'definition']">
|
6469
6505
|
<fo:block xsl:use-attribute-sets="definition-style">
|
6470
6506
|
<xsl:apply-templates/>
|
6471
6507
|
</fo:block>
|
6472
6508
|
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
|
6473
6509
|
<xsl:apply-templates/>
|
6474
|
-
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
|
6510
|
+
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
|
6475
6511
|
<fo:inline> <xsl:apply-templates/></fo:inline>
|
6476
|
-
<fo:block
|
6512
|
+
<!-- <fo:block> </fo:block> -->
|
6513
|
+
<fo:block/>
|
6477
6514
|
</xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
|
6478
6515
|
|
6479
6516
|
<fo:block>
|
@@ -7433,12 +7470,15 @@
|
|
7433
7470
|
<xsl:param name="default">left</xsl:param>
|
7434
7471
|
<xsl:attribute name="text-align">
|
7435
7472
|
<xsl:choose>
|
7436
|
-
<xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
|
7473
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
7437
7474
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
7438
7475
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
7439
7476
|
<xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
|
7440
7477
|
</xsl:choose>
|
7441
7478
|
</xsl:attribute>
|
7479
|
+
<xsl:if test="@align = 'indent'">
|
7480
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
7481
|
+
</xsl:if>
|
7442
7482
|
</xsl:template><xsl:template name="number-to-words">
|
7443
7483
|
<xsl:param name="number"/>
|
7444
7484
|
<xsl:param name="first"/>
|
@@ -1798,9 +1798,10 @@
|
|
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
|
+
<xsl:call-template name="setStyle_preferred"/>
|
1804
1805
|
<xsl:apply-templates/>
|
1805
1806
|
</fo:block>
|
1806
1807
|
</fo:block>
|
@@ -2260,6 +2261,8 @@
|
|
2260
2261
|
|
2261
2262
|
<title-list-figures lang="en">List of Figures</title-list-figures>
|
2262
2263
|
|
2264
|
+
<title-table-figures lang="en">Table of Figures</title-table-figures>
|
2265
|
+
|
2263
2266
|
<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
|
2264
2267
|
|
2265
2268
|
<title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
|
@@ -2763,7 +2766,8 @@
|
|
2763
2766
|
<xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
|
2764
2767
|
|
2765
2768
|
</xsl:template><xsl:template name="processMainSectionsDefault_Contents">
|
2766
|
-
|
2769
|
+
|
2770
|
+
<xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
|
2767
2771
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2768
2772
|
<xsl:apply-templates select="." mode="contents"/>
|
2769
2773
|
</xsl:for-each>
|
@@ -2773,7 +2777,7 @@
|
|
2773
2777
|
<xsl:apply-templates select="." mode="contents"/>
|
2774
2778
|
</xsl:for-each>
|
2775
2779
|
|
2776
|
-
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
2780
|
+
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
2777
2781
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2778
2782
|
<xsl:apply-templates select="." mode="contents"/>
|
2779
2783
|
</xsl:for-each>
|
@@ -4293,6 +4297,7 @@
|
|
4293
4297
|
<fo:table-cell>
|
4294
4298
|
|
4295
4299
|
<fo:block margin-top="6pt">
|
4300
|
+
<xsl:copy-of select="@id"/>
|
4296
4301
|
|
4297
4302
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
4298
4303
|
|
@@ -5139,14 +5144,20 @@
|
|
5139
5144
|
</xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
|
5140
5145
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
5141
5146
|
</xsl:template><xsl:template match="*[local-name() = 'terms']">
|
5147
|
+
<!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
|
5142
5148
|
<fo:block id="{@id}">
|
5143
5149
|
<xsl:apply-templates/>
|
5144
5150
|
</fo:block>
|
5145
5151
|
</xsl:template><xsl:template match="*[local-name() = 'term']">
|
5152
|
+
<!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
|
5146
5153
|
<fo:block id="{@id}" xsl:use-attribute-sets="term-style">
|
5147
5154
|
|
5148
5155
|
|
5149
|
-
|
5156
|
+
<xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
|
5157
|
+
|
5158
|
+
<xsl:attribute name="space-before">12pt</xsl:attribute>
|
5159
|
+
|
5160
|
+
</xsl:if>
|
5150
5161
|
<xsl:apply-templates/>
|
5151
5162
|
</fo:block>
|
5152
5163
|
</xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
|
@@ -5208,6 +5219,7 @@
|
|
5208
5219
|
<xsl:otherwise>
|
5209
5220
|
<fo:block xsl:use-attribute-sets="image-style">
|
5210
5221
|
|
5222
|
+
|
5211
5223
|
<xsl:variable name="src">
|
5212
5224
|
<xsl:call-template name="image_src"/>
|
5213
5225
|
</xsl:variable>
|
@@ -5569,12 +5581,12 @@
|
|
5569
5581
|
</xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
|
5570
5582
|
<xsl:apply-templates mode="contents"/>
|
5571
5583
|
<xsl:text> </xsl:text>
|
5572
|
-
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
|
5584
|
+
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
|
5573
5585
|
<xsl:apply-templates mode="bookmarks"/>
|
5574
5586
|
<xsl:text> </xsl:text>
|
5575
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="contents" priority="2">
|
5576
5588
|
<xsl:value-of select="."/>
|
5577
|
-
</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']
|
5589
|
+
</xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
|
5578
5590
|
<xsl:value-of select="."/>
|
5579
5591
|
</xsl:template><xsl:template match="node()" mode="contents">
|
5580
5592
|
<xsl:apply-templates mode="contents"/>
|
@@ -5672,6 +5684,8 @@
|
|
5672
5684
|
|
5673
5685
|
|
5674
5686
|
|
5687
|
+
|
5688
|
+
|
5675
5689
|
</fo:bookmark-tree>
|
5676
5690
|
</xsl:if>
|
5677
5691
|
</xsl:template><xsl:template name="insertFigureBookmarks">
|
@@ -5842,6 +5856,8 @@
|
|
5842
5856
|
|
5843
5857
|
|
5844
5858
|
|
5859
|
+
|
5860
|
+
|
5845
5861
|
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
5846
5862
|
<xsl:variable name="_font-size">
|
5847
5863
|
|
@@ -5875,13 +5891,17 @@
|
|
5875
5891
|
|
5876
5892
|
|
5877
5893
|
|
5894
|
+
|
5895
|
+
|
5878
5896
|
<xsl:apply-templates/>
|
5879
5897
|
</fo:block>
|
5880
|
-
|
5898
|
+
|
5881
5899
|
|
5882
5900
|
<xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
|
5883
5901
|
|
5884
5902
|
|
5903
|
+
|
5904
|
+
|
5885
5905
|
</fo:block-container>
|
5886
5906
|
</fo:block-container>
|
5887
5907
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
|
@@ -6117,7 +6137,8 @@
|
|
6117
6137
|
</fo:block>
|
6118
6138
|
</fo:table-cell>
|
6119
6139
|
</xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
|
6120
|
-
<fo:block font-size="11pt"
|
6140
|
+
<fo:block font-size="11pt">
|
6141
|
+
|
6121
6142
|
<xsl:apply-templates/>
|
6122
6143
|
</fo:block>
|
6123
6144
|
</xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
|
@@ -6227,6 +6248,7 @@
|
|
6227
6248
|
</xsl:choose>
|
6228
6249
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
|
6229
6250
|
<fo:block xsl:use-attribute-sets="termsource-style">
|
6251
|
+
|
6230
6252
|
<!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
|
6231
6253
|
<xsl:variable name="termsource_text">
|
6232
6254
|
<xsl:apply-templates/>
|
@@ -6237,13 +6259,15 @@
|
|
6237
6259
|
<!-- <xsl:apply-templates /> -->
|
6238
6260
|
<xsl:copy-of select="$termsource_text"/>
|
6239
6261
|
</xsl:when>
|
6240
|
-
<xsl:otherwise>
|
6262
|
+
<xsl:otherwise>
|
6263
|
+
|
6241
6264
|
|
6242
6265
|
<xsl:text>[</xsl:text>
|
6243
6266
|
|
6244
6267
|
<!-- <xsl:apply-templates /> -->
|
6245
6268
|
<xsl:copy-of select="$termsource_text"/>
|
6246
6269
|
|
6270
|
+
|
6247
6271
|
<xsl:text>]</xsl:text>
|
6248
6272
|
|
6249
6273
|
</xsl:otherwise>
|
@@ -6325,12 +6349,20 @@
|
|
6325
6349
|
</xsl:template><xsl:template match="*[local-name() = 'author']">
|
6326
6350
|
<xsl:text>— </xsl:text>
|
6327
6351
|
<xsl:apply-templates/>
|
6328
|
-
</xsl:template><xsl:
|
6352
|
+
</xsl:template><xsl:variable name="bibitem_hidden_">
|
6353
|
+
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
|
6354
|
+
<xsl:copy-of select="."/>
|
6355
|
+
</xsl:for-each>
|
6356
|
+
<xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
|
6357
|
+
<xsl:copy-of select="."/>
|
6358
|
+
</xsl:for-each>
|
6359
|
+
</xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
|
6329
6360
|
|
6330
6361
|
<xsl:variable name="bibitemid">
|
6331
6362
|
<xsl:choose>
|
6332
|
-
<xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"
|
6333
|
-
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"
|
6363
|
+
<!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
|
6364
|
+
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
|
6365
|
+
<xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
|
6334
6366
|
<xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
|
6335
6367
|
</xsl:choose>
|
6336
6368
|
</xsl:variable>
|
@@ -6419,10 +6451,10 @@
|
|
6419
6451
|
</xsl:choose>
|
6420
6452
|
</xsl:variable>
|
6421
6453
|
|
6422
|
-
<xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
|
6454
|
+
<!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
|
6423
6455
|
|
6424
6456
|
<xsl:choose>
|
6425
|
-
<xsl:when test="$
|
6457
|
+
<xsl:when test="$lang = 'zh'">
|
6426
6458
|
<fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
|
6427
6459
|
</xsl:when>
|
6428
6460
|
<xsl:when test="../../@inline-header = 'true'">
|
@@ -6465,15 +6497,20 @@
|
|
6465
6497
|
<fo:block xsl:use-attribute-sets="deprecates-style">
|
6466
6498
|
<xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
|
6467
6499
|
</fo:block>
|
6500
|
+
</xsl:template><xsl:template name="setStyle_preferred">
|
6501
|
+
<xsl:if test="*[local-name() = 'strong']">
|
6502
|
+
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
6503
|
+
</xsl:if>
|
6468
6504
|
</xsl:template><xsl:template match="*[local-name() = 'definition']">
|
6469
6505
|
<fo:block xsl:use-attribute-sets="definition-style">
|
6470
6506
|
<xsl:apply-templates/>
|
6471
6507
|
</fo:block>
|
6472
6508
|
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
|
6473
6509
|
<xsl:apply-templates/>
|
6474
|
-
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
|
6510
|
+
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
|
6475
6511
|
<fo:inline> <xsl:apply-templates/></fo:inline>
|
6476
|
-
<fo:block
|
6512
|
+
<!-- <fo:block> </fo:block> -->
|
6513
|
+
<fo:block/>
|
6477
6514
|
</xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
|
6478
6515
|
|
6479
6516
|
<fo:block>
|
@@ -7433,12 +7470,15 @@
|
|
7433
7470
|
<xsl:param name="default">left</xsl:param>
|
7434
7471
|
<xsl:attribute name="text-align">
|
7435
7472
|
<xsl:choose>
|
7436
|
-
<xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
|
7473
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
7437
7474
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
7438
7475
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
7439
7476
|
<xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
|
7440
7477
|
</xsl:choose>
|
7441
7478
|
</xsl:attribute>
|
7479
|
+
<xsl:if test="@align = 'indent'">
|
7480
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
7481
|
+
</xsl:if>
|
7442
7482
|
</xsl:template><xsl:template name="number-to-words">
|
7443
7483
|
<xsl:param name="number"/>
|
7444
7484
|
<xsl:param name="first"/>
|
@@ -22,8 +22,12 @@ module IsoDoc
|
|
22
22
|
f.path
|
23
23
|
end
|
24
24
|
FileUtils.rm_rf dir
|
25
|
-
MnConvert.convert(input_fname,
|
26
|
-
|
25
|
+
MnConvert.convert(input_fname,
|
26
|
+
{
|
27
|
+
input_format: MnConvert::InputFormat::MN,
|
28
|
+
output_file: output_fname || "#{fname}.#{@suffix}",
|
29
|
+
output_format: :iso,
|
30
|
+
})
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
@@ -57,7 +57,7 @@ module IsoDoc
|
|
57
57
|
ret += " 第#{from.text}" if from
|
58
58
|
ret += "–#{upto.text}" if upto
|
59
59
|
loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
|
60
|
-
ret += " #{loc}" unless subsection && type == "clause" ||
|
60
|
+
ret += " #{loc}" unless (subsection && type == "clause") ||
|
61
61
|
type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
|
62
62
|
node["droploc"] == "true"
|
63
63
|
ret += ")" if type == "list"
|
@@ -73,8 +73,8 @@ module IsoDoc
|
|
73
73
|
return l10n(eref_localities1_zh(target, type, from, upto, node,
|
74
74
|
delim))
|
75
75
|
ret = eref_delim(delim, type)
|
76
|
-
ret += eref_locality_populate(type, node) unless subsection &&
|
77
|
-
type == "clause" || type == "list" ||
|
76
|
+
ret += eref_locality_populate(type, node) unless (subsection &&
|
77
|
+
type == "clause") || type == "list" ||
|
78
78
|
target.match(/^IEV$|^IEC 60050-/)
|
79
79
|
ret += " #{from.text}" if from
|
80
80
|
ret += "–#{upto.text}" if upto
|
@@ -163,17 +163,27 @@ module IsoDoc
|
|
163
163
|
i = display_order_xpath(docxml, "//preface/*", i)
|
164
164
|
i = display_order_at(docxml, "//clause[@type = 'scope']", i)
|
165
165
|
i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
# i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
|
170
|
-
i = display_order_xpath(docxml, "//sections/clause[not(@type = 'scope')] | "\
|
171
|
-
"//sections/terms | //sections/definitions", i)
|
166
|
+
i = display_order_xpath(docxml,
|
167
|
+
"//sections/clause[not(@type = 'scope')] | "\
|
168
|
+
"//sections/terms | //sections/definitions", i)
|
172
169
|
i = display_order_xpath(docxml, "//annex", i)
|
173
170
|
i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
|
174
171
|
display_order_xpath(docxml, "//indexsect", i)
|
175
172
|
end
|
176
173
|
|
174
|
+
def termdefinition1(elem)
|
175
|
+
prefix_domain_to_definition(elem)
|
176
|
+
super
|
177
|
+
end
|
178
|
+
|
179
|
+
def prefix_domain_to_definition(elem)
|
180
|
+
((d = elem.at(ns("./domain"))) &&
|
181
|
+
(v = elem.at(ns("./definition/verbal-definition"))) &&
|
182
|
+
v.elements.first.name == "p") or return
|
183
|
+
v.elements.first.children.first.previous =
|
184
|
+
"<#{d.remove.children.to_xml}> "
|
185
|
+
end
|
186
|
+
|
177
187
|
include Init
|
178
188
|
end
|
179
189
|
end
|
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
|
@@ -19,8 +19,11 @@ module IsoDoc
|
|
19
19
|
f.path
|
20
20
|
end
|
21
21
|
FileUtils.rm_rf dir
|
22
|
-
MnConvert.convert(in_fname,
|
23
|
-
|
22
|
+
MnConvert.convert(in_fname,
|
23
|
+
{
|
24
|
+
input_format: MnConvert::InputFormat::MN,
|
25
|
+
output_file: out_fname || "#{filename}.#{@suffix}",
|
26
|
+
})
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|