metanorma-itu 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,12 +5,12 @@ require "fileutils"
5
5
  module IsoDoc
6
6
  module ITU
7
7
  module BaseConvert
8
- def nonstd_bibitem(list, b, ordinal, biblio)
8
+ def nonstd_bibitem(list, b, _ordinal, biblio)
9
9
  list.tr **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
10
10
  id = render_identifier(bibitem_ref_code(b))
11
- ref.td **{style: "vertical-align:top"} do |td|
12
- td << (id[0] || "[#{id[1]}]")&.
13
- gsub(/-/, "&#x2011;")&.gsub(/ /, "&#xa0;")
11
+ ref.td **{ style: "vertical-align:top" } do |td|
12
+ td << (id[0] || "[#{id[1]}]")
13
+ &.gsub(/-/, "&#x2011;")&.gsub(/ /, "&#xa0;")
14
14
  date_note_process(b, td)
15
15
  end
16
16
  ref.td { |td| reference_format(b, td) }
@@ -28,6 +28,7 @@ module IsoDoc
28
28
  f.elements.each do |b|
29
29
  if b.name == "bibitem"
30
30
  next if implicit_reference(b)
31
+
31
32
  i += 1
32
33
  nonstd_bibitem(tbody, b, i, biblio)
33
34
  else
@@ -45,6 +46,7 @@ module IsoDoc
45
46
 
46
47
  def bracket_if_num(x)
47
48
  return nil if x.nil?
49
+
48
50
  x = x.text.sub(/^\[/, "").sub(/\]$/, "")
49
51
  "[#{x}]"
50
52
  end
@@ -55,7 +57,7 @@ module IsoDoc
55
57
  end
56
58
 
57
59
  def titlecase(s)
58
- s.gsub(/ |\_|\-/, " ").split(/ /).map(&:capitalize).join(" ")
60
+ s.gsub(/ |_|-/, " ").split(/ /).map(&:capitalize).join(" ")
59
61
  end
60
62
 
61
63
  def pref_ref_code(b)
@@ -71,23 +73,27 @@ module IsoDoc
71
73
  id.empty? and
72
74
  id = b.xpath(ns("./docidentifier[not(@type = 'metanorma')]"))
73
75
  return [] if id.empty?
76
+
74
77
  id.sort_by { |i| i["type"] == "ITU" ? 0 : 1 }
75
78
  end
76
79
 
77
80
  def render_multi_identifiers(ids)
78
81
  ids.map do |id|
79
- id["type"] == "ITU" ? doctype_title(id) :
82
+ if id["type"] == "ITU"
83
+ doctype_title(id)
84
+ else
80
85
  docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
86
+ end
81
87
  end.join(" | ")
82
88
  end
83
89
 
84
90
  def doctype_title(id)
85
91
  type = id.parent&.at(ns("./ext/doctype"))&.text || "recommendation"
86
92
  if type == "recommendation" &&
87
- /^(?<prefix>ITU-[A-Z] [A-Z])[ .-]Sup[a-z]*\.[ ]?(?<num>\d+)$/ =~ id.text
93
+ /^(?<prefix>ITU-[A-Z] [A-Z])[ .-]Sup[a-z]*\. ?(?<num>\d+)$/ =~ id.text
88
94
  "#{prefix}-series Recommendations – Supplement #{num}"
89
95
  else
90
- d = docid_prefix(id["type"], id.text.sub(/^\[/, '').sub(/\]$/, ''))
96
+ d = docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
91
97
  "#{titlecase(type)} #{d}"
92
98
  end
93
99
  end
@@ -98,7 +104,7 @@ module IsoDoc
98
104
  r << id1
99
105
  date = b.at(ns("./date[@type = 'published']")) and
100
106
  r << " (#{date.text.sub(/-.*$/, '')})"
101
- r << ", " if (date || !id1.empty?)
107
+ r << ", " if date || !id1.empty?
102
108
  end
103
109
 
104
110
  def reference_format_title(b, r)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "1.3.4".freeze
3
+ VERSION = "1.3.5".freeze
4
4
  end
5
5
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = "exe"
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
26
 
27
27
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
28
  spec.add_dependency "isodoc", "~> 1.6.0"
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.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-07 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -360,7 +360,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
360
360
  requirements:
361
361
  - - ">="
362
362
  - !ruby/object:Gem::Version
363
- version: 2.4.0
363
+ version: 2.5.0
364
364
  required_rubygems_version: !ruby/object:Gem::Requirement
365
365
  requirements:
366
366
  - - ">="