metanorma-iec 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- 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 +42 -17
- data/lib/isodoc/iec/base_convert.rb +0 -33
- 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 +23 -10
- data/lib/isodoc/iec/presentation_xml_convert.rb +32 -5
- data/lib/metanorma/iec/processor.rb +15 -8
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +0 -4
- data/spec/asciidoctor/cleanup_spec.rb +231 -202
- data/spec/asciidoctor/iev_spec.rb +195 -190
- 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 +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e9809afe49796fd5ec400dd387616e73df0a09771bd0a69b55a9bf13e4e8480
|
4
|
+
data.tar.gz: 674ef4144aaa385a8d24a571468809e8e49a196fd6aeb3b9e19cd5072b24f0c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5a896dc162a2640a028136d6820dbf7cebae8c2b1bbfb18180edf3b7fb667797fd1e0936fade92fcf8a839d962804c2d935e928e8c1e0dd8c40693a449828c
|
7
|
+
data.tar.gz: 968027433e37c6b82322621798d0b0c99007ed00cf01e6da4c531f0e2eec6859911c09598713db705a44b2ee54835f943215aeb26761178cf60d7472afc5ee84
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "asciidoctor"
|
2
2
|
require "metanorma-iso"
|
3
|
-
require_relative "./front
|
3
|
+
require_relative "./front"
|
4
4
|
|
5
5
|
module Asciidoctor
|
6
6
|
module Iec
|
@@ -12,7 +12,10 @@ module Asciidoctor
|
|
12
12
|
|
13
13
|
def init(node)
|
14
14
|
super
|
15
|
-
@is_iev = node.attr("docnumber") == "60050"
|
15
|
+
if @is_iev = node.attr("docnumber") == "60050"
|
16
|
+
@vocab = true
|
17
|
+
node.set_attr("docsubtype", "vocabulary")
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
18
21
|
def boilerplate_file(x_orig)
|
@@ -26,13 +29,15 @@ module Asciidoctor
|
|
26
29
|
|
27
30
|
def doctype_validate(xmldoc)
|
28
31
|
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
29
|
-
%w(international-standard technical-specification technical-report
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
%w(international-standard technical-specification technical-report
|
33
|
+
publicly-available-specification international-workshop-agreement
|
34
|
+
guide interpretation-sheet).include? doctype or
|
35
|
+
@log.add("Document Attributes", nil,
|
36
|
+
"#{doctype} is not a recognised document type")
|
33
37
|
if function = xmldoc&.at("//bibdata/ext/function")&.text
|
34
|
-
%w(emc quality-assurance safety environment).include? function or
|
35
|
-
@log.add("Document Attributes", nil,
|
38
|
+
%w(emc quality-assurance safety environment).include? function or
|
39
|
+
@log.add("Document Attributes", nil,
|
40
|
+
"#{function} is not a recognised document function")
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
@@ -43,29 +48,43 @@ module Asciidoctor
|
|
43
48
|
end
|
44
49
|
|
45
50
|
def html_converter(node)
|
46
|
-
node.nil?
|
51
|
+
if node.nil?
|
52
|
+
IsoDoc::Iec::HtmlConvert.new({})
|
53
|
+
else
|
47
54
|
IsoDoc::Iec::HtmlConvert.new(html_extract_attributes(node))
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
def doc_converter(node)
|
51
|
-
node.nil?
|
59
|
+
if node.nil?
|
60
|
+
IsoDoc::Iec::WordConvert.new({})
|
61
|
+
else
|
52
62
|
IsoDoc::Iec::WordConvert.new(doc_extract_attributes(node))
|
63
|
+
end
|
53
64
|
end
|
54
65
|
|
55
66
|
def pdf_converter(node)
|
56
67
|
return if node.attr("no-pdf")
|
57
|
-
|
68
|
+
|
69
|
+
if node.nil?
|
70
|
+
IsoDoc::Iec::PdfConvert.new({})
|
71
|
+
else
|
58
72
|
IsoDoc::Iec::PdfConvert.new(doc_extract_attributes(node))
|
73
|
+
end
|
59
74
|
end
|
60
75
|
|
61
76
|
def presentation_xml_converter(node)
|
62
|
-
node.nil?
|
77
|
+
if node.nil?
|
78
|
+
IsoDoc::Iec::PresentationXMLConvert.new({})
|
79
|
+
else
|
63
80
|
IsoDoc::Iec::PresentationXMLConvert.new(doc_extract_attributes(node))
|
81
|
+
end
|
64
82
|
end
|
65
83
|
|
66
|
-
def norm_ref_preface(
|
84
|
+
def norm_ref_preface(node)
|
67
85
|
return super unless @is_iev
|
68
|
-
|
86
|
+
|
87
|
+
node.at("./title").next =
|
69
88
|
"<p>#{@i18n.norm_empty_pref}</p>"
|
70
89
|
end
|
71
90
|
|
@@ -73,19 +92,17 @@ module Asciidoctor
|
|
73
92
|
return super unless @is_iev
|
74
93
|
end
|
75
94
|
|
76
|
-
def
|
77
|
-
end
|
78
|
-
|
79
|
-
def sections_names_cleanup(x)
|
95
|
+
def sections_names_cleanup(xml)
|
80
96
|
super
|
81
|
-
@is_iev and replace_title(
|
97
|
+
@is_iev and replace_title(xml, "//introduction",
|
98
|
+
@i18n&.introduction_iev)
|
82
99
|
end
|
83
100
|
|
84
|
-
def note(
|
85
|
-
if
|
101
|
+
def note(note)
|
102
|
+
if note.title == "Note from TC/SC Officers"
|
86
103
|
noko do |xml|
|
87
104
|
xml.tc_sc_officers_note do |c|
|
88
|
-
wrap_in_para(
|
105
|
+
wrap_in_para(note, c)
|
89
106
|
end
|
90
107
|
end.join("\n")
|
91
108
|
else
|
@@ -95,11 +112,11 @@ module Asciidoctor
|
|
95
112
|
|
96
113
|
def note_cleanup(xmldoc)
|
97
114
|
super
|
98
|
-
n = xmldoc.at("//tc-sc-officers-note") and
|
115
|
+
n = xmldoc.at("//tc-sc-officers-note") and
|
116
|
+
xmldoc.at("//bibdata/ext").add_child(n.remove)
|
99
117
|
end
|
100
118
|
|
101
|
-
def image_name_validate(xmldoc)
|
102
|
-
end
|
119
|
+
def image_name_validate(xmldoc); end
|
103
120
|
end
|
104
121
|
end
|
105
122
|
end
|
@@ -199,9 +199,8 @@ module Asciidoctor
|
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
202
|
-
def
|
203
|
-
|
204
|
-
xml.horizontal (node.attr("horizontal") || "false")
|
202
|
+
def metadata_subdoctype(node, xml)
|
203
|
+
super
|
205
204
|
a = node.attr("function") and xml.function a
|
206
205
|
end
|
207
206
|
|
@@ -58,7 +58,7 @@
|
|
58
58
|
<attribute name="alt"/>
|
59
59
|
</optional>
|
60
60
|
<optional>
|
61
|
-
<attribute name="
|
61
|
+
<attribute name="update-type">
|
62
62
|
<data type="boolean"/>
|
63
63
|
</attribute>
|
64
64
|
</optional>
|
@@ -1814,9 +1814,6 @@
|
|
1814
1814
|
<optional>
|
1815
1815
|
<ref name="termsubject"/>
|
1816
1816
|
</optional>
|
1817
|
-
<optional>
|
1818
|
-
<ref name="termusage"/>
|
1819
|
-
</optional>
|
1820
1817
|
<oneOrMore>
|
1821
1818
|
<ref name="termdefinition"/>
|
1822
1819
|
</oneOrMore>
|
@@ -1880,17 +1877,37 @@
|
|
1880
1877
|
</attribute>
|
1881
1878
|
</optional>
|
1882
1879
|
<optional>
|
1883
|
-
<attribute name="
|
1880
|
+
<attribute name="geographic-area"/>
|
1884
1881
|
</optional>
|
1885
1882
|
<choice>
|
1886
1883
|
<ref name="expression_designation"/>
|
1887
1884
|
<ref name="letter_symbol_designation"/>
|
1888
1885
|
<ref name="graphical_symbol_designation"/>
|
1889
1886
|
</choice>
|
1887
|
+
<optional>
|
1888
|
+
<ref name="fieldofapplication"/>
|
1889
|
+
</optional>
|
1890
|
+
<optional>
|
1891
|
+
<ref name="usageinfo"/>
|
1892
|
+
</optional>
|
1890
1893
|
<zeroOrMore>
|
1891
1894
|
<ref name="termsource"/>
|
1892
1895
|
</zeroOrMore>
|
1893
1896
|
</define>
|
1897
|
+
<define name="fieldofapplication">
|
1898
|
+
<element name="field-of-application">
|
1899
|
+
<oneOrMore>
|
1900
|
+
<ref name="PureTextElement"/>
|
1901
|
+
</oneOrMore>
|
1902
|
+
</element>
|
1903
|
+
</define>
|
1904
|
+
<define name="usageinfo">
|
1905
|
+
<element name="usage-info">
|
1906
|
+
<oneOrMore>
|
1907
|
+
<ref name="PureTextElement"/>
|
1908
|
+
</oneOrMore>
|
1909
|
+
</element>
|
1910
|
+
</define>
|
1894
1911
|
<define name="letter_symbol_designation">
|
1895
1912
|
<element name="letter-symbol">
|
1896
1913
|
<optional>
|
@@ -1946,7 +1963,7 @@
|
|
1946
1963
|
</zeroOrMore>
|
1947
1964
|
</element>
|
1948
1965
|
<optional>
|
1949
|
-
<element name="
|
1966
|
+
<element name="abbreviation-type">
|
1950
1967
|
<ref name="AbbreviationType"/>
|
1951
1968
|
</element>
|
1952
1969
|
</optional>
|
@@ -1956,7 +1973,7 @@
|
|
1956
1973
|
</element>
|
1957
1974
|
</optional>
|
1958
1975
|
<optional>
|
1959
|
-
<element name="
|
1976
|
+
<element name="grammar-info">
|
1960
1977
|
<ref name="Grammar"/>
|
1961
1978
|
</element>
|
1962
1979
|
</optional>
|
@@ -1983,6 +2000,11 @@
|
|
1983
2000
|
<ref name="GrammarGender"/>
|
1984
2001
|
</element>
|
1985
2002
|
</zeroOrMore>
|
2003
|
+
<zeroOrMore>
|
2004
|
+
<element name="number">
|
2005
|
+
<ref name="GrammarNumber"/>
|
2006
|
+
</element>
|
2007
|
+
</zeroOrMore>
|
1986
2008
|
<optional>
|
1987
2009
|
<element name="isPreposition">
|
1988
2010
|
<data type="boolean"/>
|
@@ -2014,7 +2036,7 @@
|
|
2014
2036
|
</element>
|
2015
2037
|
</optional>
|
2016
2038
|
<zeroOrMore>
|
2017
|
-
<element name="
|
2039
|
+
<element name="grammar-value">
|
2018
2040
|
<text/>
|
2019
2041
|
</element>
|
2020
2042
|
</zeroOrMore>
|
@@ -2027,6 +2049,13 @@
|
|
2027
2049
|
<value>common</value>
|
2028
2050
|
</choice>
|
2029
2051
|
</define>
|
2052
|
+
<define name="GrammarNumber">
|
2053
|
+
<choice>
|
2054
|
+
<value>singular</value>
|
2055
|
+
<value>dual</value>
|
2056
|
+
<value>plural</value>
|
2057
|
+
</choice>
|
2058
|
+
</define>
|
2030
2059
|
<define name="termdomain">
|
2031
2060
|
<element name="domain">
|
2032
2061
|
<oneOrMore>
|
@@ -2041,13 +2070,6 @@
|
|
2041
2070
|
</oneOrMore>
|
2042
2071
|
</element>
|
2043
2072
|
</define>
|
2044
|
-
<define name="termusage">
|
2045
|
-
<element name="usageinfo">
|
2046
|
-
<oneOrMore>
|
2047
|
-
<ref name="BasicBlock"/>
|
2048
|
-
</oneOrMore>
|
2049
|
-
</element>
|
2050
|
-
</define>
|
2051
2073
|
<define name="termdefinition">
|
2052
2074
|
<element name="definition">
|
2053
2075
|
<choice>
|
@@ -2061,13 +2083,16 @@
|
|
2061
2083
|
</element>
|
2062
2084
|
</define>
|
2063
2085
|
<define name="verbaldefinition">
|
2064
|
-
<element name="
|
2086
|
+
<element name="verbal-definition">
|
2065
2087
|
<oneOrMore>
|
2066
2088
|
<choice>
|
2067
2089
|
<ref name="paragraph"/>
|
2068
2090
|
<ref name="dl"/>
|
2069
2091
|
<ref name="ol"/>
|
2070
2092
|
<ref name="ul"/>
|
2093
|
+
<ref name="table"/>
|
2094
|
+
<ref name="figure"/>
|
2095
|
+
<ref name="formula"/>
|
2071
2096
|
</choice>
|
2072
2097
|
</oneOrMore>
|
2073
2098
|
<zeroOrMore>
|
@@ -2076,7 +2101,7 @@
|
|
2076
2101
|
</element>
|
2077
2102
|
</define>
|
2078
2103
|
<define name="nonverbalrep">
|
2079
|
-
<element name="
|
2104
|
+
<element name="non-verbal-representation">
|
2080
2105
|
<oneOrMore>
|
2081
2106
|
<choice>
|
2082
2107
|
<ref name="table"/>
|
@@ -95,39 +95,6 @@ module IsoDoc
|
|
95
95
|
def set_termdomain(termdomain)
|
96
96
|
return super unless @is_iev
|
97
97
|
end
|
98
|
-
|
99
|
-
def term_suffix(node, out)
|
100
|
-
return unless @is_iev
|
101
|
-
|
102
|
-
domain = node&.at(ns("../domain"))&.text
|
103
|
-
return unless domain
|
104
|
-
|
105
|
-
out << ", <#{domain}>"
|
106
|
-
end
|
107
|
-
|
108
|
-
def deprecated_term_parse(node, out)
|
109
|
-
out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
|
110
|
-
p << l10n("#{@i18n.deprecated}: ")
|
111
|
-
node.children.each { |c| parse(c, p) }
|
112
|
-
term_suffix(node, p)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def admitted_term_parse(node, out)
|
117
|
-
out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
|
118
|
-
node.children.each { |c| parse(c, p) }
|
119
|
-
term_suffix(node, p)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def term_parse(node, out)
|
124
|
-
return super unless @is_iev
|
125
|
-
|
126
|
-
out.p **{ class: "Terms", style: "text-align:left;" } do |p|
|
127
|
-
node.children.each { |c| parse(c, p) }
|
128
|
-
term_suffix(node, p)
|
129
|
-
end
|
130
|
-
end
|
131
98
|
end
|
132
99
|
end
|
133
100
|
end
|
@@ -325,8 +325,7 @@ p.Terms, li.Terms, div.Terms {
|
|
325
325
|
mso-fareast-font-family: "Times New Roman";
|
326
326
|
letter-spacing: .4pt;
|
327
327
|
mso-ansi-language: EN-GB;
|
328
|
-
mso-fareast-language: ZH-CN;
|
329
|
-
font-weight: bold; }
|
328
|
+
mso-fareast-language: ZH-CN; }
|
330
329
|
|
331
330
|
/* IEC: TERM-admitted */
|
332
331
|
p.AltTerms, li.AltTerms, div.AltTerms {
|
@@ -314,8 +314,7 @@ p.Terms, li.Terms, div.Terms
|
|
314
314
|
mso-fareast-font-family:"Times New Roman";
|
315
315
|
letter-spacing:.4pt;
|
316
316
|
mso-ansi-language:EN-GB;
|
317
|
-
mso-fareast-language:ZH-CN;
|
318
|
-
font-weight:bold;}
|
317
|
+
mso-fareast-language:ZH-CN;}
|
319
318
|
/* IEC: TERM-admitted */
|
320
319
|
p.AltTerms, li.AltTerms, div.AltTerms
|
321
320
|
{mso-style-name:"AltTerm\(s\)";
|
@@ -2226,6 +2226,7 @@
|
|
2226
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>
|
@@ -3083,7 +3084,8 @@
|
|
3083
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"/>
|
3084
3085
|
|
3085
3086
|
</xsl:template><xsl:template name="processMainSectionsDefault_Contents">
|
3086
|
-
|
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']]">
|
3087
3089
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3088
3090
|
<xsl:apply-templates select="." mode="contents"/>
|
3089
3091
|
</xsl:for-each>
|
@@ -3093,7 +3095,7 @@
|
|
3093
3095
|
<xsl:apply-templates select="." mode="contents"/>
|
3094
3096
|
</xsl:for-each>
|
3095
3097
|
|
3096
|
-
<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')]]">
|
3097
3099
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3098
3100
|
<xsl:apply-templates select="." mode="contents"/>
|
3099
3101
|
</xsl:for-each>
|
@@ -5856,12 +5858,12 @@
|
|
5856
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">
|
5857
5859
|
<xsl:apply-templates mode="contents"/>
|
5858
5860
|
<xsl:text> </xsl:text>
|
5859
|
-
</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">
|
5860
5862
|
<xsl:apply-templates mode="bookmarks"/>
|
5861
5863
|
<xsl:text> </xsl:text>
|
5862
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">
|
5863
5865
|
<xsl:value-of select="."/>
|
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="bookmarks" priority="2">
|
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">
|
5865
5867
|
<xsl:value-of select="."/>
|
5866
5868
|
</xsl:template><xsl:template match="node()" mode="contents">
|
5867
5869
|
<xsl:apply-templates mode="contents"/>
|
@@ -6131,6 +6133,8 @@
|
|
6131
6133
|
|
6132
6134
|
|
6133
6135
|
|
6136
|
+
|
6137
|
+
|
6134
6138
|
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
6135
6139
|
<xsl:variable name="_font-size">
|
6136
6140
|
|
@@ -6164,13 +6168,17 @@
|
|
6164
6168
|
|
6165
6169
|
|
6166
6170
|
|
6171
|
+
|
6172
|
+
|
6167
6173
|
<xsl:apply-templates/>
|
6168
6174
|
</fo:block>
|
6169
|
-
|
6175
|
+
|
6170
6176
|
|
6171
6177
|
<xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
|
6172
6178
|
|
6173
6179
|
|
6180
|
+
|
6181
|
+
|
6174
6182
|
</fo:block-container>
|
6175
6183
|
</fo:block-container>
|
6176
6184
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
|
@@ -6756,24 +6764,29 @@
|
|
6756
6764
|
</xsl:template><xsl:template match="*[local-name() = 'deprecates']">
|
6757
6765
|
<xsl:variable name="title-deprecated">
|
6758
6766
|
|
6759
|
-
|
6760
|
-
|
6761
|
-
<xsl:with-param name="name" select="'title-deprecated'"/>
|
6767
|
+
<xsl:call-template name="getLocalizedString">
|
6768
|
+
<xsl:with-param name="key">deprecated</xsl:with-param>
|
6762
6769
|
</xsl:call-template>
|
6763
6770
|
|
6771
|
+
|
6764
6772
|
</xsl:variable>
|
6765
6773
|
<fo:block xsl:use-attribute-sets="deprecates-style">
|
6766
6774
|
<xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
|
6767
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>
|
6768
6780
|
</xsl:template><xsl:template match="*[local-name() = 'definition']">
|
6769
6781
|
<fo:block xsl:use-attribute-sets="definition-style">
|
6770
6782
|
<xsl:apply-templates/>
|
6771
6783
|
</fo:block>
|
6772
6784
|
</xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
|
6773
6785
|
<xsl:apply-templates/>
|
6774
|
-
</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]">
|
6775
6787
|
<fo:inline> <xsl:apply-templates/></fo:inline>
|
6776
|
-
<fo:block
|
6788
|
+
<!-- <fo:block> </fo:block> -->
|
6789
|
+
<fo:block/>
|
6777
6790
|
</xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
|
6778
6791
|
|
6779
6792
|
<fo:block>
|
@@ -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
@@ -30,11 +30,11 @@ Gem::Specification.new do |spec|
|
|
30
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"
|