isodoc 2.12.6 → 2.12.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +2 -2
- data/lib/isodoc/function/inline.rb +2 -1
- data/lib/isodoc/function/terms.rb +32 -10
- data/lib/isodoc/function/to_word_html.rb +11 -5
- data/lib/isodoc/presentation_function/autonum.rb +16 -2
- data/lib/isodoc/presentation_function/concepts.rb +147 -6
- data/lib/isodoc/presentation_function/docid.rb +3 -3
- data/lib/isodoc/presentation_function/erefs.rb +15 -3
- data/lib/isodoc/presentation_function/index.rb +180 -0
- data/lib/isodoc/presentation_function/inline.rb +2 -0
- data/lib/isodoc/presentation_function/refs.rb +12 -8
- data/lib/isodoc/presentation_function/section.rb +2 -6
- data/lib/isodoc/presentation_function/terms.rb +85 -121
- data/lib/isodoc/presentation_function/xrefs.rb +1 -1
- data/lib/isodoc/presentation_xml_convert.rb +3 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +3 -0
- data/lib/isodoc-yaml/i18n-de.yaml +3 -0
- data/lib/isodoc-yaml/i18n-en.yaml +3 -0
- data/lib/isodoc-yaml/i18n-es.yaml +3 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +3 -0
- data/lib/isodoc-yaml/i18n-ja.yaml +3 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +3 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +3 -0
- data/lib/relaton/render-isodoc/config.yml +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46387b5edc802722718eee916f95086aaf651066ca34ff37b440ddcd98ea600
|
4
|
+
data.tar.gz: ec777b74ccacf348dc787500b6e40c1a310c60ba248562fb4534837531e9e690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a90598b6fb6c91a2650761a105bce1d2509895106566ae0296235031f768b0330fb419a247b29670d1f6e56df1911b2cbf099c040101a3bc0ce8352ece2391
|
7
|
+
data.tar.gz: c9491f85801636ee19d61e1185211e407e0dbbf58ffa5a8cfa41d5e7f0b3a8e2a84d262ced72fcf70c9bfa71bea29308d6e2757dc39a0a17eab9b841e78a1619
|
data/isodoc.gemspec
CHANGED
@@ -34,10 +34,10 @@ Gem::Specification.new do |spec|
|
|
34
34
|
# spec.add_dependency "isodoc-i18n", "~> 1.1.0" # already in relaton-render and mn-requirements
|
35
35
|
# spec.add_dependency "relaton-cli"
|
36
36
|
# spec.add_dependency "metanorma-utils", "~> 1.5.0" # already in isodoc-i18n
|
37
|
-
spec.add_dependency "mn2pdf", ">= 2.
|
37
|
+
spec.add_dependency "mn2pdf", ">= 2.13"
|
38
38
|
spec.add_dependency "mn-requirements", "~> 0.4.0"
|
39
39
|
|
40
|
-
spec.add_dependency "relaton-render", "~> 0.
|
40
|
+
spec.add_dependency "relaton-render", "~> 0.9.0"
|
41
41
|
spec.add_dependency "roman-numerals"
|
42
42
|
spec.add_dependency "rouge", "~> 4.0"
|
43
43
|
spec.add_dependency "thread_safe"
|
@@ -21,7 +21,7 @@ module IsoDoc
|
|
21
21
|
SPAN_UNWRAP_CLASSES =
|
22
22
|
%w[fmt-caption-label fmt-label-delim fmt-caption-delim fmt-autonum-delim
|
23
23
|
fmt-element-name fmt-conn fmt-comma fmt-enum-comma fmt-obligation
|
24
|
-
fmt-xref-container].freeze
|
24
|
+
fmt-xref-container fmt-designation-field].freeze
|
25
25
|
|
26
26
|
def span_parse(node, out)
|
27
27
|
klass = node["style"] || node["class"]
|
@@ -203,6 +203,7 @@ module IsoDoc
|
|
203
203
|
def xref_label_parse(node, out); end
|
204
204
|
|
205
205
|
def name_parse(node, out); end
|
206
|
+
def semx_definition_parse(node, out); end
|
206
207
|
|
207
208
|
def floating_title_parse(node, out); end
|
208
209
|
|
@@ -10,21 +10,44 @@ module IsoDoc
|
|
10
10
|
para.children.each { |n| parse(n, out) }
|
11
11
|
end
|
12
12
|
|
13
|
+
def semx_deprecated_term_parse(node, out); end
|
14
|
+
|
13
15
|
def deprecated_term_parse(node, out)
|
14
|
-
|
15
|
-
|
16
|
+
node.children.each do |c|
|
17
|
+
if c.name == "p"
|
18
|
+
out.p class: "DeprecatedTerms", style: "text-align:left;" do |p|
|
19
|
+
c.children.each { |c1| parse(c1, p) }
|
20
|
+
end
|
21
|
+
else parse(c, out)
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
|
26
|
+
def semx_admitted_term_parse(node, out); end
|
27
|
+
|
19
28
|
def admitted_term_parse(node, out)
|
20
|
-
|
21
|
-
|
29
|
+
node.children.each do |c|
|
30
|
+
if c.name == "p"
|
31
|
+
out.p class: "AltTerms", style: "text-align:left;" do |p|
|
32
|
+
c.children.each { |c1| parse(c1, p) }
|
33
|
+
end
|
34
|
+
else parse(c, out)
|
35
|
+
end
|
22
36
|
end
|
23
37
|
end
|
24
38
|
|
39
|
+
def semx_term_parse(node, out); end
|
40
|
+
|
41
|
+
def semx_related_parse(node, out); end
|
42
|
+
|
25
43
|
def term_parse(node, out)
|
26
|
-
|
27
|
-
|
44
|
+
node.children.each do |c|
|
45
|
+
if c.name == "p"
|
46
|
+
out.p class: "Terms", style: "text-align:left;" do |p|
|
47
|
+
c.children.each { |c1| parse(c1, p) }
|
48
|
+
end
|
49
|
+
else parse(c, out)
|
50
|
+
end
|
28
51
|
end
|
29
52
|
end
|
30
53
|
|
@@ -51,16 +74,15 @@ module IsoDoc
|
|
51
74
|
para&.name != "p" and parse(para, div)
|
52
75
|
end
|
53
76
|
|
77
|
+
def semx_termref_parse(node, out); end
|
78
|
+
|
54
79
|
def termref_parse(node, out)
|
55
80
|
out.p do |p|
|
56
81
|
node.children.each { |n| parse(n, p) }
|
57
82
|
end
|
58
83
|
end
|
59
84
|
|
60
|
-
def termdomain_parse(node, out)
|
61
|
-
node["hidden"] == "true" and return
|
62
|
-
node.children.each { |n| parse(n, out) }
|
63
|
-
end
|
85
|
+
def termdomain_parse(node, out); end
|
64
86
|
|
65
87
|
def termdef_parse(node, out)
|
66
88
|
name = node.at(ns("./fmt-name"))&.remove
|
@@ -215,12 +215,18 @@ module IsoDoc
|
|
215
215
|
when "pre" then pre_parse(node, out)
|
216
216
|
when "annotation" then annotation_parse(node, out)
|
217
217
|
when "term" then termdef_parse(node, out)
|
218
|
-
when "preferred" then
|
219
|
-
when "
|
220
|
-
when "
|
218
|
+
when "preferred" then semx_term_parse(node, out)
|
219
|
+
when "fmt-preferred" then term_parse(node, out)
|
220
|
+
when "admitted" then semx_admitted_term_parse(node, out)
|
221
|
+
when "fmt-admitted" then admitted_term_parse(node, out)
|
222
|
+
when "deprecates" then semx_deprecated_term_parse(node, out)
|
223
|
+
when "fmt-deprecates" then deprecated_term_parse(node, out)
|
221
224
|
when "domain" then termdomain_parse(node, out)
|
222
|
-
when "definition" then
|
223
|
-
when "
|
225
|
+
when "definition" then semx_definition_parse(node, out)
|
226
|
+
when "fmt-definition" then definition_parse(node, out)
|
227
|
+
when "termsource" then semx_termref_parse(node, out)
|
228
|
+
when "fmt-termsource" then termref_parse(node, out)
|
229
|
+
when "related" then semx_related_parse(node, out)
|
224
230
|
when "modification" then modification_parse(node, out)
|
225
231
|
when "termnote" then termnote_parse(node, out)
|
226
232
|
when "terms" then terms_parse(node, out)
|
@@ -44,14 +44,23 @@ module IsoDoc
|
|
44
44
|
old.delete("id")
|
45
45
|
end
|
46
46
|
|
47
|
+
def semx_fmt_dup(elem)
|
48
|
+
elem["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
49
|
+
new = Nokogiri::XML(<<~XML).root
|
50
|
+
<semx xmlns='#{elem.namespace.href}' element='#{elem.name}' source='#{elem['original-id'] || elem['id']}'>#{to_xml(elem.children)}</semx>
|
51
|
+
XML
|
52
|
+
strip_duplicate_ids(nil, elem, new)
|
53
|
+
new
|
54
|
+
end
|
55
|
+
|
47
56
|
def gather_all_ids(elem)
|
48
57
|
elem.xpath(".//*[@id]").each_with_object([]) do |i, m|
|
49
58
|
m << i["id"]
|
50
59
|
end
|
51
60
|
end
|
52
61
|
|
53
|
-
# remove ids duplicated between
|
54
|
-
# index terms are assumed transferred to
|
62
|
+
# remove ids duplicated between sem_title and pres_title
|
63
|
+
# index terms are assumed transferred to pres_title from sem_title
|
55
64
|
def strip_duplicate_ids(_node, sem_title, pres_title)
|
56
65
|
sem_title && pres_title or return
|
57
66
|
ids = gather_all_ids(pres_title)
|
@@ -75,6 +84,11 @@ module IsoDoc
|
|
75
84
|
"<semx element='autonum' source='#{id}'>#{num}</semx>"
|
76
85
|
end
|
77
86
|
|
87
|
+
def semx_orig(node, orig = nil)
|
88
|
+
orig ||= node.parent.parent
|
89
|
+
orig.at(".//*[@id = '#{node['source']}']")
|
90
|
+
end
|
91
|
+
|
78
92
|
def labelled_autonum(label, id, num)
|
79
93
|
elem = "<span class='fmt-element-name'>#{label}</span>"
|
80
94
|
num.blank? and return elem
|
@@ -7,6 +7,7 @@ module IsoDoc
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def concept1(node)
|
10
|
+
node.ancestors("definition, termsource, related").empty? or return
|
10
11
|
xref = node&.at(ns("./xref/@target"))&.text or
|
11
12
|
return concept_render(node, ital: "true", ref: "true", bold: "false",
|
12
13
|
linkref: "true", linkmention: "false")
|
@@ -71,20 +72,160 @@ module IsoDoc
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def related(docxml)
|
74
|
-
docxml.xpath(ns("//related")).each { |f| related1(f) }
|
75
|
+
docxml.xpath(ns("//fmt-related/semx")).each { |f| related1(f) }
|
75
76
|
end
|
76
77
|
|
77
78
|
def related1(node)
|
78
|
-
p = node
|
79
|
-
|
80
|
-
label = @i18n.relatedterms[node["type"]].upcase
|
79
|
+
p, ref, orig = related1_prep(node)
|
80
|
+
label = @i18n.relatedterms[orig["type"]].upcase
|
81
81
|
if p && ref
|
82
|
-
node.
|
82
|
+
node.children =(l10n("<p><strong>#{label}:</strong> " \
|
83
83
|
"<em>#{to_xml(p)}</em> (#{Common::to_xml(ref)})</p>"))
|
84
84
|
else
|
85
|
-
node.
|
85
|
+
node.children = (l10n("<p><strong>#{label}:</strong> " \
|
86
86
|
"<strong>**RELATED TERM NOT FOUND**</strong></p>"))
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
def related1_prep(node)
|
91
|
+
p = node.at(ns("./fmt-preferred"))&.children
|
92
|
+
ref = node.at(ns("./xref | ./eref | ./termref"))
|
93
|
+
orig = semx_orig(node)
|
94
|
+
[p, ref, orig]
|
95
|
+
end
|
96
|
+
|
97
|
+
def related_designation1(desgn)
|
98
|
+
out = desgn.parent.at(ns("./fmt-#{desgn.name}"))
|
99
|
+
d1 = semx_fmt_dup(desgn)
|
100
|
+
%w(preferred admitted deprecates).each do |w|
|
101
|
+
d = d1.at(ns("./#{w}[last()]")) and d.after("<fmt-#{w}/>")
|
102
|
+
end
|
103
|
+
out << d1
|
104
|
+
end
|
105
|
+
|
106
|
+
def designation(docxml)
|
107
|
+
docxml.xpath(ns("//related")).each { |p| related_designation1(p) }
|
108
|
+
docxml.xpath(ns("//preferred | //admitted | //deprecates"))
|
109
|
+
.each { |p| designation1(p) }
|
110
|
+
docxml.xpath(ns("//fmt-preferred | //fmt-admitted | //fmt-deprecates"))
|
111
|
+
.each { |t| merge_second_preferred(t) }
|
112
|
+
docxml.xpath(ns("//fmt-deprecates")).each { |d| deprecates(d) }
|
113
|
+
docxml.xpath(ns("//fmt-admitted")).each { |d| admits(d) }
|
114
|
+
end
|
115
|
+
|
116
|
+
def deprecates(elem)
|
117
|
+
elem.xpath(ns(".//semx[@element = 'deprecates']")).each do |t|
|
118
|
+
t.previous = @i18n.l10n("#{@i18n.deprecated}: ")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def admits(elem); end
|
123
|
+
|
124
|
+
def merge_second_preferred(term)
|
125
|
+
pref = nil
|
126
|
+
out = term.xpath(ns("./semx")).each_with_index
|
127
|
+
.with_object([]) do |(p, i), m|
|
128
|
+
if (i.zero? && (pref = p)) || merge_preferred_eligible?(pref, p)
|
129
|
+
m << p
|
130
|
+
else
|
131
|
+
p.wrap("<p></p>")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
pref&.replace(merge_second_preferred1(out, term))
|
135
|
+
end
|
136
|
+
|
137
|
+
def merge_second_preferred1(desgns, term)
|
138
|
+
desgns[1..].each(&:remove)
|
139
|
+
ret = l10n(desgns.map { |x| to_xml(x) }.join("; "))
|
140
|
+
term.ancestors("fmt-related").empty? and ret = "<p>#{ret}</p>"
|
141
|
+
ret
|
142
|
+
end
|
143
|
+
|
144
|
+
def merge_preferred_eligible?(first, second)
|
145
|
+
orig_first, orig_second, firstex, secondex =
|
146
|
+
merge_preferred_eligible_prep(first, second)
|
147
|
+
orig_first["geographic-area"] == orig_second["geographic-area"] &&
|
148
|
+
firstex["language"] == secondex["language"] &&
|
149
|
+
!orig_first.at(ns("./pronunciation | ./grammar | ./graphical-symbol")) &&
|
150
|
+
!orig_second.at(ns("./pronunciation | ./grammar | ./graphical-symbol")) &&
|
151
|
+
orig_first.name == "preferred" && orig_second.name == "preferred"
|
152
|
+
end
|
153
|
+
|
154
|
+
def merge_preferred_eligible_prep(first, second)
|
155
|
+
orig_first = semx_orig(first)
|
156
|
+
orig_second = semx_orig(second)
|
157
|
+
firstex = orig_first.at(ns("./expression")) || {}
|
158
|
+
secondex = orig_second.at(ns("./expression")) || {}
|
159
|
+
[orig_first, orig_second, firstex, secondex]
|
160
|
+
end
|
161
|
+
|
162
|
+
def designation1(desgn)
|
163
|
+
desgn.parent.name == "related" and return
|
164
|
+
out = desgn.parent.at(ns("./fmt-#{desgn.name}"))
|
165
|
+
d1 = semx_fmt_dup(desgn)
|
166
|
+
s = d1.at(ns("./termsource"))
|
167
|
+
name = d1.at(ns("./expression/name | ./letter-symbol/name | " \
|
168
|
+
"./graphical-symbol")) or return
|
169
|
+
designation_annotate(d1, name, desgn)
|
170
|
+
out << d1
|
171
|
+
s and out << s.wrap("<fmt-termsource></fmt-termsource>").parent
|
172
|
+
end
|
173
|
+
|
174
|
+
def designation_annotate(desgn, name, orig)
|
175
|
+
designation_boldface(desgn)
|
176
|
+
designation_field(desgn, name, orig)
|
177
|
+
#g = desgn.at(ns("./expression/grammar")) and
|
178
|
+
#name << ", #{designation_grammar(g).join(', ')}"
|
179
|
+
designation_grammar(desgn, name)
|
180
|
+
designation_localization(desgn, name, orig)
|
181
|
+
designation_pronunciation(desgn, name)
|
182
|
+
designation_bookmarks(desgn, name)
|
183
|
+
desgn.children = name.children
|
184
|
+
end
|
185
|
+
|
186
|
+
def designation_boldface(desgn)
|
187
|
+
desgn["element"] == "preferred" or return
|
188
|
+
name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return
|
189
|
+
name.children = "<strong>#{name.children}</strong>"
|
190
|
+
end
|
191
|
+
|
192
|
+
def designation_field(desgn, name, orig)
|
193
|
+
f = orig.xpath(ns("./field-of-application | ./usage-info"))
|
194
|
+
&.map { |u| to_xml(semx_fmt_dup(u)) }&.join(", ")
|
195
|
+
f&.empty? and return nil
|
196
|
+
name << "<span class='fmt-designation-field'>, <#{f}></span>"
|
197
|
+
end
|
198
|
+
|
199
|
+
def designation_grammar(desgn, name)
|
200
|
+
g = desgn.at(ns("./expression/grammar")) or return
|
201
|
+
ret = []
|
202
|
+
g.xpath(ns("./gender | ./number")).each do |x|
|
203
|
+
ret << @i18n.grammar_abbrevs[x.text]
|
204
|
+
end
|
205
|
+
%w(isPreposition isParticiple isAdjective isVerb isAdverb isNoun)
|
206
|
+
.each do |x|
|
207
|
+
g.at(ns("./#{x}[text() = 'true']")) and ret << @i18n.grammar_abbrevs[x]
|
208
|
+
end
|
209
|
+
name << ", #{ret.join(', ')}"
|
210
|
+
end
|
211
|
+
|
212
|
+
def designation_localization(desgn, name, orig_desgn)
|
213
|
+
loc = [desgn.at(ns("./expression/@language"))&.text,
|
214
|
+
desgn.at(ns("./expression/@script"))&.text,
|
215
|
+
orig_desgn.at("./@geographic-area")&.text].compact
|
216
|
+
loc.empty? and return
|
217
|
+
name << ", #{loc.join(' ')}"
|
218
|
+
end
|
219
|
+
|
220
|
+
def designation_pronunciation(desgn, name)
|
221
|
+
f = desgn.at(ns("./expression/pronunciation")) or return
|
222
|
+
name << ", /#{to_xml(f.children)}/"
|
223
|
+
end
|
224
|
+
|
225
|
+
def designation_bookmarks(desgn, name)
|
226
|
+
desgn.xpath(ns(".//bookmark")).each do |b|
|
227
|
+
name << b.remove
|
228
|
+
end
|
229
|
+
end
|
89
230
|
end
|
90
231
|
end
|
@@ -9,7 +9,7 @@ module IsoDoc
|
|
9
9
|
def pref_ref_code(bib)
|
10
10
|
bib["suppress_identifier"] == "true" and return nil
|
11
11
|
ret = bib.xpath(ns("./docidentifier[@scope = 'biblio-tag']"))
|
12
|
-
ret.empty? or return ret.map(
|
12
|
+
ret.empty? or return ret.map { |x| to_xml(x.children) }
|
13
13
|
ret = pref_ref_code_parse(bib) or return nil
|
14
14
|
ins = bib.at(ns("./docidentifier[last()]"))
|
15
15
|
ret.reverse_each do |r|
|
@@ -50,14 +50,14 @@ module IsoDoc
|
|
50
50
|
|
51
51
|
def bracket_if_num(num)
|
52
52
|
num.nil? and return nil
|
53
|
-
num = num.
|
53
|
+
num = to_xml(num.children).sub(/^\[/, "").sub(/\]$/, "")
|
54
54
|
/^\d+$/.match?(num) and return "[#{num}]"
|
55
55
|
num
|
56
56
|
end
|
57
57
|
|
58
58
|
def unbracket1(ident)
|
59
59
|
ident.nil? and return nil
|
60
|
-
ident.is_a?(String) or ident = ident.
|
60
|
+
ident.is_a?(String) or ident = to_xml(ident.children)
|
61
61
|
ident.sub(/^\[/, "").sub(/\]$/, "")
|
62
62
|
end
|
63
63
|
|
@@ -3,11 +3,23 @@ require "metanorma-utils"
|
|
3
3
|
module IsoDoc
|
4
4
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
5
5
|
def citeas(xmldoc)
|
6
|
-
xmldoc.xpath(ns("//eref | //origin | //quote//source"))
|
6
|
+
xmldoc.xpath(ns("//eref | //origin | //quote//source | //link"))
|
7
|
+
.each do |e|
|
7
8
|
e["bibitemid"] && e["citeas"] or next
|
8
|
-
a = @xrefs.anchor(e["bibitemid"], :xref, false)
|
9
|
-
|
9
|
+
a = @xrefs.anchor(e["bibitemid"], :xref, false) or next
|
10
|
+
e["citeas"] = citeas_cleanup(a)
|
11
|
+
# link generated in collection postprocessing from eref
|
12
|
+
e.name == "link" && e.text.empty? and e.children = e["citeas"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def citeas_cleanup(ref)
|
17
|
+
if /</.match?(ref)
|
18
|
+
xml = Nokogiri::XML("<root>#{ref}</root>")
|
19
|
+
xml.xpath("//semx").each { |x| x.replace(x.children) }
|
20
|
+
ref = to_xml(xml.at("//root").children)
|
10
21
|
end
|
22
|
+
ref
|
11
23
|
end
|
12
24
|
|
13
25
|
def expand_citeas(text)
|
@@ -0,0 +1,180 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
+
def enable_indexsect
|
4
|
+
false
|
5
|
+
end
|
6
|
+
|
7
|
+
def add_id
|
8
|
+
%(id="_#{UUIDTools::UUID.random_create}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def strip_index(docxml)
|
12
|
+
docxml.xpath(ns("//index | //index-xref | //indexsect")).each(&:remove)
|
13
|
+
end
|
14
|
+
|
15
|
+
def index(xml)
|
16
|
+
if enable_indexsect && xml.at(ns("//index"))
|
17
|
+
i = xml.at(ns("//indexsect")) ||
|
18
|
+
xml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}" \
|
19
|
+
"</title></indexsect>").first
|
20
|
+
index = sort_indexterms(xml.xpath(ns("//index")),
|
21
|
+
xml.xpath(ns("//index-xref[@also = 'false']")),
|
22
|
+
xml.xpath(ns("//index-xref[@also = 'true']")))
|
23
|
+
index1(xml, i, index)
|
24
|
+
else strip_index(xml)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def index1(docxml, indexsect, index)
|
29
|
+
c = indexsect.add_child("<ul></ul>").first
|
30
|
+
index.keys.sort.each do |k|
|
31
|
+
words = index[k].keys.each_with_object({}) do |w, v|
|
32
|
+
v[sortable(w).downcase] = w
|
33
|
+
end
|
34
|
+
words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
35
|
+
c.add_child index_entries(words, index[k], w)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
index1_cleanup(docxml)
|
39
|
+
end
|
40
|
+
|
41
|
+
def index1_cleanup(docxml)
|
42
|
+
docxml.xpath(ns("//indexsect//xref")).each do |x|
|
43
|
+
x.children.remove
|
44
|
+
end
|
45
|
+
@xrefs.bookmark_anchor_names(docxml)
|
46
|
+
end
|
47
|
+
|
48
|
+
def sortable(str)
|
49
|
+
str or return " "
|
50
|
+
HTMLEntities.new.decode(Nokogiri::XML.fragment(str).text)
|
51
|
+
end
|
52
|
+
|
53
|
+
def index_entries_opt
|
54
|
+
{ xref_lbl: ", ", see_lbl: ", #{see_lbl}", also_lbl: ", #{also_lbl}" }
|
55
|
+
end
|
56
|
+
|
57
|
+
def index_entries(words, index, primary)
|
58
|
+
ret = index_entries_head(words[primary],
|
59
|
+
index.dig(words[primary], nil, nil),
|
60
|
+
index_entries_opt)
|
61
|
+
words2 = index[words[primary]]&.keys&.compact
|
62
|
+
&.each_with_object({}) { |w, v| v[w.downcase] = w }
|
63
|
+
unless words2.empty?
|
64
|
+
ret += "<ul>"
|
65
|
+
words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
66
|
+
ret += index_entries2(words2, index[words[primary]], w)
|
67
|
+
end
|
68
|
+
ret += "</ul>"
|
69
|
+
end
|
70
|
+
"#{ret}</li>"
|
71
|
+
end
|
72
|
+
|
73
|
+
def index_entries2(words, index, secondary)
|
74
|
+
ret = index_entries_head(words[secondary],
|
75
|
+
index.dig(words[secondary], nil),
|
76
|
+
index_entries_opt)
|
77
|
+
words3 = index[words[secondary]]&.keys&.compact
|
78
|
+
&.each_with_object({}) { |w, v| v[w.downcase] = w }
|
79
|
+
unless words3.empty?
|
80
|
+
ret += "<ul>"
|
81
|
+
words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
82
|
+
ret += (index_entries_head(words3[w],
|
83
|
+
index[words[secondary]][words3[w]],
|
84
|
+
index_entries_opt) + "</li>")
|
85
|
+
end
|
86
|
+
ret += "</ul>"
|
87
|
+
end
|
88
|
+
"#{ret}</li>"
|
89
|
+
end
|
90
|
+
|
91
|
+
def index_entries_head(head, entries, opt)
|
92
|
+
ret = "<li>#{head}"
|
93
|
+
xref = entries&.dig(:xref)&.join(", ")
|
94
|
+
see = index_entries_see(entries, :see)
|
95
|
+
also = index_entries_see(entries, :also)
|
96
|
+
ret += "#{opt[:xref_lbl]} #{xref}" if xref
|
97
|
+
ret += "#{opt[:see_lbl]} #{see}" if see
|
98
|
+
ret += "#{opt[:also_lbl]} #{also}" if also
|
99
|
+
ret
|
100
|
+
end
|
101
|
+
|
102
|
+
def index_entries_see(entries, label)
|
103
|
+
see_sort = entries&.dig(label) or return nil
|
104
|
+
x = see_sort.each_with_object({}) do |w, v|
|
105
|
+
v[sortable(w).downcase] = w
|
106
|
+
end
|
107
|
+
x.keys.localize(@lang.to_sym).sort.to_a.map do |k|
|
108
|
+
# see_sort[k]
|
109
|
+
x[k]
|
110
|
+
end.join(", ")
|
111
|
+
end
|
112
|
+
|
113
|
+
def see_lbl
|
114
|
+
@lang == "en" ? @i18n.see : "<em>#{@i18n.see}</em>"
|
115
|
+
end
|
116
|
+
|
117
|
+
def also_lbl
|
118
|
+
@lang == "en" ? @i18n.see_also : "<em>#{@i18n.see_also}</em>"
|
119
|
+
end
|
120
|
+
|
121
|
+
def sort_indexterms(terms, see, also)
|
122
|
+
index = extract_indexterms(terms)
|
123
|
+
index = extract_indexsee(index, see, :see)
|
124
|
+
index = extract_indexsee(index, also, :also)
|
125
|
+
index.keys.sort.each_with_object({}) do |k, v|
|
126
|
+
v[sortable(k)[0].upcase.transliterate] ||= {}
|
127
|
+
v[sortable(k)[0].upcase.transliterate][k] = index[k]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def extract_indexsee(val, terms, label)
|
132
|
+
terms.each_with_object(val) do |t, v|
|
133
|
+
term, term2, term3 = extract_indexterms_init(t)
|
134
|
+
term_hash_init(v, term, term2, term3, label)
|
135
|
+
v[term][term2][term3][label] << to_xml(t.at(ns("./target"))&.children)
|
136
|
+
t.remove
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def xml_encode_attr(str)
|
141
|
+
HTMLEntities.new.encode(str, :basic, :hexadecimal)
|
142
|
+
.gsub(/&#x([^;]+);/) do |_x|
|
143
|
+
"&#x#{$1.upcase};"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# attributes are decoded into UTF-8,
|
148
|
+
# elements in extract_indexsee are still in entities
|
149
|
+
def extract_indexterms(terms)
|
150
|
+
terms.each_with_object({}) do |t, v|
|
151
|
+
term, term2, term3 = extract_indexterms_init(t)
|
152
|
+
to = t["to"] ? "to='#{t['to']}' " : ""
|
153
|
+
index2bookmark(t)
|
154
|
+
term_hash_init(v, term, term2, term3, :xref)
|
155
|
+
v[term][term2][term3][:xref] << "<xref target='#{t['id']}' " \
|
156
|
+
"#{to}pagenumber='true'/>"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def extract_indexterms_init(term)
|
161
|
+
%w(primary secondary tertiary).each_with_object([]) do |x, m|
|
162
|
+
m << to_xml(term.at(ns("./#{x}"))&.children)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def term_hash_init(hash, term, term2, term3, label)
|
167
|
+
hash[term] ||= {}
|
168
|
+
hash[term][term2] ||= {}
|
169
|
+
hash[term][term2][term3] ||= {}
|
170
|
+
hash[term][term2][term3][label] ||= []
|
171
|
+
end
|
172
|
+
|
173
|
+
def index2bookmark(node)
|
174
|
+
node.name = "bookmark"
|
175
|
+
node.children.each(&:remove)
|
176
|
+
node["id"] = "_#{UUIDTools::UUID.random_create}"
|
177
|
+
node.delete("to")
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -100,24 +100,27 @@ module IsoDoc
|
|
100
100
|
implicit_reference(bibitem) ||
|
101
101
|
bibitem.at(ns(".//docidentifier[@type = 'metanorma']")) ||
|
102
102
|
bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']")) ||
|
103
|
+
bibitem["suppress_identifier"] == "true" ||
|
103
104
|
bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
|
104
105
|
end
|
105
106
|
|
106
107
|
def bibliography_bibitem_number(docxml)
|
107
108
|
i = 0
|
108
|
-
docxml.xpath(ns("//references
|
109
|
-
|
109
|
+
docxml.xpath(ns("//references")).each do |r|
|
110
|
+
r.xpath(ns("./bibitem")).each do |b|
|
111
|
+
i = bibliography_bibitem_number1(b, i, r["normative"] == "true")
|
112
|
+
end
|
110
113
|
end
|
111
114
|
reference_names docxml
|
112
115
|
bibliography_bibitem_tag(docxml)
|
113
116
|
end
|
114
117
|
|
115
|
-
def bibliography_bibitem_number1(bibitem, idx)
|
118
|
+
def bibliography_bibitem_number1(bibitem, idx, normative)
|
116
119
|
ins = bibliography_bibitem_number_insert_pt(bibitem)
|
117
120
|
mn = bibitem.at(ns(".//docidentifier[@type = 'metanorma']")) and
|
118
|
-
/^\[?\d+\]?$/.match?(mn.text) and
|
119
|
-
|
120
|
-
|
121
|
+
/^\[?\d+\]?$/.match?(mn.text) and mn.remove # ignore numbers already inserted
|
122
|
+
if !bibliography_bibitem_number_skip(bibitem) && (!normative || mn)
|
123
|
+
# respect numeric ids in normative only if already inserted
|
121
124
|
idx += 1
|
122
125
|
ins.next =
|
123
126
|
"<docidentifier type='metanorma-ordinal'>[#{idx}]</docidentifier>"
|
@@ -126,10 +129,10 @@ module IsoDoc
|
|
126
129
|
end
|
127
130
|
|
128
131
|
def bibliography_bibitem_number_insert_pt(bibitem)
|
132
|
+
bibitem.children.empty? and bibitem.add_child(" ")
|
129
133
|
unless d = bibitem.at(ns(".//docidentifier"))
|
130
134
|
d = bibitem.children.first
|
131
|
-
d.previous = " "
|
132
|
-
return d.previous
|
135
|
+
d.previous = " " and return d.previous
|
133
136
|
end
|
134
137
|
unless ins = d.previous_element
|
135
138
|
d.previous = " "
|
@@ -150,6 +153,7 @@ module IsoDoc
|
|
150
153
|
def bibliography_bibitem_tag1(ref, idx, norm)
|
151
154
|
ref.xpath(ns("./bibitem")).each do |b|
|
152
155
|
implicit_reference(b) and next
|
156
|
+
b["suppress_identifier"] == "true" and next
|
153
157
|
idx += 1 unless b["hidden"]
|
154
158
|
insert_biblio_tag(b, idx, !norm, standard?(b))
|
155
159
|
end
|
@@ -29,7 +29,7 @@ module IsoDoc
|
|
29
29
|
def clause1(elem)
|
30
30
|
level = @xrefs.anchor(elem["id"], :level, false) ||
|
31
31
|
(elem.ancestors("clause, annex").size + 1)
|
32
|
-
lbl = @xrefs.anchor(elem["id"], :label, elem
|
32
|
+
lbl = @xrefs.anchor(elem["id"], :label, !unnumbered_clause?(elem))
|
33
33
|
if unnumbered_clause?(elem) || !lbl
|
34
34
|
prefix_name(elem, {}, nil, "title")
|
35
35
|
else
|
@@ -49,7 +49,7 @@ module IsoDoc
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def annex1(elem)
|
52
|
-
lbl = @xrefs.anchor(elem["id"], :label)
|
52
|
+
lbl = @xrefs.anchor(elem["id"], :label, false)
|
53
53
|
# TODO: do not alter title, alter semx/@element = title
|
54
54
|
t = elem.at(ns("./title")) and
|
55
55
|
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
@@ -81,10 +81,6 @@ module IsoDoc
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
def index(docxml)
|
85
|
-
docxml.xpath(ns("//index | //index-xref | //indexsect")).each(&:remove)
|
86
|
-
end
|
87
|
-
|
88
84
|
def skip_display_order?(node)
|
89
85
|
node.name == "floating-title"
|
90
86
|
end
|
@@ -1,103 +1,25 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
-
def
|
4
|
-
docxml.xpath(ns("//term")).each
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def deprecates(elem)
|
12
|
-
elem.add_first_child @i18n.l10n("#{@i18n.deprecated}: ")
|
13
|
-
end
|
14
|
-
|
15
|
-
def admits(elem); end
|
16
|
-
|
17
|
-
def merge_second_preferred(term)
|
18
|
-
pref = nil
|
19
|
-
term.xpath(ns("./preferred[expression/name]")).each_with_index do |p, i|
|
20
|
-
(i.zero? and pref = p) or merge_second_preferred1(pref, p)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def merge_second_preferred1(pref, second)
|
25
|
-
merge_preferred_eligible?(pref, second) or return
|
26
|
-
n1 = pref.at(ns("./expression/name"))
|
27
|
-
n2 = second.remove.at(ns("./expression/name"))
|
28
|
-
n1.children = l10n("#{to_xml(n1.children)}; #{Common::to_xml(n2.children)}")
|
29
|
-
end
|
30
|
-
|
31
|
-
def merge_preferred_eligible?(first, second)
|
32
|
-
firstex = first.at(ns("./expression")) || {}
|
33
|
-
secondex = second.at(ns("./expression")) || {}
|
34
|
-
first["geographic-area"] == second["geographic-area"] &&
|
35
|
-
firstex["language"] == secondex["language"] &&
|
36
|
-
!first.at(ns("./pronunciation | ./grammar")) &&
|
37
|
-
!second.at(ns("./pronunciation | ./grammar"))
|
38
|
-
end
|
39
|
-
|
40
|
-
def designation1(desgn)
|
41
|
-
s = desgn.at(ns("./termsource"))
|
42
|
-
name = desgn.at(ns("./expression/name | ./letter-symbol/name | " \
|
43
|
-
"./graphical-symbol")) or return
|
44
|
-
designation_annotate(desgn, name)
|
45
|
-
s and desgn.next = s
|
46
|
-
end
|
47
|
-
|
48
|
-
def designation_annotate(desgn, name)
|
49
|
-
designation_boldface(desgn)
|
50
|
-
designation_field(desgn, name)
|
51
|
-
g = desgn.at(ns("./expression/grammar")) and
|
52
|
-
name << ", #{designation_grammar(g).join(', ')}"
|
53
|
-
designation_localization(desgn, name)
|
54
|
-
designation_pronunciation(desgn, name)
|
55
|
-
designation_bookmarks(desgn, name)
|
56
|
-
desgn.children = name.children
|
57
|
-
end
|
58
|
-
|
59
|
-
def designation_boldface(desgn)
|
60
|
-
desgn.name == "preferred" or return
|
61
|
-
name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return
|
62
|
-
name.children = "<strong>#{name.children}</strong>"
|
63
|
-
end
|
64
|
-
|
65
|
-
def designation_field(desgn, name)
|
66
|
-
f = desgn.xpath(ns("./field-of-application | ./usage-info"))
|
67
|
-
&.map { |u| to_xml(u.children) }&.join(", ")
|
68
|
-
f&.empty? and return nil
|
69
|
-
name << ", <#{f}>"
|
70
|
-
end
|
71
|
-
|
72
|
-
def designation_grammar(grammar)
|
73
|
-
ret = []
|
74
|
-
grammar.xpath(ns("./gender | ./number")).each do |x|
|
75
|
-
ret << @i18n.grammar_abbrevs[x.text]
|
3
|
+
def termcontainers(docxml)
|
4
|
+
docxml.xpath(ns("//term")).each do |t|
|
5
|
+
%w(preferred admitted deprecates related definition termsource)
|
6
|
+
.each do |w|
|
7
|
+
d = t.at(ns("./#{w}[last()]")) and d.after("<fmt-#{w}/>")
|
8
|
+
end
|
76
9
|
end
|
77
|
-
|
78
|
-
|
79
|
-
grammar.at(ns("./#{x}[text() = 'true']")) and
|
80
|
-
ret << @i18n.grammar_abbrevs[x]
|
10
|
+
docxml.xpath(ns("//termsource")).each do |s|
|
11
|
+
s["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
81
12
|
end
|
82
|
-
ret
|
83
13
|
end
|
84
14
|
|
85
|
-
def
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
def designation_pronunciation(desgn, name)
|
94
|
-
f = desgn.at(ns("./expression/pronunciation")) or return
|
95
|
-
name << ", /#{to_xml(f.children)}/"
|
96
|
-
end
|
97
|
-
|
98
|
-
def designation_bookmarks(desgn, name)
|
99
|
-
desgn.xpath(ns(".//bookmark")).each do |b|
|
100
|
-
name << b.remove
|
15
|
+
def termcleanup(docxml)
|
16
|
+
docxml.xpath(ns("//term")).each do |t|
|
17
|
+
%w(preferred admitted deprecates related definition termsource)
|
18
|
+
.each do |w|
|
19
|
+
t.xpath(ns("./#{w}//fmt-name | ./#{w}//fmt-xref-label")).each(&:remove)
|
20
|
+
f = t.at(ns(".//fmt-#{w}"))
|
21
|
+
f&.children&.empty? and f.remove
|
22
|
+
end
|
101
23
|
end
|
102
24
|
end
|
103
25
|
|
@@ -123,29 +45,32 @@ module IsoDoc
|
|
123
45
|
end
|
124
46
|
|
125
47
|
def termdefinition(docxml)
|
126
|
-
docxml.xpath(ns("//term[definition]")).each
|
127
|
-
termdefinition1(f)
|
128
|
-
end
|
48
|
+
docxml.xpath(ns("//term[definition]")).each { |f| termdefinition1(f) }
|
129
49
|
end
|
130
50
|
|
131
51
|
def termdefinition1(elem)
|
132
|
-
|
133
|
-
|
134
|
-
|
52
|
+
d = elem.xpath(ns("./definition"))
|
53
|
+
d1 = elem.at(ns("./fmt-definition"))
|
54
|
+
if d.size > 1 then multidef(elem, d, d1)
|
55
|
+
else singledef(elem, d, d1)
|
56
|
+
end
|
57
|
+
unwrap_definition(elem, d1)
|
58
|
+
termdomain(elem, d1)
|
135
59
|
end
|
136
60
|
|
137
|
-
def multidef(
|
138
|
-
|
139
|
-
|
140
|
-
elem.xpath(ns("./definition")).each do |f|
|
141
|
-
f = f.replace("<li>#{to_xml(f.children)}</li>").first
|
142
|
-
d << f
|
61
|
+
def multidef(_elem, defn, fmt_defn)
|
62
|
+
ret = defn.each_with_object([]) do |f, m|
|
63
|
+
m << "<li>#{to_xml(semx_fmt_dup(f))}</li>"
|
143
64
|
end
|
144
|
-
|
65
|
+
fmt_defn << "<ol>#{ret.join("\n")}</ol>"
|
145
66
|
end
|
146
67
|
|
147
|
-
def
|
148
|
-
|
68
|
+
def singledef(_elem, defn, fmt_defn)
|
69
|
+
fmt_defn << semx_fmt_dup(defn.first)
|
70
|
+
end
|
71
|
+
|
72
|
+
def unwrap_definition(_elem, fmt_defn)
|
73
|
+
fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d|
|
149
74
|
%w(verbal-definition non-verbal-representation).each do |e|
|
150
75
|
v = d&.at(ns("./#{e}"))
|
151
76
|
v&.replace(v.children)
|
@@ -153,26 +78,62 @@ module IsoDoc
|
|
153
78
|
end
|
154
79
|
end
|
155
80
|
|
156
|
-
def termdomain(elem)
|
81
|
+
def termdomain(elem, fmt_defn)
|
157
82
|
d = elem.at(ns(".//domain")) or return
|
158
|
-
p =
|
159
|
-
|
160
|
-
|
83
|
+
p = fmt_defn.at(ns(".//p")) or return
|
84
|
+
d1 = semx_fmt_dup(d)
|
85
|
+
p.add_first_child "<#{to_xml(d1)}> "
|
161
86
|
end
|
162
87
|
|
163
88
|
def termsource(docxml)
|
164
|
-
docxml
|
165
|
-
|
89
|
+
copy_baselevel_termsource(docxml)
|
90
|
+
# TODO should I wrap fmt-definition//termsource in fmt-termsource, in order to preserve termsource attributes?
|
91
|
+
docxml.xpath(ns("//fmt-termsource/termsource | //fmt-definition//termsource | //fmt-preferred//termsource | //fmt-admitted//termsource | //fmt-deprecates//termsource"))
|
92
|
+
.each do |f|
|
93
|
+
termsource_modification(f)
|
94
|
+
end
|
95
|
+
docxml.xpath(ns("//fmt-preferred//fmt-termsource | //fmt-admitted//fmt-termsource | //fmt-deprecates//fmt-termsource"))
|
96
|
+
.each do |f|
|
97
|
+
termsource_designation(f)
|
98
|
+
end
|
99
|
+
docxml.xpath(ns("//fmt-termsource/termsource | //fmt-definition//termsource | //fmt-preferred//termsource | //fmt-admitted//termsource | //fmt-deprecates//termsource"))
|
100
|
+
.each do |f|
|
101
|
+
f.parent and termsource1(f)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def termsource_designation(fmtsource)
|
106
|
+
p = fmtsource.previous_element
|
107
|
+
p&.name == "p" or return
|
108
|
+
p << " "
|
109
|
+
p << fmtsource.children
|
110
|
+
end
|
111
|
+
|
112
|
+
def copy_baselevel_termsource(docxml)
|
113
|
+
docxml.xpath(ns("//term[termsource]")).each do |x|
|
114
|
+
s = x.xpath(ns("./termsource"))
|
115
|
+
s1 = x.at(ns("./fmt-termsource"))
|
116
|
+
s.each { |ss| s1 << ss.clone }
|
117
|
+
strip_duplicate_ids(nil, s, s1)
|
118
|
+
%w(status type).each { |a| s[0][a] and s1[a] = s[0][a] }
|
119
|
+
end
|
166
120
|
end
|
167
121
|
|
168
122
|
def termsource1(elem)
|
123
|
+
ret = [semx_fmt_dup(elem)]
|
169
124
|
while elem&.next_element&.name == "termsource"
|
170
|
-
|
125
|
+
ret << semx_fmt_dup(elem.next_element.remove)
|
171
126
|
end
|
172
|
-
|
127
|
+
s = ret.map { |x| to_xml(x) }.map(&:strip).join("; ")
|
128
|
+
termsource_label(elem, s)
|
129
|
+
end
|
130
|
+
|
131
|
+
def termsource_label(elem, sources)
|
132
|
+
elem.replace(l10n("[#{@i18n.source}: #{sources}]"))
|
173
133
|
end
|
174
134
|
|
175
135
|
def termsource_modification(elem)
|
136
|
+
elem.xpath(".//text()[normalize-space() = '']").each(&:remove)
|
176
137
|
origin = elem.at(ns("./origin"))
|
177
138
|
s = termsource_status(elem["status"]) and origin.next = l10n(", #{s}")
|
178
139
|
termsource_add_modification_text(elem.at(ns("./modification")))
|
@@ -180,10 +141,13 @@ module IsoDoc
|
|
180
141
|
|
181
142
|
def termsource_add_modification_text(mod)
|
182
143
|
mod or return
|
183
|
-
mod.text.strip.empty?
|
184
|
-
|
185
|
-
|
186
|
-
|
144
|
+
if mod.text.strip.empty?
|
145
|
+
mod.remove
|
146
|
+
return
|
147
|
+
end
|
148
|
+
mod.previous = " — "
|
149
|
+
mod.elements.size == 1 and mod.children = to_xml(mod.elements[0].children)
|
150
|
+
mod.replace(semx_fmt_dup(mod))
|
187
151
|
end
|
188
152
|
|
189
153
|
def termsource_status(status)
|
@@ -21,7 +21,7 @@ module IsoDoc
|
|
21
21
|
node["style"] == "id" and
|
22
22
|
return anchor_id_postproc(node)
|
23
23
|
node["citeas"].nil? && node["bibitemid"] and
|
24
|
-
return @xrefs.anchor(node["bibitemid"], :xref) || "???"
|
24
|
+
return citeas_cleanup(@xrefs.anchor(node["bibitemid"], :xref)) || "???"
|
25
25
|
node.at(ns("./location")) and
|
26
26
|
return combine_xref_locations(node) || "???"
|
27
27
|
node["target"] && node["droploc"] and
|
@@ -7,6 +7,7 @@ require_relative "presentation_function/erefs"
|
|
7
7
|
require_relative "presentation_function/inline"
|
8
8
|
require_relative "presentation_function/math"
|
9
9
|
require_relative "presentation_function/section"
|
10
|
+
require_relative "presentation_function/index"
|
10
11
|
require_relative "presentation_function/bibdata"
|
11
12
|
require_relative "presentation_function/metadata"
|
12
13
|
|
@@ -107,6 +108,7 @@ module IsoDoc
|
|
107
108
|
end
|
108
109
|
|
109
110
|
def terms(docxml)
|
111
|
+
termcontainers docxml
|
110
112
|
termexample docxml
|
111
113
|
termnote docxml
|
112
114
|
termdefinition docxml
|
@@ -114,6 +116,7 @@ module IsoDoc
|
|
114
116
|
termsource docxml
|
115
117
|
concept docxml
|
116
118
|
related docxml
|
119
|
+
termcleanup docxml
|
117
120
|
end
|
118
121
|
|
119
122
|
def semantic_xml_insert(xml)
|
data/lib/isodoc/version.rb
CHANGED
@@ -15,6 +15,9 @@ termsdefsymbols: المصطلحات والتعريفات والرموز
|
|
15
15
|
termsdefabbrev: المصطلحات والتعريفات والاختصارات
|
16
16
|
normref: المراجع المعيارية
|
17
17
|
bibliography: بيبليوغرافيا
|
18
|
+
index: الفهرس
|
19
|
+
see: انظر
|
20
|
+
see_also: انظر أيضًا
|
18
21
|
clause: فقرة
|
19
22
|
annex: ملحق
|
20
23
|
appendix: تذييل
|
@@ -15,6 +15,9 @@ termsdefsymbols: Begriffe, Definitionen und Symbole
|
|
15
15
|
termsdefabbrev: Begriffe, Definitionen und abgekürzte Begriffe
|
16
16
|
normref: Normative Verweise
|
17
17
|
bibliography: Bibliographie
|
18
|
+
index: Index
|
19
|
+
see: schau
|
20
|
+
see_also: siehe auch
|
18
21
|
clause: Klausel
|
19
22
|
annex: Anhang
|
20
23
|
appendix: Appendix
|
@@ -14,6 +14,9 @@ termsdefsymbols: Terms, definitions and symbols
|
|
14
14
|
termsdefabbrev: Terms, definitions and abbreviated terms
|
15
15
|
normref: Normative references
|
16
16
|
bibliography: Bibliography
|
17
|
+
index: Index
|
18
|
+
see: see
|
19
|
+
see_also: see also
|
17
20
|
preface: Preface
|
18
21
|
section: Section
|
19
22
|
clause: Clause
|
@@ -14,6 +14,9 @@ termsdefsymbols: Términos, definiciones y símbolos
|
|
14
14
|
termsdefabbrev: Términos, definiciones y términos abreviados
|
15
15
|
normref: Referencias normativas
|
16
16
|
bibliography: Bibliografía
|
17
|
+
index: Índice
|
18
|
+
see: ver
|
19
|
+
see_also: ver también
|
17
20
|
section: Sección
|
18
21
|
clause: Cláusula
|
19
22
|
annex: Anexo
|
@@ -14,6 +14,9 @@ termsdefsymbols: Termes, définitions et symboles
|
|
14
14
|
termsdefabbrev: Termes, définitions et termes abrégés
|
15
15
|
normref: Références normatives
|
16
16
|
bibliography: Bibliographie
|
17
|
+
index: Index
|
18
|
+
see: voir
|
19
|
+
see_also: voir aussi
|
17
20
|
preface: Préface
|
18
21
|
section: Section
|
19
22
|
clause: Article
|
@@ -14,6 +14,9 @@ termsdefsymbols: Термины, определения и символы
|
|
14
14
|
termsdefabbrev: Термины, определения и сокращенные термины
|
15
15
|
normref: Нормативные ссылки
|
16
16
|
bibliography: Библиография
|
17
|
+
index: Алфавитный указатель
|
18
|
+
see: см.
|
19
|
+
see_also: см. также
|
17
20
|
section: Раздел
|
18
21
|
clause: Пункт
|
19
22
|
annex: Дополнение
|
@@ -1,4 +1,4 @@
|
|
1
1
|
template:
|
2
2
|
# skip authoritative identifier, it is inserted in front of formattedref within metanorma
|
3
|
-
standard: "{% if creatornames %}{{ creatornames }} ({{ role}}){%else%}{{publisher}}{%endif%} . <em>{{ title }}</em> . {{
|
3
|
+
standard: "{% if creatornames %}{{ creatornames }} ({{ role}}){%else%}{{publisher}}{%endif%} . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{date}}. {{place}}: {%if creatornames %}{{publisher}}{% endif %} . {{size}}. {{ extent }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
4
4
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.13'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2.
|
68
|
+
version: '2.13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mn-requirements
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.9.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.9.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: roman-numerals
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -439,6 +439,7 @@ files:
|
|
439
439
|
- lib/isodoc/presentation_function/docid.rb
|
440
440
|
- lib/isodoc/presentation_function/erefs.rb
|
441
441
|
- lib/isodoc/presentation_function/image.rb
|
442
|
+
- lib/isodoc/presentation_function/index.rb
|
442
443
|
- lib/isodoc/presentation_function/inline.rb
|
443
444
|
- lib/isodoc/presentation_function/math.rb
|
444
445
|
- lib/isodoc/presentation_function/metadata.rb
|
@@ -485,7 +486,7 @@ homepage: https://github.com/metanorma/isodoc
|
|
485
486
|
licenses:
|
486
487
|
- BSD-2-Clause
|
487
488
|
metadata: {}
|
488
|
-
post_install_message:
|
489
|
+
post_install_message:
|
489
490
|
rdoc_options: []
|
490
491
|
require_paths:
|
491
492
|
- lib
|
@@ -501,7 +502,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
501
502
|
version: '0'
|
502
503
|
requirements: []
|
503
504
|
rubygems_version: 3.3.27
|
504
|
-
signing_key:
|
505
|
+
signing_key:
|
505
506
|
specification_version: 4
|
506
507
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|
507
508
|
test_files: []
|