metanorma-ieee 0.1.2 → 1.0.0
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/lib/isodoc/ieee/html/htmlstyle.css +6 -0
- data/lib/isodoc/ieee/html/wordstyle.css +17 -1
- data/lib/isodoc/ieee/html/wordstyle.scss +17 -1
- data/lib/isodoc/ieee/html_convert.rb +1 -1
- data/lib/isodoc/ieee/i18n.rb +1 -1
- data/lib/isodoc/ieee/ieee.amendment.xsl +263 -70
- data/lib/isodoc/ieee/ieee.standard.xsl +263 -70
- data/lib/isodoc/ieee/init.rb +1 -1
- data/lib/isodoc/ieee/metadata.rb +1 -1
- data/lib/isodoc/ieee/presentation_ref.rb +2 -0
- data/lib/isodoc/ieee/presentation_terms.rb +23 -28
- data/lib/isodoc/ieee/presentation_xml_convert.rb +21 -22
- data/lib/isodoc/ieee/word_authority.rb +3 -3
- data/lib/isodoc/ieee/word_cleanup.rb +8 -0
- data/lib/isodoc/ieee/word_cleanup_blocks.rb +8 -8
- data/lib/isodoc/ieee/xref.rb +9 -13
- data/lib/metanorma/ieee/basicdoc.rng +3 -0
- data/lib/metanorma/ieee/biblio-standoc.rng +1 -1
- data/lib/metanorma/ieee/converter.rb +2 -2
- data/lib/metanorma/ieee/isodoc.rng +2 -1
- data/lib/metanorma/ieee/term_lookup_cleanup.rb +3 -2
- data/lib/metanorma/ieee/validate.rb +1 -1
- data/lib/metanorma/ieee/validate_style.rb +9 -11
- data/lib/metanorma/ieee/version.rb +1 -1
- data/metanorma-ieee.gemspec +1 -1
- metadata +5 -5
data/lib/isodoc/ieee/metadata.rb
CHANGED
@@ -94,7 +94,7 @@ module IsoDoc
|
|
94
94
|
set(:full_doctitle, fulltitle(@metadata[:doctype], draft))
|
95
95
|
set(:abbrev_doctitle, fulltitle(@metadata[:doctype_abbrev], draft))
|
96
96
|
prov = isoxml&.at(ns("//bibdata/title[@type='provenance']")) and
|
97
|
-
set(:provenance_doctitle, prov.children
|
97
|
+
set(:provenance_doctitle, Common::to_xml(prov.children))
|
98
98
|
end
|
99
99
|
|
100
100
|
def fulltitle(type, draft)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative "../../relaton/render/general"
|
2
|
-
|
3
1
|
module IsoDoc
|
4
2
|
module IEEE
|
5
3
|
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
@@ -28,21 +26,19 @@ module IsoDoc
|
|
28
26
|
if coll.all? do |c|
|
29
27
|
c.elements.size == 1 && c.elements.first.name == "p"
|
30
28
|
end
|
31
|
-
ret = coll.map
|
32
|
-
c.elements.first.children.to_xml
|
33
|
-
end
|
29
|
+
ret = coll.map { |c| to_xml(c.elements.first.children) }
|
34
30
|
return "<p>#{ret.join}</p>"
|
35
31
|
end
|
36
|
-
coll.map { |c| c.children
|
32
|
+
coll.map { |c| to_xml(c.children) }.join
|
37
33
|
end
|
38
34
|
|
39
35
|
def unwrap_definition(docxml)
|
40
|
-
docxml.xpath(ns("
|
36
|
+
docxml.xpath(ns(".//definition/verbal-definition")).each do |v|
|
41
37
|
next unless v.elements.all? { |e| %w(termsource p).include?(e.name) }
|
42
38
|
|
43
39
|
p = v.xpath(ns("./p"))
|
44
40
|
v.children =
|
45
|
-
"<p>#{p.map(&:children).map(
|
41
|
+
"<p>#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}</p>" \
|
46
42
|
"#{v.xpath(ns('./termsource')).to_xml}"
|
47
43
|
end
|
48
44
|
super
|
@@ -61,11 +57,11 @@ module IsoDoc
|
|
61
57
|
prev = 0
|
62
58
|
coll[1..-1].each_with_index do |r, i|
|
63
59
|
if coll[prev]["type"] != r["type"]
|
64
|
-
prev = i
|
65
|
-
next
|
60
|
+
prev = i and next
|
66
61
|
end
|
67
|
-
|
68
|
-
|
62
|
+
|
63
|
+
coll[prev].at(ns("./preferred")) << "; #{to_xml(r.at(ns('./preferred'))
|
64
|
+
.children)}"
|
69
65
|
r.remove
|
70
66
|
end
|
71
67
|
end
|
@@ -81,8 +77,7 @@ module IsoDoc
|
|
81
77
|
end
|
82
78
|
|
83
79
|
def sort_terms_key1(elem)
|
84
|
-
return "zzzz"
|
85
|
-
|
80
|
+
elem.nil? and return "zzzz"
|
86
81
|
dup = elem.dup
|
87
82
|
dup.xpath(ns(".//asciimath | .//latexmath")).each(&:remove)
|
88
83
|
dup.text&.strip&.downcase || "zzzz"
|
@@ -134,10 +129,10 @@ module IsoDoc
|
|
134
129
|
new = adm.dup
|
135
130
|
adm["type"] = "equivalent"
|
136
131
|
adm.name = "related"
|
137
|
-
adm.children = "<preferred>#{adm.children
|
132
|
+
adm.children = "<preferred>#{to_xml(adm.children)}</preferred>"
|
138
133
|
adm.parent.next = <<~TERM
|
139
|
-
<term><preferred>#{new.children
|
140
|
-
<related type='see'><preferred>#{pref.children
|
134
|
+
<term><preferred>#{to_xml(new.children)}</preferred>
|
135
|
+
<related type='see'><preferred>#{to_xml(pref.children)}</preferred></related></term>
|
141
136
|
TERM
|
142
137
|
end
|
143
138
|
|
@@ -177,8 +172,8 @@ module IsoDoc
|
|
177
172
|
def collapse_term_related(rels)
|
178
173
|
ret = rels.map do |r|
|
179
174
|
p = r.at(ns("./preferred"))
|
180
|
-
|
181
|
-
|
175
|
+
rel = p ? to_xml(p.children) : "**RELATED TERM NOT FOUND**"
|
176
|
+
"<em>#{@i18n.relatedterms[r['type']]}:</em> #{rel}"
|
182
177
|
end.join(". ")
|
183
178
|
ret += "." unless ret.empty?
|
184
179
|
ret
|
@@ -187,11 +182,10 @@ module IsoDoc
|
|
187
182
|
def collapse_term_template(opt)
|
188
183
|
defn = collapse_unwrap_definition(opt[:def])
|
189
184
|
src = nil
|
190
|
-
opt[:source] and src = "(#{opt[:source].remove.children.
|
185
|
+
opt[:source] and src = "(#{to_xml(opt[:source].remove.children).strip})"
|
186
|
+
t = opt[:pref] ? to_xml(opt[:pref].children) : "**TERM NOT FOUND**"
|
191
187
|
<<~TERM
|
192
|
-
<p>#{opt[:
|
193
|
-
#{collapse_term_related(opt[:rels])}
|
194
|
-
#{src}</p>
|
188
|
+
<p>#{t}: #{defn} #{collapse_term_related(opt[:rels])} #{src}</p>
|
195
189
|
TERM
|
196
190
|
end
|
197
191
|
|
@@ -200,7 +194,8 @@ module IsoDoc
|
|
200
194
|
|
201
195
|
s = defn.remove.xpath(ns("./termsource"))
|
202
196
|
p = defn.at(ns("./p"))
|
203
|
-
!s.empty? && p and p << s.map(&:remove).map(&:children)
|
197
|
+
!s.empty? && p and p << s.map(&:remove).map(&:children)
|
198
|
+
.map { |x| to_xml(x) }.join
|
204
199
|
if defn.elements.size == 1 && defn.elements.first.name == "p"
|
205
200
|
defn.elements.first.children
|
206
201
|
else defn.elements
|
@@ -209,10 +204,10 @@ module IsoDoc
|
|
209
204
|
|
210
205
|
def termsource1(elem)
|
211
206
|
while elem&.next_element&.name == "termsource"
|
212
|
-
elem << "; #{elem.next_element.remove.children
|
207
|
+
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
213
208
|
end
|
214
209
|
adapt = termsource_adapt(elem["status"]) and
|
215
|
-
elem.children = l10n("#{adapt}#{elem.children.
|
210
|
+
elem.children = l10n("#{adapt}#{to_xml(elem.children).strip}")
|
216
211
|
end
|
217
212
|
|
218
213
|
def termsource_adapt(status)
|
@@ -224,7 +219,7 @@ module IsoDoc
|
|
224
219
|
def designation_field(desgn, name)
|
225
220
|
if desgn.name == "preferred"
|
226
221
|
f = desgn.xpath(ns("./../domain | ./../subject")).map(&:remove)
|
227
|
-
.map { |u| u.children
|
222
|
+
.map { |u| to_xml(u.children) }.join(", ")
|
228
223
|
name << ", <#{f}>" unless f.empty?
|
229
224
|
end
|
230
225
|
super
|
@@ -237,7 +232,7 @@ module IsoDoc
|
|
237
232
|
"./admitted[expression/name][abbreviation-type]"))
|
238
233
|
(pref && !x.empty?) or return
|
239
234
|
tail = x.map do |p|
|
240
|
-
p.remove.at(ns("./expression/name")).children.
|
235
|
+
to_xml(p.remove.at(ns("./expression/name")).children).strip
|
241
236
|
end.join(", ")
|
242
237
|
pref << " (#{tail})"
|
243
238
|
end
|
@@ -7,7 +7,7 @@ module IsoDoc
|
|
7
7
|
module IEEE
|
8
8
|
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
9
9
|
def initialize(options)
|
10
|
-
@hierarchical_assets = options[:
|
10
|
+
@hierarchical_assets = options[:hierarchicalassets]
|
11
11
|
super
|
12
12
|
end
|
13
13
|
|
@@ -17,9 +17,10 @@ module IsoDoc
|
|
17
17
|
ret = resolve_eref_connectives(eref_locality_stacks(refs, target,
|
18
18
|
node))
|
19
19
|
node["droploc"] = droploc
|
20
|
-
eref_localities1(target,
|
21
|
-
|
22
|
-
|
20
|
+
eref_localities1({ target: target, number: "pl",
|
21
|
+
type: prefix_clause(target, refs.first.at(ns("./locality"))),
|
22
|
+
from: l10n(ret[1..-1].join), node: node,
|
23
|
+
lang: @lang })
|
23
24
|
end
|
24
25
|
|
25
26
|
def prefix_clause(target, loc)
|
@@ -37,20 +38,18 @@ module IsoDoc
|
|
37
38
|
target&.gsub(/<[^>]+>/, "")&.match(/^IEV$|^IEC 60050-/)
|
38
39
|
end
|
39
40
|
|
40
|
-
def eref_localities1(
|
41
|
-
return nil if type == "anchor"
|
41
|
+
def eref_localities1(opt)
|
42
|
+
return nil if opt[:type] == "anchor"
|
42
43
|
|
43
|
-
type = type.downcase
|
44
|
-
lang == "zh" and
|
45
|
-
return l10n(eref_localities1_zh(target, type, from, upto,
|
46
|
-
node))
|
44
|
+
opt[:type] = opt[:type].downcase
|
45
|
+
opt[:lang] == "zh" and return l10n(eref_localities1_zh(opt))
|
47
46
|
ret = ""
|
48
|
-
node["droploc"] != "true" &&
|
49
|
-
|
50
|
-
ret = eref_locality_populate(type, node)
|
51
|
-
ret += " #{from}" if from
|
52
|
-
ret += "–#{upto}" if upto
|
53
|
-
ret += ")" if type == "list"
|
47
|
+
opt[:node]["droploc"] != "true" &&
|
48
|
+
!subclause?(opt[:target], opt[:type], opt[:from]) and
|
49
|
+
ret = eref_locality_populate(opt[:type], opt[:node], opt[:number])
|
50
|
+
ret += " #{opt[:from]}" if opt[:from]
|
51
|
+
ret += "–#{opt[:upto]}" if opt[:upto]
|
52
|
+
ret += ")" if opt[:type] == "list"
|
54
53
|
l10n(ret)
|
55
54
|
end
|
56
55
|
|
@@ -85,7 +84,7 @@ module IsoDoc
|
|
85
84
|
i = display_order_xpath(docxml, "//preface/*", i)
|
86
85
|
i = display_order_at(docxml, "//clause[@type = 'overview']", i)
|
87
86
|
i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
|
88
|
-
i = display_order_at(docxml, "//sections/terms | "\
|
87
|
+
i = display_order_at(docxml, "//sections/terms | " \
|
89
88
|
"//sections/clause[descendant::terms]", i)
|
90
89
|
i = display_order_at(docxml, "//sections/definitions", i)
|
91
90
|
i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
|
@@ -97,7 +96,7 @@ module IsoDoc
|
|
97
96
|
def annex1(elem)
|
98
97
|
lbl = @xrefs.anchor(elem["id"], :label)
|
99
98
|
if t = elem.at(ns("./title"))
|
100
|
-
t.children = "<strong>#{t.children
|
99
|
+
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
101
100
|
end
|
102
101
|
prefix_name(elem, "<br/>", lbl, "title")
|
103
102
|
end
|
@@ -132,7 +131,7 @@ module IsoDoc
|
|
132
131
|
|
133
132
|
def amend1(elem)
|
134
133
|
elem.xpath(ns("./description/p")).each do |p|
|
135
|
-
p.children = p.children.
|
134
|
+
p.children = to_xml(p.children).strip
|
136
135
|
amend_format(p)
|
137
136
|
end
|
138
137
|
super
|
@@ -144,7 +143,7 @@ module IsoDoc
|
|
144
143
|
%(em strong).include?(para.children.first.name) and
|
145
144
|
para.children = para.elements.first.children
|
146
145
|
end
|
147
|
-
para.children = "<strong><em>#{para.children
|
146
|
+
para.children = "<strong><em>#{to_xml(para.children)}</em></strong>"
|
148
147
|
end
|
149
148
|
|
150
149
|
def section(docxml)
|
@@ -153,7 +152,7 @@ module IsoDoc
|
|
153
152
|
end
|
154
153
|
|
155
154
|
def boilerplate(docxml)
|
156
|
-
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/"\
|
155
|
+
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/" \
|
157
156
|
"clause/title")).each(&:remove)
|
158
157
|
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/clause"))
|
159
158
|
.each do |clause|
|
@@ -211,7 +210,7 @@ module IsoDoc
|
|
211
210
|
def participant_officeholder_para(map, name, idx)
|
212
211
|
name = "<strong>#{name}</strong>" if idx.zero?
|
213
212
|
br = map["role"].size > 30 ? "<br/>" : ""
|
214
|
-
"<p type='officeholder' align='center'>#{name}, #{br}"\
|
213
|
+
"<p type='officeholder' align='center'>#{name}, #{br}" \
|
215
214
|
"<em>#{map['role']}</em></p>"
|
216
215
|
end
|
217
216
|
|
@@ -15,7 +15,7 @@ module IsoDoc
|
|
15
15
|
feedback_table(docxml)
|
16
16
|
f = docxml.at("//div[@class = 'boilerplate-feedback']") or return
|
17
17
|
docxml.at("//aside").previous = <<~FN
|
18
|
-
<aside id="ftn0">#{f.remove
|
18
|
+
<aside id="ftn0">#{to_xml(f.remove)}</aside>
|
19
19
|
FN
|
20
20
|
end
|
21
21
|
|
@@ -103,7 +103,7 @@ module IsoDoc
|
|
103
103
|
div.xpath(".//div").each { |d| d.replace(d.children) }
|
104
104
|
div.elements.each_with_object([[]]) do |e, m|
|
105
105
|
member = e.name == "p" && e["type"] == "officemember"
|
106
|
-
(prev == member and m[-1] << e
|
106
|
+
(prev == member and m[-1] << to_xml(e)) or m << [to_xml(e)]
|
107
107
|
prev = member
|
108
108
|
end.map(&:join)
|
109
109
|
end
|
@@ -143,7 +143,7 @@ module IsoDoc
|
|
143
143
|
i.zero? or div.elements.first.previous = "<p> </p>"
|
144
144
|
i == 4 and
|
145
145
|
div.xpath(".//p[br]").each do |p|
|
146
|
-
p.replace(p.
|
146
|
+
p.replace(to_xml(p).gsub(%r{<br/>}, "</p><p>"))
|
147
147
|
end
|
148
148
|
feedback_style1(div, i)
|
149
149
|
end
|
@@ -107,6 +107,14 @@ module IsoDoc
|
|
107
107
|
FigureTitle: "IEEEStdsRegularFigureCaption",
|
108
108
|
}.freeze
|
109
109
|
|
110
|
+
def table_toc_class
|
111
|
+
%w(IEEEStdsRegularTableCaption TableTitle tabletitle)
|
112
|
+
end
|
113
|
+
|
114
|
+
def figure_toc_class
|
115
|
+
%w(IEEEStdsRegularFigureCaption FigureTitle figuretitle)
|
116
|
+
end
|
117
|
+
|
110
118
|
def style_cleanup(docxml)
|
111
119
|
note_style_cleanup(docxml)
|
112
120
|
docxml.xpath("//div[@class = 'formula']/p").each do |p|
|
@@ -28,7 +28,7 @@ module IsoDoc
|
|
28
28
|
end
|
29
29
|
else
|
30
30
|
t.children =
|
31
|
-
"<p class='IEEEStdsTableColumnHead'>#{t.children
|
31
|
+
"<p class='IEEEStdsTableColumnHead'>#{to_xml(t.children)}</p>"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -45,9 +45,9 @@ module IsoDoc
|
|
45
45
|
|
46
46
|
def tbody_head_cleanup(cell)
|
47
47
|
cell.at("./p") or
|
48
|
-
cell.children = "<p>#{cell.children
|
48
|
+
cell.children = "<p>#{to_xml(cell.children)}</p>"
|
49
49
|
cell.xpath("./p").each do |p|
|
50
|
-
p.replace p.
|
50
|
+
p.replace to_xml(p).gsub(%r{<br/>}, "</p><p>")
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -58,7 +58,7 @@ module IsoDoc
|
|
58
58
|
end
|
59
59
|
else
|
60
60
|
cell.children =
|
61
|
-
"<p class='#{td_style(cell, 0)}'>#{cell.children
|
61
|
+
"<p class='#{td_style(cell, 0)}'>#{to_xml(cell.children)}</p>"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -80,28 +80,28 @@ module IsoDoc
|
|
80
80
|
|
81
81
|
def table_caption(docxml)
|
82
82
|
docxml.xpath("//p[@class = 'TableTitle']").each do |s|
|
83
|
-
s.children = s.children
|
83
|
+
s.children = to_xml(s.children)
|
84
84
|
.sub(/^#{@i18n.table}(\s+[A-Z0-9.]+)?/, "")
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
88
|
def figure_caption(docxml)
|
89
89
|
docxml.xpath("//p[@class = 'FigureTitle']").each do |s|
|
90
|
-
s.children = s.children
|
90
|
+
s.children = to_xml(s.children)
|
91
91
|
.sub(/^#{@i18n.figure}(\s+[A-Z0-9.]+)?/, "")
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
def example_caption(docxml)
|
96
96
|
docxml.xpath("//p[@class = 'example-title']").each do |s|
|
97
|
-
s.children = "<em>#{s.children
|
97
|
+
s.children = "<em>#{to_xml(s.children)}</em>"
|
98
98
|
s["class"] = "IEEEStdsParagraph"
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
def sourcecode_cleanup(docxml)
|
103
103
|
docxml.xpath("//p[@class = 'Sourcecode']").each do |s|
|
104
|
-
s.replace(s.
|
104
|
+
s.replace(to_xml(s).gsub(%r{<br/>}, "</p><p class='Sourcecode'>"))
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
data/lib/isodoc/ieee/xref.rb
CHANGED
@@ -8,7 +8,7 @@ module IsoDoc
|
|
8
8
|
class Xref < ::IsoDoc::Xref
|
9
9
|
def initialize(lang, script, klass, labels, options)
|
10
10
|
super
|
11
|
-
@hierarchical_assets = options[:
|
11
|
+
@hierarchical_assets = options[:hierarchicalassets]
|
12
12
|
end
|
13
13
|
|
14
14
|
def initial_anchor_names(doc)
|
@@ -29,7 +29,7 @@ module IsoDoc
|
|
29
29
|
n = Counter.new
|
30
30
|
n = section_names(doc.at(ns("//clause[@type = 'overview']")), n, 1)
|
31
31
|
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
32
|
-
n = section_names(doc.at(ns("//sections/terms | "\
|
32
|
+
n = section_names(doc.at(ns("//sections/terms | " \
|
33
33
|
"//sections/clause[descendant::terms]")), n, 1)
|
34
34
|
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
35
35
|
clause_names(doc, n)
|
@@ -37,14 +37,14 @@ module IsoDoc
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def middle_sections
|
40
|
-
" #{@klass.norm_ref_xpath} | "\
|
41
|
-
"//sections/terms | //preface/clause | "\
|
40
|
+
" #{@klass.norm_ref_xpath} | " \
|
41
|
+
"//sections/terms | //preface/clause | " \
|
42
42
|
"//sections/definitions | //clause[parent::sections]"
|
43
43
|
end
|
44
44
|
|
45
45
|
def middle_section_asset_names(doc)
|
46
46
|
middle_sections =
|
47
|
-
"#{@klass.norm_ref_xpath} | //sections/terms | "\
|
47
|
+
"#{@klass.norm_ref_xpath} | //sections/terms | " \
|
48
48
|
"//sections/definitions | //clause[parent::sections]"
|
49
49
|
if @hierarchical_assets
|
50
50
|
doc.xpath(ns(middle_sections)).each do |c|
|
@@ -57,9 +57,7 @@ module IsoDoc
|
|
57
57
|
|
58
58
|
def sequential_formula_names(clause)
|
59
59
|
c = Counter.new
|
60
|
-
clause.xpath(ns(".//formula")).
|
61
|
-
blank?(n["id"])
|
62
|
-
end.each do |t|
|
60
|
+
clause.xpath(ns(".//formula")).noblank.each do |t|
|
63
61
|
@anchors[t["id"]] = anchor_struct(
|
64
62
|
c.increment(t).print, nil,
|
65
63
|
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
@@ -71,14 +69,12 @@ module IsoDoc
|
|
71
69
|
def termnote_anchor_names(docxml)
|
72
70
|
docxml.xpath(ns("//*[termnote]")).each do |t|
|
73
71
|
c = Counter.new
|
74
|
-
sequence = UUIDTools::UUID.random_create.to_s
|
75
72
|
notes = t.xpath(ns("./termnote"))
|
76
|
-
notes.
|
73
|
+
notes.noblank.each do |n|
|
77
74
|
@anchors[n["id"]] =
|
78
75
|
anchor_struct("#{@labels['termnote']} #{increment_label(notes, n, c)}",
|
79
|
-
n,
|
80
|
-
|
81
|
-
.merge(sequence: sequence)
|
76
|
+
n, @labels["note_xref"], "termnote", false)
|
77
|
+
.merge(sequence: UUIDTools::UUID.random_create.to_s)
|
82
78
|
end
|
83
79
|
end
|
84
80
|
end
|
@@ -62,13 +62,13 @@ module Metanorma
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def html_extract_attributes(node)
|
65
|
-
super.merge(
|
65
|
+
super.merge(hierarchicalassets:
|
66
66
|
node.attr("hierarchical-object-numbering"),
|
67
67
|
ieeedtd: node.attr("ieee-dtd"))
|
68
68
|
end
|
69
69
|
|
70
70
|
def doc_extract_attributes(node)
|
71
|
-
super.merge(
|
71
|
+
super.merge(hierarchicalassets:
|
72
72
|
node.attr("hierarchical-object-numbering"),
|
73
73
|
ulstyle: "l11", olstyle: "l16")
|
74
74
|
end
|
@@ -1152,7 +1152,7 @@
|
|
1152
1152
|
<data type="boolean"/>
|
1153
1153
|
</attribute>
|
1154
1154
|
</optional>
|
1155
|
-
<ref name="
|
1155
|
+
<ref name="ReducedBibliographicItem"/>
|
1156
1156
|
</element>
|
1157
1157
|
</define>
|
1158
1158
|
<define name="image" combine="choice">
|
@@ -2653,6 +2653,7 @@
|
|
2653
2653
|
<value>full</value>
|
2654
2654
|
<value>short</value>
|
2655
2655
|
<value>id</value>
|
2656
|
+
<value>modspec</value>
|
2656
2657
|
</choice>
|
2657
2658
|
</define>
|
2658
2659
|
<define name="erefTypeWithConnective">
|
@@ -3,8 +3,9 @@ module Metanorma
|
|
3
3
|
class TermLookupCleanup < Metanorma::Standoc::TermLookupCleanup
|
4
4
|
def remove_missing_ref_term(node, _target)
|
5
5
|
node.at("../xrefrender")&.remove
|
6
|
-
node.replace("<preferred><expression><name>#{node.children.to_xml}"\
|
7
|
-
|
6
|
+
#node.replace("<preferred><expression><name>#{node.children.to_xml}"\
|
7
|
+
# "</name></expression></preferred>")
|
8
|
+
node.replace("<refterm>#{node.children.to_xml}</refterm>")
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -131,7 +131,7 @@ module Metanorma
|
|
131
131
|
klass = IsoDoc::IEEE::HtmlConvert.new(language: @lang, script: @script)
|
132
132
|
xrefs = IsoDoc::IEEE::Xref
|
133
133
|
.new(@lang, @script, klass, IsoDoc::IEEE::I18n.new(@lang, @script),
|
134
|
-
{
|
134
|
+
{ hierarchicalassets: @hierarchical_assets })
|
135
135
|
xrefs.parse(Nokogiri::XML(xmldoc.to_xml))
|
136
136
|
xrefs
|
137
137
|
end
|
@@ -2,9 +2,9 @@ module Metanorma
|
|
2
2
|
module IEEE
|
3
3
|
class Converter < Standoc::Converter
|
4
4
|
ASSETS_TO_STYLE =
|
5
|
-
"//termsource | //formula | //termnote | "\
|
6
|
-
"//p[not(ancestor::boilerplate)] | //li[not(p)] | //dt | "\
|
7
|
-
"//dd[not(p)] | //td[not(p)][not(ancestor::boilerplate)] | "\
|
5
|
+
"//termsource | //formula | //termnote | " \
|
6
|
+
"//p[not(ancestor::boilerplate)] | //li[not(p)] | //dt | " \
|
7
|
+
"//dd[not(p)] | //td[not(p)][not(ancestor::boilerplate)] | " \
|
8
8
|
"//th[not(p)][not(ancestor::boilerplate)] | //example".freeze
|
9
9
|
|
10
10
|
def extract_text(node)
|
@@ -56,8 +56,8 @@ module Metanorma
|
|
56
56
|
end
|
57
57
|
|
58
58
|
# leaving out as problematic: N J K C S T H h d B o E
|
59
|
-
SI_UNIT = "(m|cm|mm|km|μm|nm|g|kg|mgmol|cd|rad|sr|Hz|Hz|MHz|Pa|hPa|kJ|"\
|
60
|
-
"V|kV|W|MW|kW|F|μF|Ω|Wb|°C|lm|lx|Bq|Gy|Sv|kat|l|t|eV|u|Np|Bd|"\
|
59
|
+
SI_UNIT = "(m|cm|mm|km|μm|nm|g|kg|mgmol|cd|rad|sr|Hz|Hz|MHz|Pa|hPa|kJ|" \
|
60
|
+
"V|kV|W|MW|kW|F|μF|Ω|Wb|°C|lm|lx|Bq|Gy|Sv|kat|l|t|eV|u|Np|Bd|" \
|
61
61
|
"bit|kB|MB|Hart|nat|Sh|var)".freeze
|
62
62
|
|
63
63
|
# Style manual 14.2
|
@@ -84,15 +84,15 @@ module Metanorma
|
|
84
84
|
# deliberately doing naive, ignoring rowspan
|
85
85
|
def table_style_columns(table)
|
86
86
|
table_extract_columns(table).each do |col|
|
87
|
-
|
87
|
+
col.any? do |x|
|
88
88
|
/^[0-9. ]+$/.match?(x) &&
|
89
89
|
(/\d{3} \d/.match?(x) || /\d \d{3}/.match?(x))
|
90
|
-
end
|
90
|
+
end or next
|
91
91
|
|
92
92
|
col.each do |x|
|
93
93
|
/^[0-9. ]+$/.match?(x) && /\d{4}/.match?(x) and
|
94
94
|
@log.add("Style", table,
|
95
|
-
"#{x} is a 4-digit number in a table column with "\
|
95
|
+
"#{x} is a 4-digit number in a table column with " \
|
96
96
|
"numbers broken up in threes")
|
97
97
|
end
|
98
98
|
end
|
@@ -108,7 +108,7 @@ module Metanorma
|
|
108
108
|
ret.map { |x| x.is_a?(Array) ? x : [] }
|
109
109
|
end
|
110
110
|
|
111
|
-
|
111
|
+
def title_validate(xml)
|
112
112
|
title_validate_type(xml)
|
113
113
|
title_validate_capitalisation(xml)
|
114
114
|
end
|
@@ -118,8 +118,6 @@ module Metanorma
|
|
118
118
|
title = xml.at("//bibdata/title") or return
|
119
119
|
draft = xml.at("//bibdata//draft")
|
120
120
|
type = xml.at("//bibdata/ext/doctype")
|
121
|
-
subtype = xml.at("//bibdata/ext/subdoctype")
|
122
|
-
subtype = "" if subtype == "document"
|
123
121
|
trial = xml.at("//bibdata/ext/trial-use[text() = 'true']")
|
124
122
|
target = draft ? "Draft " : ""
|
125
123
|
target += trial ? "Trial-Use " : ""
|
data/metanorma-ieee.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
27
27
|
|
28
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
28
|
+
spec.add_dependency "metanorma-standoc", "~> 2.3.0"
|
29
29
|
spec.add_dependency "mnconvert", "~> 1.20"
|
30
30
|
|
31
31
|
spec.add_development_dependency "debug"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-ieee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mnconvert
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
299
|
- !ruby/object:Gem::Version
|
300
300
|
version: '0'
|
301
301
|
requirements: []
|
302
|
-
rubygems_version: 3.3.
|
302
|
+
rubygems_version: 3.3.26
|
303
303
|
signing_key:
|
304
304
|
specification_version: 4
|
305
305
|
summary: Metanorma for the IEEE
|