metanorma-un 0.3.11 → 0.4.0

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
@@ -34,14 +34,16 @@ module Metanorma
34
34
  Metanorma::UN::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
35
35
  end
36
36
 
37
- def output(isodoc_node, outname, format, options={})
37
+ def output(isodoc_node, inname, outname, format, options={})
38
38
  case format
39
39
  when :html
40
- IsoDoc::UN::HtmlConvert.new(options).convert(outname, isodoc_node)
40
+ IsoDoc::UN::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
41
41
  when :doc
42
- IsoDoc::UN::WordConvert.new(options).convert(outname, isodoc_node)
42
+ IsoDoc::UN::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
43
43
  when :pdf
44
- IsoDoc::UN::PdfConvert.new(options).convert(outname, isodoc_node)
44
+ IsoDoc::UN::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
45
+ when :presentation
46
+ IsoDoc::UN::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
45
47
  else
46
48
  super
47
49
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.3.11"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -33,7 +33,7 @@ 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
39
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
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.11
4
+ version: 0.4.0
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-19 00:00:00.000000000 Z
11
+ date: 2020-06-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
@@ -284,6 +284,7 @@ files:
284
284
  - lib/isodoc/un/html_convert.rb
285
285
  - lib/isodoc/un/metadata.rb
286
286
  - lib/isodoc/un/pdf_convert.rb
287
+ - lib/isodoc/un/presentation_xml_convert.rb
287
288
  - lib/isodoc/un/un.plenary-attachment.xsl
288
289
  - lib/isodoc/un/un.plenary.xsl
289
290
  - lib/isodoc/un/un.recommendation.xsl
@@ -300,7 +301,7 @@ homepage: https://github.com/metanorma/metanorma-un
300
301
  licenses:
301
302
  - BSD-2-Clause
302
303
  metadata: {}
303
- post_install_message:
304
+ post_install_message:
304
305
  rdoc_options: []
305
306
  require_paths:
306
307
  - lib
@@ -315,9 +316,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
316
  - !ruby/object:Gem::Version
316
317
  version: '0'
317
318
  requirements: []
318
- rubyforge_project:
319
- rubygems_version: 2.7.6
320
- signing_key:
319
+ rubygems_version: 3.0.3
320
+ signing_key:
321
321
  specification_version: 4
322
322
  summary: Metanorma for UN.
323
323
  test_files: []