metanorma-iec 1.3.13 → 1.4.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/Rakefile +1 -1
- data/lib/asciidoctor/iec/converter.rb +42 -25
- data/lib/asciidoctor/iec/front.rb +2 -3
- data/lib/asciidoctor/iec/isodoc.rng +254 -27
- data/lib/isodoc/iec/base_convert.rb +2 -35
- data/lib/isodoc/iec/html/htmlstyle.css +3 -1
- data/lib/isodoc/iec/html/htmlstyle.scss +4 -1
- data/lib/isodoc/iec/html/isodoc.css +1 -2
- data/lib/isodoc/iec/html/isodoc.scss +1 -2
- data/lib/isodoc/iec/iec.international-standard.xsl +58 -20
- data/lib/isodoc/iec/presentation_xml_convert.rb +32 -5
- data/lib/isodoc/iec/word_convert.rb +1 -1
- data/lib/metanorma/iec/processor.rb +15 -8
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +3 -3
- data/spec/asciidoctor/base_spec.rb +0 -6
- data/spec/asciidoctor/blocks_spec.rb +2 -75
- data/spec/asciidoctor/cleanup_spec.rb +231 -322
- data/spec/asciidoctor/iev_spec.rb +195 -190
- data/spec/asciidoctor/inline_spec.rb +0 -45
- data/spec/asciidoctor/section_spec.rb +4 -4
- data/spec/isodoc/iev_spec.rb +136 -28
- data/spec/isodoc/terms_spec.rb +190 -181
- data/spec/metanorma/processor_spec.rb +139 -44
- data/spec/spec_helper.rb +10 -12
- metadata +8 -8
@@ -2223,9 +2223,10 @@
|
|
2223
2223
|
</xsl:variable>
|
2224
2224
|
<fo:block line-height="1.1" space-before="14pt" role="H{$levelTerm}">
|
2225
2225
|
<fo:block font-weight="bold" keep-with-next="always">
|
2226
|
-
<xsl:apply-templates select="ancestor::iec:term/iec:name" mode="presentation"/>
|
2226
|
+
<xsl:apply-templates select="ancestor::iec:term[1]/iec:name" mode="presentation"/>
|
2227
2227
|
</fo:block>
|
2228
2228
|
<fo:block font-weight="bold" keep-with-next="always">
|
2229
|
+
<xsl:call-template name="setStyle_preferred"/>
|
2229
2230
|
<xsl:apply-templates/>
|
2230
2231
|
</fo:block>
|
2231
2232
|
</fo:block>
|
@@ -2597,6 +2598,8 @@
|
|
2597
2598
|
|
2598
2599
|
<title-list-figures lang="en">List of Figures</title-list-figures>
|
2599
2600
|
|
2601
|
+
<title-table-figures lang="en">Table of Figures</title-table-figures>
|
2602
|
+
|
2600
2603
|
<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
|
2601
2604
|
|
2602
2605
|
<title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
|
@@ -3081,7 +3084,8 @@
|
|
3081
3084
|
<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"/>
|
3082
3085
|
|
3083
3086
|
</xsl:template><xsl:template name="processMainSectionsDefault_Contents">
|
3084
|
-
|
3087
|
+
|
3088
|
+
<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']]">
|
3085
3089
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3086
3090
|
<xsl:apply-templates select="." mode="contents"/>
|
3087
3091
|
</xsl:for-each>
|
@@ -3091,7 +3095,7 @@
|
|
3091
3095
|
<xsl:apply-templates select="." mode="contents"/>
|
3092
3096
|
</xsl:for-each>
|
3093
3097
|
|
3094
|
-
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
3098
|
+
<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')]]">
|
3095
3099
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3096
3100
|
<xsl:apply-templates select="." mode="contents"/>
|
3097
3101
|
</xsl:for-each>
|
@@ -4573,6 +4577,7 @@
|
|
4573
4577
|
<fo:table-cell>
|
4574
4578
|
|
4575
4579
|
<fo:block margin-top="6pt">
|
4580
|
+
<xsl:copy-of select="@id"/>
|
4576
4581
|
|
4577
4582
|
|
4578
4583
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
@@ -5418,14 +5423,18 @@
|
|
5418
5423
|
</xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
|
5419
5424
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
5420
5425
|
</xsl:template><xsl:template match="*[local-name() = 'terms']">
|
5426
|
+
<!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
|
5421
5427
|
<fo:block id="{@id}">
|
5422
5428
|
<xsl:apply-templates/>
|
5423
5429
|
</fo:block>
|
5424
5430
|
</xsl:template><xsl:template match="*[local-name() = 'term']">
|
5431
|
+
<!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
|
5425
5432
|
<fo:block id="{@id}" xsl:use-attribute-sets="term-style">
|
5426
5433
|
|
5427
5434
|
|
5428
|
-
|
5435
|
+
<xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
|
5436
|
+
|
5437
|
+
</xsl:if>
|
5429
5438
|
<xsl:apply-templates/>
|
5430
5439
|
</fo:block>
|
5431
5440
|
</xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
|
@@ -5487,6 +5496,7 @@
|
|
5487
5496
|
<xsl:otherwise>
|
5488
5497
|
<fo:block xsl:use-attribute-sets="image-style">
|
5489
5498
|
|
5499
|
+
|
5490
5500
|
<xsl:variable name="src">
|
5491
5501
|
<xsl:call-template name="image_src"/>
|
5492
5502
|
</xsl:variable>
|
@@ -5848,12 +5858,12 @@
|
|
5848
5858
|
</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">
|
5849
5859
|
<xsl:apply-templates mode="contents"/>
|
5850
5860
|
<xsl:text> </xsl:text>
|
5851
|
-
</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">
|
5861
|
+
</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">
|
5852
5862
|
<xsl:apply-templates mode="bookmarks"/>
|
5853
5863
|
<xsl:text> </xsl:text>
|
5854
5864
|
</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">
|
5855
5865
|
<xsl:value-of select="."/>
|
5856
|
-
</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']
|
5866
|
+
</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">
|
5857
5867
|
<xsl:value-of select="."/>
|
5858
5868
|
</xsl:template><xsl:template match="node()" mode="contents">
|
5859
5869
|
<xsl:apply-templates mode="contents"/>
|
@@ -5951,6 +5961,8 @@
|
|
5951
5961
|
|
5952
5962
|
|
5953
5963
|
|
5964
|
+
|
5965
|
+
|
5954
5966
|
</fo:bookmark-tree>
|
5955
5967
|
</xsl:if>
|
5956
5968
|
</xsl:template><xsl:template name="insertFigureBookmarks">
|
@@ -6121,6 +6133,8 @@
|
|
6121
6133
|
|
6122
6134
|
|
6123
6135
|
|
6136
|
+
|
6137
|
+
|
6124
6138
|
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
6125
6139
|
<xsl:variable name="_font-size">
|
6126
6140
|
|
@@ -6154,13 +6168,17 @@
|
|
6154
6168
|
|
6155
6169
|
|
6156
6170
|
|
6171
|
+
|
6172
|
+
|
6157
6173
|
<xsl:apply-templates/>
|
6158
6174
|
</fo:block>
|
6159
|
-
|
6175
|
+
|
6160
6176
|
|
6161
6177
|
<xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
|
6162
6178
|
|
6163
6179
|
|
6180
|
+
|
6181
|
+
|
6164
6182
|
</fo:block-container>
|
6165
6183
|
</fo:block-container>
|
6166
6184
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
|
@@ -6396,7 +6414,8 @@
|
|
6396
6414
|
</fo:block>
|
6397
6415
|
</fo:table-cell>
|
6398
6416
|
</xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
|
6399
|
-
<fo:block font-size="11pt"
|
6417
|
+
<fo:block font-size="11pt">
|
6418
|
+
|
6400
6419
|
<xsl:apply-templates/>
|
6401
6420
|
</fo:block>
|
6402
6421
|
</xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
|
@@ -6501,6 +6520,7 @@
|
|
6501
6520
|
</xsl:choose>
|
6502
6521
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
|
6503
6522
|
<fo:block xsl:use-attribute-sets="termsource-style">
|
6523
|
+
|
6504
6524
|
<!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
|
6505
6525
|
<xsl:variable name="termsource_text">
|
6506
6526
|
<xsl:apply-templates/>
|
@@ -6511,13 +6531,15 @@
|
|
6511
6531
|
<!-- <xsl:apply-templates /> -->
|
6512
6532
|
<xsl:copy-of select="$termsource_text"/>
|
6513
6533
|
</xsl:when>
|
6514
|
-
<xsl:otherwise>
|
6534
|
+
<xsl:otherwise>
|
6535
|
+
|
6515
6536
|
|
6516
6537
|
<xsl:text>[</xsl:text>
|
6517
6538
|
|
6518
6539
|
<!-- <xsl:apply-templates /> -->
|
6519
6540
|
<xsl:copy-of select="$termsource_text"/>
|
6520
6541
|
|
6542
|
+
|
6521
6543
|
<xsl:text>]</xsl:text>
|
6522
6544
|
|
6523
6545
|
</xsl:otherwise>
|
@@ -6601,12 +6623,20 @@
|
|
6601
6623
|
</xsl:template><xsl:template match="*[local-name() = 'author']">
|
6602
6624
|
<xsl:text>— </xsl:text>
|
6603
6625
|
<xsl:apply-templates/>
|
6604
|
-
</xsl:template><xsl:
|
6626
|
+
</xsl:template><xsl:variable name="bibitem_hidden_">
|
6627
|
+
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
|
6628
|
+
<xsl:copy-of select="."/>
|
6629
|
+
</xsl:for-each>
|
6630
|
+
<xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
|
6631
|
+
<xsl:copy-of select="."/>
|
6632
|
+
</xsl:for-each>
|
6633
|
+
</xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
|
6605
6634
|
|
6606
6635
|
<xsl:variable name="bibitemid">
|
6607
6636
|
<xsl:choose>
|
6608
|
-
<xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"
|
6609
|
-
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"
|
6637
|
+
<!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
|
6638
|
+
<xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
|
6639
|
+
<xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
|
6610
6640
|
<xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
|
6611
6641
|
</xsl:choose>
|
6612
6642
|
</xsl:variable>
|
@@ -6697,10 +6727,10 @@
|
|
6697
6727
|
</xsl:choose>
|
6698
6728
|
</xsl:variable>
|
6699
6729
|
|
6700
|
-
<xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
|
6730
|
+
<!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
|
6701
6731
|
|
6702
6732
|
<xsl:choose>
|
6703
|
-
<xsl:when test="$
|
6733
|
+
<xsl:when test="$lang = 'zh'">
|
6704
6734
|
<fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
|
6705
6735
|
</xsl:when>
|
6706
6736
|
<xsl:when test="../../@inline-header = 'true'">
|
@@ -6734,24 +6764,29 @@
|
|
6734
6764
|
</xsl:template><xsl:template match="*[local-name() = 'deprecates']">
|
6735
6765
|
<xsl:variable name="title-deprecated">
|
6736
6766
|
|
6737
|
-
|
6738
|
-
|
6739
|
-
<xsl:with-param name="name" select="'title-deprecated'"/>
|
6767
|
+
<xsl:call-template name="getLocalizedString">
|
6768
|
+
<xsl:with-param name="key">deprecated</xsl:with-param>
|
6740
6769
|
</xsl:call-template>
|
6741
6770
|
|
6771
|
+
|
6742
6772
|
</xsl:variable>
|
6743
6773
|
<fo:block xsl:use-attribute-sets="deprecates-style">
|
6744
6774
|
<xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
|
6745
6775
|
</fo:block>
|
6776
|
+
</xsl:template><xsl:template name="setStyle_preferred">
|
6777
|
+
<xsl:if test="*[local-name() = 'strong']">
|
6778
|
+
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
6779
|
+
</xsl:if>
|
6746
6780
|
</xsl:template><xsl:template match="*[local-name() = 'definition']">
|
6747
6781
|
<fo:block xsl:use-attribute-sets="definition-style">
|
6748
6782
|
<xsl:apply-templates/>
|
6749
6783
|
</fo:block>
|
6750
6784
|
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
|
6751
6785
|
<xsl:apply-templates/>
|
6752
|
-
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
|
6786
|
+
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
|
6753
6787
|
<fo:inline> <xsl:apply-templates/></fo:inline>
|
6754
|
-
<fo:block
|
6788
|
+
<!-- <fo:block> </fo:block> -->
|
6789
|
+
<fo:block/>
|
6755
6790
|
</xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
|
6756
6791
|
|
6757
6792
|
<fo:block>
|
@@ -7680,12 +7715,15 @@
|
|
7680
7715
|
<xsl:param name="default">left</xsl:param>
|
7681
7716
|
<xsl:attribute name="text-align">
|
7682
7717
|
<xsl:choose>
|
7683
|
-
<xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
|
7718
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
7684
7719
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
7685
7720
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
7686
7721
|
<xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
|
7687
7722
|
</xsl:choose>
|
7688
7723
|
</xsl:attribute>
|
7724
|
+
<xsl:if test="@align = 'indent'">
|
7725
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
7726
|
+
</xsl:if>
|
7689
7727
|
</xsl:template><xsl:template name="number-to-words">
|
7690
7728
|
<xsl:param name="number"/>
|
7691
7729
|
<xsl:param name="first"/>
|
@@ -29,18 +29,45 @@ module IsoDoc
|
|
29
29
|
.call(elem)
|
30
30
|
end
|
31
31
|
|
32
|
+
DICT_PATHS = { doctype_dict: "./ext/doctype", stage_dict: "./status/stage",
|
33
|
+
substage_dict: "./status/substage",
|
34
|
+
function_dict: "./ext/function",
|
35
|
+
horizontal_dict: "./ext/horizontal" }.freeze
|
36
|
+
|
32
37
|
def bibdata_i18n(bib)
|
33
38
|
fr = IsoDoc::Iec::I18n.new("fr", "Latn")
|
34
39
|
en = IsoDoc::Iec::I18n.new("en", "Latn")
|
35
40
|
[{ lang: "en", i18n: en }, { lang: "fr", i18n: fr }].each do |v|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
hash_translate(bib, v[:i18n].get[lbl.to_s], xpath, v[:lang])
|
40
|
-
end
|
41
|
+
DICT_PATHS.each do |lbl, xpath|
|
42
|
+
hash_translate(bib, v[:i18n].get[lbl.to_s], xpath, v[:lang])
|
43
|
+
end
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
47
|
+
def concept(docxml)
|
48
|
+
@is_iev and concept_iev(docxml)
|
49
|
+
super
|
50
|
+
end
|
51
|
+
|
52
|
+
def concept_iev(docxml)
|
53
|
+
labels = @xrefs.get_anchors.each_with_object({}) do |(k, v), m|
|
54
|
+
m[v[:label]] = k
|
55
|
+
end
|
56
|
+
docpart = docxml&.at(ns("//bibdata/ext/structuredidentifier/"\
|
57
|
+
"project-number/@part"))&.text or return
|
58
|
+
docxml.xpath(ns("//concept/termref[@base = 'IEV']")).each do |t|
|
59
|
+
concept_iev1(t, docpart, labels)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def concept_iev1(termref, docpart, labels)
|
64
|
+
/^#{docpart}-/.match?(termref["target"]) or return
|
65
|
+
newtarget = labels[termref["target"]] or return
|
66
|
+
termref.name = "xref"
|
67
|
+
termref.delete("base")
|
68
|
+
termref["target"] = newtarget
|
69
|
+
end
|
70
|
+
|
44
71
|
include Init
|
45
72
|
end
|
46
73
|
end
|
@@ -3,8 +3,7 @@ require "metanorma/processor"
|
|
3
3
|
module Metanorma
|
4
4
|
module Iec
|
5
5
|
class Processor < Metanorma::Processor
|
6
|
-
|
7
|
-
def initialize
|
6
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
8
7
|
@short = :iec
|
9
8
|
@input_format = :asciidoc
|
10
9
|
@asciidoctor_backend = :iec
|
@@ -14,7 +13,8 @@ module Metanorma
|
|
14
13
|
super.merge(
|
15
14
|
html: "html",
|
16
15
|
doc: "doc",
|
17
|
-
pdf: "pdf"
|
16
|
+
pdf: "pdf",
|
17
|
+
sts: "sts.xml",
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
@@ -33,16 +33,23 @@ module Metanorma
|
|
33
33
|
"Metanorma::Iec #{Metanorma::Iec::VERSION}"
|
34
34
|
end
|
35
35
|
|
36
|
-
def output(isodoc_node, inname, outname, format, options={})
|
36
|
+
def output(isodoc_node, inname, outname, format, options = {})
|
37
37
|
case format
|
38
38
|
when :html
|
39
|
-
IsoDoc::Iec::HtmlConvert.new(options).convert(inname, isodoc_node,
|
39
|
+
IsoDoc::Iec::HtmlConvert.new(options).convert(inname, isodoc_node,
|
40
|
+
nil, outname)
|
40
41
|
when :doc
|
41
|
-
IsoDoc::Iec::WordConvert.new(options).convert(inname, isodoc_node,
|
42
|
+
IsoDoc::Iec::WordConvert.new(options).convert(inname, isodoc_node,
|
43
|
+
nil, outname)
|
42
44
|
when :pdf
|
43
|
-
IsoDoc::Iec::PdfConvert.new(options).convert(inname, isodoc_node,
|
45
|
+
IsoDoc::Iec::PdfConvert.new(options).convert(inname, isodoc_node,
|
46
|
+
nil, outname)
|
47
|
+
when :sts
|
48
|
+
IsoDoc::Iso::StsConvert.new(options).convert(inname, isodoc_node,
|
49
|
+
nil, outname)
|
44
50
|
when :presentation
|
45
|
-
IsoDoc::Iec::PresentationXMLConvert.new(options)
|
51
|
+
IsoDoc::Iec::PresentationXMLConvert.new(options)
|
52
|
+
.convert(inname, isodoc_node, nil, outname)
|
46
53
|
else
|
47
54
|
super
|
48
55
|
end
|
data/metanorma-iec.gemspec
CHANGED
@@ -27,14 +27,14 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
29
29
|
|
30
|
-
spec.add_dependency "metanorma-iso", "~> 1.
|
30
|
+
spec.add_dependency "metanorma-iso", "~> 1.10.0"
|
31
31
|
spec.add_dependency "ruby-jing"
|
32
32
|
|
33
|
-
spec.add_development_dependency "
|
33
|
+
spec.add_development_dependency "debug"
|
34
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
35
35
|
spec.add_development_dependency "guard", "~> 2.14"
|
36
36
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
37
|
-
spec.add_development_dependency "iev", "~> 0.
|
37
|
+
spec.add_development_dependency "iev", "~> 0.3.0"
|
38
38
|
spec.add_development_dependency "rake", "~> 13.0"
|
39
39
|
spec.add_development_dependency "rspec", "~> 3.6"
|
40
40
|
spec.add_development_dependency "rubocop", "~> 1.5.2"
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "fileutils"
|
3
3
|
|
4
|
-
OPTIONS = [backend: :iec, header_footer: true].freeze
|
5
|
-
|
6
4
|
RSpec.describe Asciidoctor::Iec do
|
7
5
|
before(:all) do
|
8
6
|
@blank_hdr = blank_hdr_gen
|
@@ -168,7 +166,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
168
166
|
</relation>
|
169
167
|
<ext>
|
170
168
|
<doctype>article</doctype>
|
171
|
-
<horizontal>false</horizontal>
|
172
169
|
<editorialgroup>
|
173
170
|
<technical-committee number='1' type='A'>TC</technical-committee>
|
174
171
|
<technical-committee number='11' type='A1'>TC1</technical-committee>
|
@@ -677,7 +674,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
677
674
|
</copyright>
|
678
675
|
<ext>
|
679
676
|
<doctype>article</doctype>
|
680
|
-
<horizontal>false</horizontal>
|
681
677
|
<editorialgroup>
|
682
678
|
<technical-committee/>
|
683
679
|
<subcommittee/>
|
@@ -881,7 +877,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
881
877
|
</copyright>
|
882
878
|
<ext>
|
883
879
|
<doctype>article</doctype>
|
884
|
-
<horizontal>false</horizontal>
|
885
880
|
<editorialgroup>
|
886
881
|
<technical-committee/>
|
887
882
|
<subcommittee/>
|
@@ -949,7 +944,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
949
944
|
</copyright>
|
950
945
|
<ext>
|
951
946
|
<doctype>article</doctype>
|
952
|
-
<horizontal>false</horizontal>
|
953
947
|
<editorialgroup>
|
954
948
|
<technical-committee/>
|
955
949
|
<subcommittee/>
|
@@ -133,7 +133,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
133
133
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
134
134
|
#{TERMS_BOILERPLATE}
|
135
135
|
<term id="term-term1">
|
136
|
-
<preferred>Term1</preferred>
|
136
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
137
137
|
<termnote id="_">
|
138
138
|
<p id="_">This is a note</p>
|
139
139
|
</termnote>
|
@@ -255,7 +255,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
255
255
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
256
256
|
#{TERMS_BOILERPLATE}
|
257
257
|
<term id="term-term1">
|
258
|
-
<preferred>Term1</preferred>
|
258
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
259
259
|
<termexample id="_">
|
260
260
|
<p id="_">This is an example</p>
|
261
261
|
</termexample>
|
@@ -467,77 +467,4 @@ RSpec.describe Asciidoctor::Iec do
|
|
467
467
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
468
468
|
.to be_equivalent_to xmlpp(output)
|
469
469
|
end
|
470
|
-
|
471
|
-
it "processes unmodified term sources" do
|
472
|
-
input = <<~INPUT
|
473
|
-
#{ASCIIDOC_BLANK_HDR}
|
474
|
-
== Terms and Definitions
|
475
|
-
|
476
|
-
=== Term1
|
477
|
-
|
478
|
-
[.source]
|
479
|
-
<<ISO2191,section=1>>
|
480
|
-
INPUT
|
481
|
-
output = <<~OUTPUT
|
482
|
-
#{@blank_hdr}
|
483
|
-
<sections>
|
484
|
-
<terms id="_" obligation="normative">
|
485
|
-
<title>Terms and definitions</title>
|
486
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
487
|
-
#{TERMS_BOILERPLATE}
|
488
|
-
<term id="term-term1">
|
489
|
-
<preferred>Term1</preferred>
|
490
|
-
<termsource status="identical">
|
491
|
-
<origin bibitemid="ISO2191" type="inline" citeas="">
|
492
|
-
<localityStack>
|
493
|
-
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
494
|
-
</localityStack>
|
495
|
-
</origin>
|
496
|
-
</termsource>
|
497
|
-
</term>
|
498
|
-
</terms>
|
499
|
-
</sections>
|
500
|
-
</iec-standard>
|
501
|
-
OUTPUT
|
502
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
503
|
-
.to be_equivalent_to xmlpp(output)
|
504
|
-
end
|
505
|
-
|
506
|
-
it "processes modified term sources" do
|
507
|
-
input = <<~INPUT
|
508
|
-
#{ASCIIDOC_BLANK_HDR}
|
509
|
-
== Terms and Definitions
|
510
|
-
|
511
|
-
=== Term1
|
512
|
-
|
513
|
-
[.source]
|
514
|
-
<<ISO2191,section=1>>, with adjustments
|
515
|
-
INPUT
|
516
|
-
output = <<~OUTPUT
|
517
|
-
#{@blank_hdr}
|
518
|
-
<sections>
|
519
|
-
<terms id="_" obligation="normative">
|
520
|
-
<title>Terms and definitions</title>
|
521
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
522
|
-
#{TERMS_BOILERPLATE}
|
523
|
-
<term id="term-term1">
|
524
|
-
<preferred>Term1</preferred>
|
525
|
-
<termsource status="modified">
|
526
|
-
<origin bibitemid="ISO2191" type="inline" citeas="">
|
527
|
-
<localityStack>
|
528
|
-
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
529
|
-
</localityStack>
|
530
|
-
</origin>
|
531
|
-
<modification>
|
532
|
-
<p id="_">with adjustments</p>
|
533
|
-
</modification>
|
534
|
-
</termsource>
|
535
|
-
</term>
|
536
|
-
</terms>
|
537
|
-
</sections>
|
538
|
-
</iec-standard>
|
539
|
-
OUTPUT
|
540
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
541
|
-
.to be_equivalent_to xmlpp(output)
|
542
|
-
end
|
543
470
|
end
|