metanorma-itu 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,8 @@ module IsoDoc
11
11
  File.expand_path(File.join(here, "html", "International_Telecommunication_Union_Logo.svg")))
12
12
  set(:logo_comb,
13
13
  File.expand_path(File.join(here, "html", "itu-document-comb.png")))
14
- set(:logo_word, File.expand_path(File.join(here, "html", "International_Telecommunication_Union_Logo.svg")))
14
+ set(:logo_word,
15
+ File.expand_path(File.join(here, "html", "International_Telecommunication_Union_Logo.svg")))
15
16
  end
16
17
 
17
18
  def title(isoxml, _out)
@@ -68,11 +69,18 @@ module IsoDoc
68
69
  end
69
70
 
70
71
  def keywords(isoxml, _out)
71
- keywords = []
72
- isoxml.xpath(ns("//bibdata/keyword")).each do |kw|
73
- keywords << kw.text
72
+ super
73
+ set(:keywords, get[:keywords].sort)
74
+ end
75
+
76
+ def doctype(isoxml, _out)
77
+ d = isoxml&.at(ns("//bibdata/ext/doctype"))&.text
78
+ set(:doctype_original, d)
79
+ if d == "recommendation-annex"
80
+ set(:doctype, "Recommendation")
81
+ else
82
+ super
74
83
  end
75
- set(:keywords, keywords.sort)
76
84
  end
77
85
 
78
86
  def ip_notice_received(isoxml, _out)
@@ -17,12 +17,14 @@ module IsoDoc
17
17
  end
18
18
 
19
19
  def nonstd_bibitem(list, b, ordinal, biblio)
20
- list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
20
+ list.tr **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
21
21
  id = render_identifier(bibitem_ref_code(b))
22
- ref << (id[0] || "[#{id[1]}]")
23
- date_note_process(b, ref)
24
- insert_tab(ref, 1)
25
- reference_format(b, ref)
22
+ ref.td **{style: "vertical-align:top"} do |td|
23
+ td << (id[0] || "[#{id[1]}]")&.
24
+ gsub(/-/, "&#x2011;")&.gsub(/ /, "&#xa0;")
25
+ date_note_process(b, td)
26
+ end
27
+ ref.td { |td| reference_format(b, td) }
26
28
  end
27
29
  end
28
30
 
@@ -30,11 +32,35 @@ module IsoDoc
30
32
  nonstd_bibitem(list, b, ordinal, biblio)
31
33
  end
32
34
 
35
+ def biblio_list(f, div, biblio)
36
+ div.table **{ class: "biblio", border: "0" } do |t|
37
+ i = 0
38
+ t.tbody do |tbody|
39
+ f.elements.each do |b|
40
+ if b.name == "bibitem"
41
+ next if implicit_reference(b)
42
+ i += 1
43
+ nonstd_bibitem(tbody, b, i, biblio)
44
+ else
45
+ unless %w(title clause references).include? b.name
46
+ tbody.tx do |tx|
47
+ parse(b, tx)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ f.xpath(ns("./clause | ./references")).each do |x|
55
+ parse(x, div)
56
+ end
57
+ end
58
+
33
59
  def bracket_if_num(x)
34
- return nil if x.nil?
35
- x = x.text.sub(/^\[/, "").sub(/\]$/, "")
36
- "[#{x}]"
37
- end
60
+ return nil if x.nil?
61
+ x = x.text.sub(/^\[/, "").sub(/\]$/, "")
62
+ "[#{x}]"
63
+ end
38
64
 
39
65
  def reference_format(b, r)
40
66
  reference_format_start(b, r)
@@ -50,7 +76,7 @@ module IsoDoc
50
76
  end
51
77
 
52
78
  IGNORE_IDS =
53
- "@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor'".freeze
79
+ "@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor'".freeze
54
80
 
55
81
  def multi_bibitem_ref_code(b)
56
82
  id = b.xpath(ns("./docidentifier[not(@type = 'metanorma' or #{IGNORE_IDS})]"))
@@ -39,7 +39,7 @@ module IsoDoc
39
39
  insert_tab(b, 1)
40
40
  term.children.each { |n| parse(n, b) }
41
41
  end
42
- source and p << " [#{source.value}]"
42
+ source and p << " #{bracket_opt(source.value)}"
43
43
  p << ": "
44
44
  end
45
45
  defn and defn.children.each { |n| parse(n, div) }
@@ -214,8 +214,9 @@ module IsoDoc
214
214
  next unless auth && dest
215
215
  t == "copyright" and p = auth&.at(".//p") and
216
216
  p["class"] = "boilerplateHdr"
217
- auth&.xpath(".//p[not(@class)]")&.each do |p|
217
+ auth&.xpath(".//p[not(@class)]")&.each_with_index do |p, i|
218
218
  p["class"] = "boilerplate"
219
+ i == 0 && t == "copyright" and p["style"] = "text-align:center;"
219
220
  end
220
221
  auth << "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>" unless t == "copyright"
221
222
  dest.replace(auth.remove)
@@ -67,10 +67,6 @@ module IsoDoc
67
67
  termexample_anchor_names(d)
68
68
  end
69
69
 
70
- def hiersep
71
- "-"
72
- end
73
-
74
70
  MIDDLE_SECTIONS = "//clause[title = 'Scope'] | "\
75
71
  "//foreword | //introduction | //acknowledgements | "\
76
72
  "//references[@normative = 'true'] | "\
@@ -126,6 +122,17 @@ module IsoDoc
126
122
  end
127
123
  end
128
124
  end
125
+
126
+ def hierarchical_formula_names(clause, num)
127
+ c = IsoDoc::Function::XrefGen::Counter.new
128
+ clause.xpath(ns(".//formula")).each do |t|
129
+ next if t["id"].nil? || t["id"].empty?
130
+ @anchors[t["id"]] =
131
+ anchor_struct("#{num}-#{c.increment(t).print}", nil,
132
+ t["inequality"] ? @inequality_lbl : @formula_lbl,
133
+ "formula", t["unnumbered"])
134
+ end
135
+ end
129
136
  end
130
137
  end
131
138
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "1.0.16"
3
+ VERSION = "1.0.17"
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
28
  spec.add_dependency "ruby-jing"
29
- spec.add_dependency "metanorma-standoc", "~> 1.3.0"
29
+ spec.add_dependency "metanorma-standoc", "~> 1.4.0"
30
30
  spec.add_dependency "isodoc", "~> 1.0.0"
31
31
 
32
32
  spec.add_development_dependency "byebug", "~> 9.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
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-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: 1.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.0
54
+ version: 1.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement