metanorma-unece 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/unece/converter.rb +7 -23
- data/lib/isodoc/unece/html/html_unece_titlepage.html +2 -3
- data/lib/isodoc/unece/html_convert.rb +3 -37
- data/lib/isodoc/unece/metadata.rb +2 -9
- data/lib/isodoc/unece/word_convert.rb +4 -29
- data/lib/metanorma/unece/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1884c00a1f3cdb5626d42140dbaf0cc1eba0b94a0b55326fcb61299d748670a5
|
4
|
+
data.tar.gz: 206c2ff4bd76b1737832bd33d5faefeca07fbaa9e3aeb2ee0da9cdda344c0aef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b4bced04b985dbe955927b45a46e0d552a7f4197b8346868e44f058ea04773c3bed8ab504f313ed54a5906253a07ec16cbd13e873dfbf47b0ce70281fc2918c
|
7
|
+
data.tar.gz: cb3a319050a40edc80909a93eff0d3a7f59aac5e1d94e7f5e0e24381ef13e717486e3d3d45a77befdf987c9434ccbcfadcc47d522fe33681aefb654e5a88a961
|
@@ -59,7 +59,13 @@ module Asciidoctor
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def metadata_id(node, xml)
|
62
|
-
|
62
|
+
dn = node.attr("docnumber")
|
63
|
+
if docstatus = node.attr("status")
|
64
|
+
abbr = IsoDoc::Unece::Metadata.new("en", "Latn", {}).status_abbr(docstatus)
|
65
|
+
dn = "#{dn}(#{abbr})" unless abbr.empty?
|
66
|
+
end
|
67
|
+
xml.docidentifier { |i| i << dn }
|
68
|
+
xml.docnumber { |i| i << node.attr("docnumber") }
|
63
69
|
end
|
64
70
|
|
65
71
|
def metadata_copyright(node, xml)
|
@@ -146,13 +152,6 @@ module Asciidoctor
|
|
146
152
|
end
|
147
153
|
end
|
148
154
|
|
149
|
-
def sections_cleanup(x)
|
150
|
-
super
|
151
|
-
x.xpath("//*[@inline-header]").each do |h|
|
152
|
-
h.delete("inline-header")
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
155
|
def style(n, t)
|
157
156
|
return
|
158
157
|
end
|
@@ -228,21 +227,6 @@ module Asciidoctor
|
|
228
227
|
abstract_parse(attrs, xml, node) && return if node.attr("style") == "abstract"
|
229
228
|
super
|
230
229
|
end
|
231
|
-
|
232
|
-
def abstract_parse(attrs, xml, node)
|
233
|
-
xml.abstract **attr_code(attrs) do |xml_section|
|
234
|
-
xml_section << node.content
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
def make_preface(x, s)
|
239
|
-
super
|
240
|
-
if x.at("//abstract")
|
241
|
-
preface = s.at("//preface") || s.add_previous_sibling("<preface/>").first
|
242
|
-
abstract = x.at("//abstract").remove
|
243
|
-
preface.prepend_child abstract.remove
|
244
|
-
end
|
245
|
-
end
|
246
230
|
end
|
247
231
|
end
|
248
232
|
end
|
@@ -18,9 +18,8 @@
|
|
18
18
|
|
19
19
|
<div class="coverpage-doc-identity">
|
20
20
|
<div class="doc-number">
|
21
|
-
<span class="docnumber">{{
|
22
|
-
<span class="
|
23
|
-
<span class="docyear">{{ docyear }} {{ draftinfo }}</span>
|
21
|
+
<span class="docnumber">{{ formatted_docnumber }}</span>
|
22
|
+
<span class="docyear">{{ draftinfo }}</span>
|
24
23
|
</div>
|
25
24
|
|
26
25
|
<div class="coverpage-title">
|
@@ -125,7 +125,7 @@ module IsoDoc
|
|
125
125
|
div.send "h#{get_anchors[node['id']][:level]}" do |h|
|
126
126
|
lbl = get_anchors[node['id']][:label]
|
127
127
|
h << "#{lbl}. " if lbl && !@suppressheadingnumbers
|
128
|
-
insert_tab(h, 1)
|
128
|
+
insert_tab(h, 1) if lbl && !@suppressheadingnumbers
|
129
129
|
c1&.children&.each { |c2| parse(c2, h) }
|
130
130
|
end
|
131
131
|
end
|
@@ -165,41 +165,16 @@ module IsoDoc
|
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
|
-
def pre_parse(node, out)
|
169
|
-
out.pre node.text # content.gsub(/</, "<").gsub(/>/, ">")
|
170
|
-
end
|
171
|
-
|
172
|
-
def term_defs_boilerplate(div, source, term, preface)
|
173
|
-
if source.empty? && term.nil?
|
174
|
-
div << @no_terms_boilerplate
|
175
|
-
else
|
176
|
-
div << term_defs_boilerplate_cont(source, term)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
168
|
def i18n_init(lang, script)
|
181
169
|
super
|
182
170
|
@admonition_lbl = "Box"
|
171
|
+
@abstract_lbl = "Summary"
|
183
172
|
end
|
184
173
|
|
185
174
|
def fileloc(loc)
|
186
175
|
File.join(File.dirname(__FILE__), loc)
|
187
176
|
end
|
188
177
|
|
189
|
-
def cleanup(docxml)
|
190
|
-
super
|
191
|
-
term_cleanup(docxml)
|
192
|
-
end
|
193
|
-
|
194
|
-
def term_cleanup(docxml)
|
195
|
-
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
196
|
-
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
197
|
-
h2.add_child(" ")
|
198
|
-
h2.add_child(d.remove)
|
199
|
-
end
|
200
|
-
docxml
|
201
|
-
end
|
202
|
-
|
203
178
|
MIDDLE_CLAUSE = "//clause[parent::sections]".freeze
|
204
179
|
|
205
180
|
def initial_anchor_names(d)
|
@@ -281,6 +256,7 @@ module IsoDoc
|
|
281
256
|
end
|
282
257
|
|
283
258
|
def annex_names(clause, num)
|
259
|
+
hierarchical_asset_names(clause, num)
|
284
260
|
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
285
261
|
annex_leaf_section(clause, num, 1) and return
|
286
262
|
end
|
@@ -291,7 +267,6 @@ module IsoDoc
|
|
291
267
|
annex_names1(c, "#{num}.#{annex_levelnumber(i, 2)}", 2)
|
292
268
|
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
293
269
|
end
|
294
|
-
hierarchical_asset_names(clause, num)
|
295
270
|
end
|
296
271
|
|
297
272
|
def annex_names1(clause, num, level)
|
@@ -376,15 +351,6 @@ module IsoDoc
|
|
376
351
|
s << "#{title} "
|
377
352
|
end
|
378
353
|
end
|
379
|
-
|
380
|
-
def abstract(isoxml, out)
|
381
|
-
f = isoxml.at(ns("//abstract")) || return
|
382
|
-
page_break(out)
|
383
|
-
out.div **attr_code(id: f["id"]) do |s|
|
384
|
-
s.h1(**{ class: "AbstractTitle" }) { |h1| h1 << "Summary" }
|
385
|
-
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
386
|
-
end
|
387
|
-
end
|
388
354
|
end
|
389
355
|
end
|
390
356
|
end
|
@@ -34,17 +34,10 @@ module IsoDoc
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def docid(isoxml, _out)
|
37
|
-
|
38
|
-
docstatus = isoxml.at(ns("//bibdata/status"))
|
39
|
-
dn = docnumber&.text
|
40
|
-
if docstatus
|
41
|
-
set(:status, status_print(docstatus.text))
|
42
|
-
abbr = status_abbr(docstatus.text)
|
43
|
-
dn = "#{dn}(#{abbr})" unless abbr.empty?
|
44
|
-
end
|
37
|
+
dn = isoxml.at(ns("//bibdata/docidentifier"))&.text
|
45
38
|
set(:docnumber, dn)
|
46
39
|
type = isoxml&.at(ns("//bibdata/@type"))&.value
|
47
|
-
set(:formatted_docnumber, type == "recommendation" ? "Recommendation
|
40
|
+
set(:formatted_docnumber, type == "recommendation" ? "UN/CEFACT Recommendation #{dn}" : dn)
|
48
41
|
end
|
49
42
|
|
50
43
|
def status_print(status)
|
@@ -131,7 +131,7 @@ module IsoDoc
|
|
131
131
|
intro = docxml.at("//p[@class = 'IntroTitle']/..")
|
132
132
|
abstract = docxml.at("//p[@class = 'AbstractTitle']/..")
|
133
133
|
abstract.parent = (abstractbox || preface_container) if abstract
|
134
|
-
abstractbox and abstract
|
134
|
+
abstractbox and abstract&.xpath("./br")&.each do |a|
|
135
135
|
a.remove if /page-break-before:always/.match(a["style"])
|
136
136
|
end
|
137
137
|
docxml&.at("//p[@class = 'AbstractTitle']")&.remove if abstractbox
|
@@ -159,41 +159,16 @@ module IsoDoc
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
def pre_parse(node, out)
|
163
|
-
out.pre node.text # content.gsub(/</, "<").gsub(/>/, ">")
|
164
|
-
end
|
165
|
-
|
166
|
-
def term_defs_boilerplate(div, source, term, preface)
|
167
|
-
if source.empty? && term.nil?
|
168
|
-
div << @no_terms_boilerplate
|
169
|
-
else
|
170
|
-
div << term_defs_boilerplate_cont(source, term)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
162
|
def i18n_init(lang, script)
|
175
163
|
super
|
176
164
|
@admonition_lbl = "Box"
|
165
|
+
@abstract_lbl = "Summary"
|
177
166
|
end
|
178
167
|
|
179
168
|
def fileloc(loc)
|
180
169
|
File.join(File.dirname(__FILE__), loc)
|
181
170
|
end
|
182
171
|
|
183
|
-
def cleanup(docxml)
|
184
|
-
super
|
185
|
-
term_cleanup(docxml)
|
186
|
-
end
|
187
|
-
|
188
|
-
def term_cleanup(docxml)
|
189
|
-
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
190
|
-
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
191
|
-
h2.add_child(" ")
|
192
|
-
h2.add_child(d.remove)
|
193
|
-
end
|
194
|
-
docxml
|
195
|
-
end
|
196
|
-
|
197
172
|
MIDDLE_CLAUSE = "//clause[parent::sections]".freeze
|
198
173
|
|
199
174
|
def initial_anchor_names(d)
|
@@ -275,6 +250,7 @@ module IsoDoc
|
|
275
250
|
end
|
276
251
|
|
277
252
|
def annex_names(clause, num)
|
253
|
+
hierarchical_asset_names(clause, num)
|
278
254
|
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
279
255
|
annex_leaf_section(clause, num, 1) and return
|
280
256
|
end
|
@@ -285,7 +261,6 @@ module IsoDoc
|
|
285
261
|
annex_names1(c, "#{num}.#{annex_levelnumber(i, 2)}", 2)
|
286
262
|
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
287
263
|
end
|
288
|
-
hierarchical_asset_names(clause, num)
|
289
264
|
end
|
290
265
|
|
291
266
|
def annex_names1(clause, num, level)
|
@@ -375,7 +350,7 @@ module IsoDoc
|
|
375
350
|
f = isoxml.at(ns("//abstract")) || return
|
376
351
|
out.div **attr_code(id: f["id"]) do |s|
|
377
352
|
page_break(out)
|
378
|
-
s.p(**{ class: "AbstractTitle" }) { |h1| h1 <<
|
353
|
+
s.p(**{ class: "AbstractTitle" }) { |h1| h1 << @abstract_lbl }
|
379
354
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
380
355
|
end
|
381
356
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-unece
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|