metanorma-un 0.4.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/asciidoctor/un/converter.rb +47 -59
- data/lib/asciidoctor/un/isodoc.rng +16 -7
- data/lib/asciidoctor/un/validate.rb +2 -1
- data/lib/isodoc/un/base_convert.rb +3 -58
- data/lib/isodoc/un/html/htmlstyle.css +1096 -0
- data/lib/isodoc/un/html/unece.css +818 -0
- data/lib/isodoc/un/html/wordstyle.css +1237 -0
- data/lib/isodoc/un/html/wordstyle.scss +0 -1
- data/lib/isodoc/un/html_convert.rb +10 -21
- data/lib/isodoc/un/i18n-en.yaml +2 -0
- data/lib/isodoc/un/i18n.rb +11 -0
- data/lib/isodoc/un/init.rb +29 -0
- data/lib/isodoc/un/metadata.rb +23 -12
- data/lib/isodoc/un/presentation_xml_convert.rb +44 -1
- data/lib/isodoc/un/un.plenary-attachment.xsl +1559 -1923
- data/lib/isodoc/un/un.plenary.xsl +1559 -1923
- data/lib/isodoc/un/un.recommendation.xsl +1643 -11478
- data/lib/isodoc/un/word_convert.rb +18 -23
- data/lib/isodoc/un/xref.rb +7 -8
- data/lib/metanorma/un/version.rb +1 -1
- data/metanorma-unece.gemspec +3 -4
- metadata +26 -34
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "base_convert"
|
2
|
+
require_relative "init"
|
2
3
|
require "isodoc"
|
3
4
|
|
4
5
|
module IsoDoc
|
@@ -15,8 +16,10 @@ module IsoDoc
|
|
15
16
|
|
16
17
|
def default_fonts(options)
|
17
18
|
{
|
18
|
-
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
19
|
-
|
19
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
20
|
+
'"Times New Roman",serif'),
|
21
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
22
|
+
'"Times New Roman",serif'),
|
20
23
|
monospacefont: '"Courier New",monospace'
|
21
24
|
}
|
22
25
|
end
|
@@ -47,7 +50,8 @@ module IsoDoc
|
|
47
50
|
|
48
51
|
def make_body(xml, docxml)
|
49
52
|
plenary = is_plenary?(docxml)
|
50
|
-
if plenary &&
|
53
|
+
if plenary &&
|
54
|
+
@wordcoverpage == html_doc_path("word_unece_titlepage.html")
|
51
55
|
@wordcoverpage = html_doc_path("word_unece_plenary_titlepage.html")
|
52
56
|
end
|
53
57
|
@wordintropage = nil if plenary && !@toc
|
@@ -63,6 +67,7 @@ module IsoDoc
|
|
63
67
|
body.div **{ class: "WordSection2" } do |div2|
|
64
68
|
info docxml, div2
|
65
69
|
boilerplate docxml, div2
|
70
|
+
preface_block docxml, div2
|
66
71
|
abstract docxml, div2
|
67
72
|
foreword docxml, div2
|
68
73
|
introduction docxml, div2
|
@@ -94,27 +99,12 @@ module IsoDoc
|
|
94
99
|
end_line(isoxml, out)
|
95
100
|
end
|
96
101
|
|
97
|
-
def clause_parse_title(node, div, c1, out)
|
98
|
-
if node["inline-header"] == "true"
|
99
|
-
inline_header_title(out, node, c1)
|
100
|
-
else
|
101
|
-
div.send "h#{@xrefs.anchor(node['id'], :level, false) || '1'}" do |h|
|
102
|
-
lbl = @xrefs.anchor(node['id'], :label, false)
|
103
|
-
if lbl && !@suppressheadingnumbers
|
104
|
-
h << "#{lbl}. "
|
105
|
-
insert_tab(h, 1)
|
106
|
-
end
|
107
|
-
c1&.children&.each { |c2| parse(c2, h) }
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
102
|
def introduction(isoxml, out)
|
113
103
|
f = isoxml.at(ns("//introduction")) || return
|
114
104
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
115
105
|
page_break(out)
|
116
106
|
div.p(**{ class: "IntroTitle" }) do |h1|
|
117
|
-
h1
|
107
|
+
f&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
|
118
108
|
end
|
119
109
|
f.elements.each do |e|
|
120
110
|
parse(e, div) unless e.name == "title"
|
@@ -127,7 +117,7 @@ module IsoDoc
|
|
127
117
|
out.div **attr_code(id: f["id"]) do |s|
|
128
118
|
page_break(out)
|
129
119
|
s.p(**{ class: "ForewordTitle" }) do |h1|
|
130
|
-
h1
|
120
|
+
f&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
|
131
121
|
end
|
132
122
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
133
123
|
end
|
@@ -135,7 +125,8 @@ module IsoDoc
|
|
135
125
|
|
136
126
|
def word_preface(docxml)
|
137
127
|
super
|
138
|
-
preface_container =
|
128
|
+
preface_container =
|
129
|
+
docxml.at("//div[@id = 'preface_container']") # recommendation
|
139
130
|
abstractbox = docxml.at("//div[@id = 'abstractbox']") # plenary
|
140
131
|
foreword = docxml.at("//p[@class = 'ForewordTitle']/..")
|
141
132
|
intro = docxml.at("//p[@class = 'IntroTitle']/..")
|
@@ -163,18 +154,22 @@ module IsoDoc
|
|
163
154
|
f = isoxml.at(ns("//abstract")) || return
|
164
155
|
out.div **attr_code(id: f["id"]) do |s|
|
165
156
|
page_break(out)
|
166
|
-
s.p(**{ class: "AbstractTitle" })
|
157
|
+
s.p(**{ class: "AbstractTitle" }) do |h1|
|
158
|
+
f&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
|
159
|
+
end
|
167
160
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
168
161
|
end
|
169
162
|
end
|
170
163
|
|
171
164
|
def authority_cleanup(docxml)
|
172
165
|
super
|
173
|
-
a = docxml.at("//div[@id = 'boilerplate-ECEhdr']") and
|
166
|
+
a = docxml.at("//div[@id = 'boilerplate-ECEhdr']") and
|
167
|
+
a["class"] = "boilerplate-ECEhdr"
|
174
168
|
docxml&.at("//div[@class = 'authority']")&.remove
|
175
169
|
end
|
176
170
|
|
177
171
|
include BaseConvert
|
172
|
+
include Init
|
178
173
|
end
|
179
174
|
end
|
180
175
|
end
|
data/lib/isodoc/un/xref.rb
CHANGED
@@ -76,9 +76,8 @@ module IsoDoc
|
|
76
76
|
xref: l10n("#{@labels['clause']} #{lbl}") }
|
77
77
|
i = 1
|
78
78
|
clause.xpath(ns(NONTERMINAL)).each do |c|
|
79
|
-
next if c["unnumbered"] == "true"
|
80
79
|
section_names1(c, "#{lbl}.#{levelnumber(i, lvl + 1)}", lvl + 1)
|
81
|
-
i += 1 if !leaf_section?(c)
|
80
|
+
i += 1 if !leaf_section?(c) && c["unnumbered"] != "true"
|
82
81
|
end
|
83
82
|
num
|
84
83
|
end
|
@@ -86,18 +85,18 @@ module IsoDoc
|
|
86
85
|
def section_names1(clause, num, level)
|
87
86
|
leaf_section?(clause) and label_leaf_section(clause, level) and return
|
88
87
|
/\.(?<leafnum>[^.]+$)/ =~ num
|
89
|
-
|
90
|
-
|
88
|
+
clause["unnumbered"] == "true" or
|
89
|
+
@anchors[clause["id"]] = { label: leafnum, level: level, type: "clause",
|
90
|
+
xref: l10n("#{@labels['clause']} #{num}") }
|
91
91
|
i = 1
|
92
92
|
clause.xpath(ns(NONTERMINAL)).each do |c|
|
93
|
-
next if c["unnumbered"] == "true"
|
94
93
|
section_names1(c, "#{num}.#{levelnumber(i, level + 1)}", level + 1)
|
95
|
-
i += 1 if !leaf_section?(c)
|
94
|
+
i += 1 if !leaf_section?(c) && c["unnumbered"] != "true"
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
98
|
def annex_name_lbl(clause, num)
|
100
|
-
l10n("<
|
99
|
+
l10n("<strong>#{@labels['annex']} #{num}</strong>")
|
101
100
|
end
|
102
101
|
|
103
102
|
SUBCLAUSES =
|
@@ -128,7 +127,7 @@ module IsoDoc
|
|
128
127
|
label_annex_leaf_section(clause, num, level) and return
|
129
128
|
/\.(?<leafnum>[^.]+$)/ =~ num
|
130
129
|
@anchors[clause["id"]] = { label: leafnum, xref: "#{@labels['annex']} #{num}",
|
131
|
-
|
130
|
+
level: level, type: "clause" }
|
132
131
|
i = 1
|
133
132
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
134
133
|
next if c["unnumbered"] == "true"
|
data/lib/metanorma/un/version.rb
CHANGED
data/metanorma-unece.gemspec
CHANGED
@@ -26,16 +26,15 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
28
28
|
|
29
|
-
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
|
-
spec.add_dependency "ruby-jing"
|
31
29
|
spec.add_dependency "roman-numerals"
|
32
30
|
spec.add_dependency "twitter_cldr"
|
33
31
|
spec.add_dependency "iso-639"
|
34
32
|
|
35
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
36
|
-
spec.add_dependency "isodoc", "~> 1.
|
33
|
+
spec.add_dependency "metanorma-standoc", "~> 1.5.0"
|
34
|
+
spec.add_dependency "isodoc", "~> 1.2.0"
|
37
35
|
|
38
36
|
spec.add_development_dependency "byebug", "~> 9.1"
|
37
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
39
38
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
40
39
|
spec.add_development_dependency "guard", "~> 2.14"
|
41
40
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-un
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: htmlentities
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 4.3.4
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 4.3.4
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: ruby-jing
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: roman-numerals
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +58,28 @@ dependencies:
|
|
86
58
|
requirements:
|
87
59
|
- - "~>"
|
88
60
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
61
|
+
version: 1.5.0
|
90
62
|
type: :runtime
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
66
|
- - "~>"
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
68
|
+
version: 1.5.0
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: isodoc
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
73
|
- - "~>"
|
102
74
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
75
|
+
version: 1.2.0
|
104
76
|
type: :runtime
|
105
77
|
prerelease: false
|
106
78
|
version_requirements: !ruby/object:Gem::Requirement
|
107
79
|
requirements:
|
108
80
|
- - "~>"
|
109
81
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
82
|
+
version: 1.2.0
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: byebug
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +94,20 @@ dependencies:
|
|
122
94
|
- - "~>"
|
123
95
|
- !ruby/object:Gem::Version
|
124
96
|
version: '9.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sassc
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.4.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.4.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: equivalent-xml
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -273,15 +259,21 @@ files:
|
|
273
259
|
- lib/isodoc/un/html/html_unece_intro.html
|
274
260
|
- lib/isodoc/un/html/html_unece_plenary_titlepage.html
|
275
261
|
- lib/isodoc/un/html/html_unece_titlepage.html
|
262
|
+
- lib/isodoc/un/html/htmlstyle.css
|
276
263
|
- lib/isodoc/un/html/htmlstyle.scss
|
277
264
|
- lib/isodoc/un/html/logo.jpg
|
278
265
|
- lib/isodoc/un/html/scripts.html
|
266
|
+
- lib/isodoc/un/html/unece.css
|
279
267
|
- lib/isodoc/un/html/unece.scss
|
280
268
|
- lib/isodoc/un/html/word_unece_intro.html
|
281
269
|
- lib/isodoc/un/html/word_unece_plenary_titlepage.html
|
282
270
|
- lib/isodoc/un/html/word_unece_titlepage.html
|
271
|
+
- lib/isodoc/un/html/wordstyle.css
|
283
272
|
- lib/isodoc/un/html/wordstyle.scss
|
284
273
|
- lib/isodoc/un/html_convert.rb
|
274
|
+
- lib/isodoc/un/i18n-en.yaml
|
275
|
+
- lib/isodoc/un/i18n.rb
|
276
|
+
- lib/isodoc/un/init.rb
|
285
277
|
- lib/isodoc/un/metadata.rb
|
286
278
|
- lib/isodoc/un/pdf_convert.rb
|
287
279
|
- lib/isodoc/un/presentation_xml_convert.rb
|