metanorma-un 0.3.10 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -98,8 +98,8 @@ module IsoDoc
98
98
  if node["inline-header"] == "true"
99
99
  inline_header_title(out, node, c1)
100
100
  else
101
- div.send "h#{anchor(node['id'], :level, false) || '1'}" do |h|
102
- lbl = anchor(node['id'], :label, false)
101
+ div.send "h#{@xrefs.anchor(node['id'], :level, false) || '1'}" do |h|
102
+ lbl = @xrefs.anchor(node['id'], :label, false)
103
103
  if lbl && !@suppressheadingnumbers
104
104
  h << "#{lbl}. "
105
105
  insert_tab(h, 1)
@@ -2,9 +2,7 @@ require "roman-numerals"
2
2
 
3
3
  module IsoDoc
4
4
  module UN
5
- module BaseConvert
6
- MIDDLE_CLAUSE = "//clause[parent::sections]".freeze
7
-
5
+ class Xref < IsoDoc::Xref
8
6
  def initial_anchor_names(d)
9
7
  preface_names(d.at(ns("//preface/abstract")))
10
8
  preface_names(d.at(ns("//foreword")))
@@ -75,7 +73,7 @@ module IsoDoc
75
73
  num = num + 1
76
74
  lbl = levelnumber(num, 1)
77
75
  @anchors[clause["id"]] = { label: lbl, level: lvl, type: "clause",
78
- xref: l10n("#{@clause_lbl} #{lbl}") }
76
+ xref: l10n("#{@labels['clause']} #{lbl}") }
79
77
  i = 1
80
78
  clause.xpath(ns(NONTERMINAL)).each do |c|
81
79
  next if c["unnumbered"] == "true"
@@ -89,7 +87,7 @@ module IsoDoc
89
87
  leaf_section?(clause) and label_leaf_section(clause, level) and return
90
88
  /\.(?<leafnum>[^.]+$)/ =~ num
91
89
  @anchors[clause["id"]] = { label: leafnum, level: level, type: "clause",
92
- xref: l10n("#{@clause_lbl} #{num}") }
90
+ xref: l10n("#{@labels['clause']} #{num}") }
93
91
  i = 1
94
92
  clause.xpath(ns(NONTERMINAL)).each do |c|
95
93
  next if c["unnumbered"] == "true"
@@ -99,11 +97,11 @@ module IsoDoc
99
97
  end
100
98
 
101
99
  def annex_name_lbl(clause, num)
102
- l10n("<b>#{@annex_lbl} #{num}</b>")
100
+ l10n("<b>#{@labels['annex']} #{num}</b>")
103
101
  end
104
102
 
105
103
  SUBCLAUSES =
106
- "./clause | ./references | ./term | ./terms | ./definitions".freeze
104
+ "./clause | ./references | ./term | ./terms | ./definitions".freeze
107
105
 
108
106
 
109
107
  def annex_names(clause, num)
@@ -112,13 +110,13 @@ module IsoDoc
112
110
  label_annex_leaf_section(clause, num, 1) and return
113
111
  @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
114
112
  type: "clause",
115
- xref: "#{@annex_lbl} #{num}", level: 1 }
113
+ xref: "#{@labels['annex']} #{num}", level: 1 }
116
114
  if a = single_annex_special_section(clause)
117
115
  annex_names1(a, "#{num}", 1)
118
116
  else
119
117
  i = 1
120
118
  clause.xpath(ns(SUBCLAUSES)).each do |c|
121
- next if c["unnumbered"] == "true"
119
+ next if c["unnumbered"] == "true"
122
120
  annex_names1(c, "#{num}.#{annex_levelnum(i, 2)}", 2)
123
121
  i += 1 if !leaf_section?(c)
124
122
  end
@@ -129,8 +127,8 @@ module IsoDoc
129
127
  leaf_section?(clause) and
130
128
  label_annex_leaf_section(clause, num, level) and return
131
129
  /\.(?<leafnum>[^.]+$)/ =~ num
132
- @anchors[clause["id"]] = { label: leafnum, xref: "#{@annex_lbl} #{num}",
133
- level: level, type: "clause" }
130
+ @anchors[clause["id"]] = { label: leafnum, xref: "#{@labels['annex']} #{num}",
131
+ level: level, type: "clause" }
134
132
  i = 1
135
133
  clause.xpath(ns("./clause | ./references")).each do |c|
136
134
  next if c["unnumbered"] == "true"
@@ -158,7 +156,7 @@ module IsoDoc
158
156
  clause.xpath(ns(".//admonition")).each do |t|
159
157
  next if t["id"].nil? || t["id"].empty?
160
158
  i += 1 unless t["unnumbered"] == "true"
161
- @anchors[t["id"]] = anchor_struct(i.to_s, nil, @admonition_lbl,
159
+ @anchors[t["id"]] = anchor_struct(i.to_s, nil, @labels["admonition"],
162
160
  "box", t["unnumbered"])
163
161
  end
164
162
  end
@@ -169,7 +167,7 @@ module IsoDoc
169
167
  next if t["id"].nil? || t["id"].empty?
170
168
  i += 1 unless t["unnumbered"] == "true"
171
169
  @anchors[t["id"]] =
172
- anchor_struct("#{num}.#{i}", nil, @admonition_lbl, "box",
170
+ anchor_struct("#{num}.#{i}", nil, @labels["admonition"], "box",
173
171
  t["unnumbered"])
174
172
  end
175
173
  end
@@ -30,18 +30,16 @@ module Metanorma
30
30
  "Metanorma::UN #{Metanorma::UN::VERSION}"
31
31
  end
32
32
 
33
- def input_to_isodoc(file, filename)
34
- Metanorma::UN::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
35
- end
36
-
37
- def output(isodoc_node, outname, format, options={})
33
+ def output(isodoc_node, inname, outname, format, options={})
38
34
  case format
39
35
  when :html
40
- IsoDoc::UN::HtmlConvert.new(options).convert(outname, isodoc_node)
36
+ IsoDoc::UN::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
41
37
  when :doc
42
- IsoDoc::UN::WordConvert.new(options).convert(outname, isodoc_node)
38
+ IsoDoc::UN::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
43
39
  when :pdf
44
- IsoDoc::UN::PdfConvert.new(options).convert(outname, isodoc_node)
40
+ IsoDoc::UN::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
41
+ when :presentation
42
+ IsoDoc::UN::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
45
43
  else
46
44
  super
47
45
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.3.10"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
@@ -33,9 +33,10 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "iso-639"
34
34
 
35
35
  spec.add_dependency "metanorma-standoc", "~> 1.4.0"
36
- spec.add_dependency "isodoc", "~> 1.0.0"
36
+ spec.add_dependency "isodoc", "~> 1.1.0"
37
37
 
38
38
  spec.add_development_dependency "byebug", "~> 9.1"
39
+ spec.add_development_dependency "sassc", "2.4.0"
39
40
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
40
41
  spec.add_development_dependency "guard", "~> 2.14"
41
42
  spec.add_development_dependency "guard-rspec", "~> 4.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-08 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0
103
+ version: 1.1.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.0
110
+ version: 1.1.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: byebug
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '9.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sassc
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 2.4.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 2.4.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: equivalent-xml
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -273,17 +287,21 @@ files:
273
287
  - lib/isodoc/un/html/html_unece_intro.html
274
288
  - lib/isodoc/un/html/html_unece_plenary_titlepage.html
275
289
  - lib/isodoc/un/html/html_unece_titlepage.html
290
+ - lib/isodoc/un/html/htmlstyle.css
276
291
  - lib/isodoc/un/html/htmlstyle.scss
277
292
  - lib/isodoc/un/html/logo.jpg
278
293
  - lib/isodoc/un/html/scripts.html
294
+ - lib/isodoc/un/html/unece.css
279
295
  - lib/isodoc/un/html/unece.scss
280
296
  - lib/isodoc/un/html/word_unece_intro.html
281
297
  - lib/isodoc/un/html/word_unece_plenary_titlepage.html
282
298
  - lib/isodoc/un/html/word_unece_titlepage.html
299
+ - lib/isodoc/un/html/wordstyle.css
283
300
  - lib/isodoc/un/html/wordstyle.scss
284
301
  - lib/isodoc/un/html_convert.rb
285
302
  - lib/isodoc/un/metadata.rb
286
303
  - lib/isodoc/un/pdf_convert.rb
304
+ - lib/isodoc/un/presentation_xml_convert.rb
287
305
  - lib/isodoc/un/un.plenary-attachment.xsl
288
306
  - lib/isodoc/un/un.plenary.xsl
289
307
  - lib/isodoc/un/un.recommendation.xsl
@@ -300,7 +318,7 @@ homepage: https://github.com/metanorma/metanorma-un
300
318
  licenses:
301
319
  - BSD-2-Clause
302
320
  metadata: {}
303
- post_install_message:
321
+ post_install_message:
304
322
  rdoc_options: []
305
323
  require_paths:
306
324
  - lib
@@ -315,9 +333,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
333
  - !ruby/object:Gem::Version
316
334
  version: '0'
317
335
  requirements: []
318
- rubyforge_project:
319
- rubygems_version: 2.7.6
320
- signing_key:
336
+ rubygems_version: 3.0.3
337
+ signing_key:
321
338
  specification_version: 4
322
339
  summary: Metanorma for UN.
323
340
  test_files: []