metanorma-gb 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.1.5"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = "exe"
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
31
 
31
- spec.add_dependency "metanorma-iso", "~> 1.1.0"
32
- spec.add_dependency "isodoc", "~> 0.9.1"
32
+ spec.add_dependency "metanorma-iso", "~> 1.2.0"
33
+ spec.add_dependency "isodoc", "~> 0.10.0"
33
34
  spec.add_dependency "twitter_cldr", "~> 4.4.4"
34
35
  spec.add_dependency "gb-agencies", "~> 0.0.4"
35
36
  spec.add_dependency "htmlentities", "~> 4.3.4"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.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: 2019-04-04 00:00:00.000000000 Z
11
+ date: 2019-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 1.2.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: 1.1.0
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: isodoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.1
33
+ version: 0.10.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.1
40
+ version: 0.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: twitter_cldr
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -272,12 +272,11 @@ files:
272
272
  - lib/asciidoctor/gb/reqt.rng
273
273
  - lib/asciidoctor/gb/section_input.rb
274
274
  - lib/asciidoctor/gb/validate.rb
275
+ - lib/isodoc/gb/gbbaseconvert.rb
275
276
  - lib/isodoc/gb/gbcleanup.rb
276
277
  - lib/isodoc/gb/gbconvert.rb
277
278
  - lib/isodoc/gb/gbhtmlconvert.rb
278
- - lib/isodoc/gb/gbhtmlrender.rb
279
279
  - lib/isodoc/gb/gbwordconvert.rb
280
- - lib/isodoc/gb/gbwordrender.rb
281
280
  - lib/isodoc/gb/html/blank.png
282
281
  - lib/isodoc/gb/html/footer.png
283
282
  - lib/isodoc/gb/html/gb-logos/gb-issuer-default.gif
@@ -333,7 +332,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
332
  requirements:
334
333
  - - ">="
335
334
  - !ruby/object:Gem::Version
336
- version: '0'
335
+ version: 2.4.0
337
336
  required_rubygems_version: !ruby/object:Gem::Requirement
338
337
  requirements:
339
338
  - - ">="
@@ -1,243 +0,0 @@
1
- module IsoDoc
2
- module Gb
3
- # A {Converter} implementation that generates GB output, and a document
4
- # schema encapsulation of the document for validation
5
- class WordConvert < IsoDoc::WordConvert
6
- def formula_parse(node, out)
7
- out.div **attr_code(id: node["id"], class: "formula") do |div|
8
- insert_tab(div, 1)
9
- parse(node.at(ns("./stem")), out)
10
- insert_tab(div, 1)
11
- div << "(#{get_anchors[node['id']][:label]})"
12
- end
13
- formula_where(node.at(ns("./dl")), out)
14
- end
15
-
16
- def formula_where(dl, out)
17
- return unless dl
18
- out.p { |p| p << @where_lbl }
19
- formula_dl_parse(dl, out)
20
- end
21
-
22
- def formula_dl_parse(node, out)
23
- out.table **{ class: "dl" } do |v|
24
- node.elements.each_slice(2) do |dt, dd|
25
- v.tr do |tr|
26
- tr.td **{ valign: "top", align: "left" } do |term|
27
- dt_parse(dt, term)
28
- end
29
- tr.td(**{ valign: "top" }) { |td| td << "&mdash;" }
30
- tr.td **{ valign: "top" } do |listitem|
31
- dd.children.each { |n| parse(n, listitem) }
32
- end
33
- end
34
- end
35
- end
36
- end
37
-
38
- EXAMPLE_TBL_ATTR =
39
- { valign: "top", class: "example_label",
40
- style: "padding:2pt 2pt 2pt 2pt" }.freeze
41
-
42
- def example_table_parse(node, out)
43
- out.table **attr_code(id: node["id"], class: "example") do |t|
44
- t.tr do |tr|
45
- tr.td **EXAMPLE_TBL_ATTR do |td|
46
- td << l10n(example_label(node) + ":")
47
- end
48
- tr.td **{ valign: "top", class: "example" } do |td|
49
- node.children.each { |n| parse(n, td) }
50
- end
51
- end
52
- end
53
- end
54
-
55
- def example_label(node)
56
- l10n(super + ":")
57
- end
58
-
59
- def note_parse(node, out)
60
- @note = true
61
- out.table **attr_code(id: node["id"], class: "Note") do |t|
62
- t.tr do |tr|
63
- tr.td **EXAMPLE_TBL_ATTR do |td|
64
- td << l10n(note_label(node) + ":")
65
- end
66
- tr.td **{ valign: "top", class: "Note" } do |td|
67
- node.children.each { |n| parse(n, td) }
68
- end
69
- end
70
- end
71
- @note = false
72
- end
73
-
74
- def termnote_parse(node, out)
75
- @note = true
76
- out.table **attr_code(id: node["id"], class: "Note") do |t|
77
- t.tr do |tr|
78
- tr.td **EXAMPLE_TBL_ATTR do |td|
79
- td << l10n("#{get_anchors[node['id']][:label]}:")
80
- end
81
- tr.td **{ valign: "top", class: "Note" } do |td|
82
- node.children.each { |n| parse(n, td) }
83
- end
84
- end
85
- end
86
- @note = false
87
- end
88
-
89
- def middle(isoxml, out)
90
- super
91
- end_line(isoxml, out)
92
- end
93
-
94
- def end_line(_isoxml, out)
95
- out.hr **{ width: "25%" }
96
- end
97
-
98
- def error_parse(node, out)
99
- # catch elements not defined in ISO
100
- case node.name
101
- when "string" then string_parse(node, out)
102
- else
103
- super
104
- end
105
- end
106
-
107
- def string_parse(node, out)
108
- if node["script"] == "Hant"
109
- out.span **{ class: "Hant" } do |s|
110
- node.children.each { |c| parse(c, s) }
111
- end
112
- else
113
- node.children.each { |c| parse(c, out) }
114
- end
115
- end
116
-
117
- def deprecated_term_parse(node, out)
118
- out.p **{ class: "DeprecatedTerms" } do |p|
119
- p << l10n("#{@deprecated_lbl}: ")
120
- node.children.each { |c| parse(c, p) }
121
- end
122
- end
123
-
124
- def termref_render(x)
125
- parts = x.split(%r{(\s*\[MODIFICATION\]|,)}m)
126
- parts[1] = l10n(", #{@source_lbl}") if parts.size > 1 && parts[1] == ","
127
- parts.map do |p|
128
- /\s*\[MODIFICATION\]/.match(p) ? l10n(", #{@modified_lbl} &mdash; ") : p
129
- end.join.sub(/\A\s*/m, l10n("[")).sub(/\s*\z/m, l10n("]"))
130
- end
131
-
132
- def termref_resolve(docxml)
133
- docxml.split(%r{(\[TERMREF\]|\[/TERMREF\])}).each_slice(4).
134
- map do |a|
135
- a.size < 3 ? a[0] : a[0] + termref_render(a[2])
136
- end.join
137
- end
138
-
139
- def populate_template(docxml, format)
140
- meta = @meta.get.merge(@labels)
141
- logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
142
- logofile = @meta.standard_logo(meta[:gbprefix])
143
- @files_to_delete << logofile + ".gif" unless logofile.nil?
144
- docxml = termref_resolve(docxml)
145
- meta[:standard_agency_formatted] =
146
- @common.format_agency(meta[:standard_agency], format, @localdir)
147
- meta[:standard_logo] = logo
148
- template = Liquid::Template.parse(docxml)
149
- template.render(meta.map { |k, v| [k.to_s, v] }.to_h)
150
- end
151
-
152
- def foreword(isoxml, out)
153
- f = isoxml.at(ns("//foreword")) || return
154
- page_break(out)
155
- out.div do |s|
156
- s.h1 **{ class: "ForewordTitle" } do |h1|
157
- h1 << "#{@foreword_lbl}&nbsp;"
158
- # insert_tab(h1, 1)
159
- end
160
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
161
- end
162
- end
163
-
164
- def clause_name(num, title, div, header_class)
165
- header_class = {} if header_class.nil?
166
- div.h1 **attr_code(header_class) do |h1|
167
- if num && !@suppressheadingnumbers
168
- h1 << "#{num}."
169
- h1 << "&#x3000;"
170
- end
171
- h1 << title
172
- end
173
- div.parent.at(".//h1")
174
- end
175
-
176
- def clause_parse_title(node, div, c1, out)
177
- if node["inline-header"] == "true"
178
- inline_header_title(out, node, c1)
179
- else
180
- div.send "h#{get_anchors[node['id']][:level]}" do |h|
181
- h << "#{get_anchors[node['id']][:label]}.&#x3000;" if !@suppressheadingnumbers
182
- c1 && c1.children.each { |c2| parse(c2, h) }
183
- end
184
- end
185
- end
186
-
187
- def annex_name(annex, name, div)
188
- div.h1 **{ class: "Annex" } do |t|
189
- t << "#{get_anchors[annex['id']][:label]}<br/><br/>"
190
- name&.children&.each { |c2| parse(c2, t) }
191
- end
192
- end
193
-
194
- def term_defs_boilerplate(div, source, term, preface)
195
- (source.empty? && term.nil?) and div << @no_terms_boilerplate or
196
- div << term_defs_boilerplate_cont(source, term)
197
- #div << @term_def_boilerplate unless preface
198
- end
199
-
200
- =begin
201
- def reference_names(ref)
202
- isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
203
- docid = ref.at(ns("./docidentifier"))
204
- date = ref.at(ns("./date[@type = 'published']"))
205
- reference = format_ref(docid.text, isopub, date)
206
- @anchors[ref["id"]] = { xref: reference }
207
- end
208
- =end
209
-
210
- def example_p_parse(node, div)
211
- div.p do |p|
212
- p.span **{ class: "example_label" } do |s|
213
- s << example_label(node)
214
- end
215
- insert_tab(p, 1)
216
- node.first_element_child.children.each { |n| parse(n, p) }
217
- end
218
- node.element_children[1..-1].each { |n| parse(n, div) }
219
- end
220
-
221
- def example_parse1(node, div)
222
- div.p do |p|
223
- p.span **{ class: "example_label" } do |s|
224
- s << example_label(node)
225
- end
226
- insert_tab(p, 1)
227
- end
228
- node.children.each { |n| parse(n, div) }
229
- end
230
-
231
- def example_parse(node, out)
232
- out.div **{ id: node["id"], class: "example" } do |div|
233
- if node.first_element_child.name == "p"
234
- example_p_parse(node, div)
235
- else
236
- example_parse1(node, div)
237
- end
238
- end
239
- end
240
- end
241
- end
242
- end
243
-