metanorma-un 0.3.9 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,6 @@ module IsoDoc
13
13
  @toc = options[:toc]
14
14
  end
15
15
 
16
- #def convert1(docxml, filename, dir)
17
- #FileUtils.cp html_doc_path('logo.jpg'), File.join(@localdir, "logo.jpg")
18
- #super
19
- #end
20
-
21
16
  def default_fonts(options)
22
17
  {
23
18
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Times New Roman",serif'),
@@ -92,6 +87,7 @@ module IsoDoc
92
87
  end
93
88
 
94
89
  def middle(isoxml, out)
90
+ middle_admonitions(isoxml, out)
95
91
  clause isoxml, out
96
92
  annex isoxml, out
97
93
  bibliography isoxml, out
@@ -102,8 +98,8 @@ module IsoDoc
102
98
  if node["inline-header"] == "true"
103
99
  inline_header_title(out, node, c1)
104
100
  else
105
- div.send "h#{anchor(node['id'], :level, false) || '1'}" do |h|
106
- 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)
107
103
  if lbl && !@suppressheadingnumbers
108
104
  h << "#{lbl}. "
109
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.9"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -32,10 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "twitter_cldr"
33
33
  spec.add_dependency "iso-639"
34
34
 
35
- spec.add_dependency "metanorma-standoc", "~> 1.3.0"
36
- spec.add_dependency "isodoc", "~> 1.0.0"
35
+ spec.add_dependency "metanorma-standoc", "~> 1.4.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.9
4
+ version: 0.4.2
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-05-26 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.3.0
89
+ version: 1.4.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: 1.3.0
96
+ version: 1.4.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: isodoc
99
99
  requirement: !ruby/object:Gem::Requirement
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
@@ -284,6 +298,8 @@ files:
284
298
  - lib/isodoc/un/html_convert.rb
285
299
  - lib/isodoc/un/metadata.rb
286
300
  - lib/isodoc/un/pdf_convert.rb
301
+ - lib/isodoc/un/presentation_xml_convert.rb
302
+ - lib/isodoc/un/un.plenary-attachment.xsl
287
303
  - lib/isodoc/un/un.plenary.xsl
288
304
  - lib/isodoc/un/un.recommendation.xsl
289
305
  - lib/isodoc/un/word_convert.rb
@@ -299,7 +315,7 @@ homepage: https://github.com/metanorma/metanorma-un
299
315
  licenses:
300
316
  - BSD-2-Clause
301
317
  metadata: {}
302
- post_install_message:
318
+ post_install_message:
303
319
  rdoc_options: []
304
320
  require_paths:
305
321
  - lib
@@ -314,9 +330,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
330
  - !ruby/object:Gem::Version
315
331
  version: '0'
316
332
  requirements: []
317
- rubyforge_project:
318
- rubygems_version: 2.7.6
319
- signing_key:
333
+ rubygems_version: 3.0.3
334
+ signing_key:
320
335
  specification_version: 4
321
336
  summary: Metanorma for UN.
322
337
  test_files: []