metanorma-ieee 1.6.9 → 1.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 891fa8a910ea2585f10fed401ac0662350ee90f815466239e87b47ee3c955e49
4
- data.tar.gz: 376447bafc1e0c02c2766d6d13380d0bce718d4b0a8cd900534d77666676d5d9
3
+ metadata.gz: 7ae3dc5271b5b6922a7c4d5c97a069467a8abe8b932eebe915288b3919bb570a
4
+ data.tar.gz: 2813a9169b01737e54bb8bd30b3efc67f313f3b737390434293a8a636611c76a
5
5
  SHA512:
6
- metadata.gz: cbe1087ab6d2474b1badda0e313e69242f52e2f976ed0634e9a67a1af11dde1f6b2450ca340d8d74dda6df3a377e6b2e3a9e1a5d783f700b0fd136e903692a94
7
- data.tar.gz: e25c7274895abd556694df517be356ec3552563934ac096b79ef091479799cd1ccea8c64cd5c2c5f34c96f022b8163852da194a10811d6fc0e63f223fe4bdc86
6
+ metadata.gz: 9ae22a0ab171d82c4f62c00ecb21acbd527830595f2742f6f0c56ab1472d9b5a217f1c9c22a3b9aeb555718ee45493127300338e708d150dec61696ddb3c2812
7
+ data.tar.gz: 1f82da62388754f1e997341350d05f26eb71f662520475734f4f689dce1c6e8ba3076671f807d9e08db24953ff60bdc2b5d31308d77dcba990754107d47ecdd6
data/.rubocop.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
- - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
5
 
6
6
  # local repo-specific modifications
7
7
  # ...
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 2.5
10
+ TargetRubyVersion: 3.4
@@ -83,7 +83,7 @@ module IsoDoc
83
83
  else super
84
84
  end
85
85
  end
86
-
86
+
87
87
  def ol_attrs(node)
88
88
  ret = super
89
89
  ret.merge(class: OL_STYLE.invert[ret[:type]])
@@ -23,12 +23,12 @@ module IsoDoc
23
23
 
24
24
  def bibdate(isoxml, _out)
25
25
  isoxml.xpath(ns("//bibdata/date[@format = 'ddMMMyyyy']")).each do |d|
26
- set("#{d['type'].tr('-', '_')}date".to_sym, Common::date_range(d))
26
+ set(:"#{d['type'].tr('-', '_')}date", Common::date_range(d))
27
27
  end
28
28
  draft = isoxml.at(ns("//bibdata/date[@type = 'issued']")) ||
29
29
  isoxml.at(ns("//bibdata/date[@type = 'circulated']")) ||
30
30
  isoxml.at(ns("//bibdata/date[@type = 'created']")) ||
31
- isoxml.at(ns("//bibdata/version/revision-date")) or return
31
+ isoxml.at(ns("//bibdata/date[@type = 'updated']")) or return
32
32
  date = DateTime.parse(draft.text)
33
33
  set(:draft_month, date.strftime("%B"))
34
34
  set(:draft_year, date.strftime("%Y"))
@@ -59,7 +59,7 @@ module IsoDoc
59
59
  def agency(xml)
60
60
  super
61
61
  logos = xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = 'author']/" \
62
- "organization/logo/image/@src"))
62
+ "organization/logo/image/@src"))
63
63
  set(:corporate_author_logos, logos.map { |l| to_datauri(l.value) })
64
64
  set(:corporate_author_logo_attrs, contrib_logo_attrs(xml, "author"))
65
65
  end
@@ -78,27 +78,27 @@ module IsoDoc
78
78
 
79
79
  def society(xml)
80
80
  society = xml.at(ns("//bibdata/contributor[role/@type = 'authorizer']/" \
81
- "organization/subdivision[@type='Society']/name"))&.text ||
81
+ "organization/subdivision[@type='Society']/name"))&.text ||
82
82
  "<Society>"
83
83
  set(:society, society)
84
84
  end
85
85
 
86
86
  def tc(xml)
87
87
  tc = xml.at(ns("//bibdata/contributor[role/@type = 'authorizer']/" \
88
- "organization/subdivision[@type='Committee']/name"))&.text ||
88
+ "organization/subdivision[@type='Committee']/name"))&.text ||
89
89
  "<Committee Name>"
90
90
  set(:technical_committee, tc)
91
91
  end
92
92
 
93
93
  def wg(xml)
94
94
  wg = xml.at(ns("//bibdata/contributor[role/@type = 'authorizer']/" \
95
- "organization/subdivision[@type='Working group']/name")) or return nil
95
+ "organization/subdivision[@type='Working group']/name")) or return nil
96
96
  set(:working_group, wg.text)
97
97
  end
98
98
 
99
99
  def bg(xml)
100
100
  bg = xml.at(ns("//bibdata/contributor[role/@type = 'authorizer']/" \
101
- "organization/subdivision[@type='Balloting group']/name")) or return nil
101
+ "organization/subdivision[@type='Balloting group']/name")) or return nil
102
102
  set(:balloting_group, bg.text)
103
103
  set(:balloting_group_type, bg.parent["subtype"])
104
104
  end
@@ -146,15 +146,13 @@ module IsoDoc
146
146
  end
147
147
 
148
148
  def ddMMMyyyy(isodate)
149
- isodate.nil? and return nil
150
- arr = isodate.split("-")
151
- if arr.size == 1 && (/^\d+$/.match isodate)
152
- Date.new(*arr.map(&:to_i)).strftime("%Y")
153
- elsif arr.size == 2
154
- Date.new(*arr.map(&:to_i)).strftime("%b %Y")
155
- else
156
- Date.parse(isodate).strftime("%d %b %Y")
157
- end
149
+ IsoDoc::ExtendedDateFormatter.format_iso_date(
150
+ isodate,
151
+ lang: @lang,
152
+ year: "%Y",
153
+ year_month: "%b %Y",
154
+ full: "%d %b %Y",
155
+ )
158
156
  end
159
157
  end
160
158
  end
@@ -34,15 +34,13 @@ module IsoDoc
34
34
  end
35
35
 
36
36
  def ddMMMyyyy(isodate)
37
- isodate.nil? and return nil
38
- arr = isodate.split("-")
39
- if arr.size == 1 && (/^\d+$/.match isodate)
40
- Date.new(*arr.map(&:to_i)).strftime("%Y")
41
- elsif arr.size == 2
42
- Date.new(*arr.map(&:to_i)).strftime("%b %Y")
43
- else
44
- Date.parse(isodate).strftime("%d %b %Y")
45
- end
37
+ IsoDoc::ExtendedDateFormatter.format_iso_date(
38
+ isodate,
39
+ lang: @lang,
40
+ year: "%Y",
41
+ year_month: "%b %Y",
42
+ full: "%d %b %Y",
43
+ )
46
44
  end
47
45
 
48
46
  def boilerplate(docxml)
@@ -27,6 +27,7 @@ module IsoDoc
27
27
  headings_cleanup(docxml)
28
28
  caption_cleanup(docxml)
29
29
  table_cleanup(docxml)
30
+ p_div_cleanup(docxml)
30
31
  style_cleanup(docxml)
31
32
  para_type_cleanup(docxml)
32
33
  docxml
@@ -131,18 +131,26 @@ module IsoDoc
131
131
  def note_style_cleanup1(multi, div, seq)
132
132
  div.xpath(".//p[@class = 'Note' or not(@class)]")
133
133
  .each_with_index do |p, i|
134
- p["class"] =
135
- i.zero? && multi ? "IEEEStdsMultipleNotes" : "IEEEStdsSingleNote"
136
- if multi
137
- p["style"] ||= ""
138
- p["style"] += "mso-list:l17 level1 lfo#{seq};"
139
- end
134
+ p["class"] =
135
+ i.zero? && multi ? "IEEEStdsMultipleNotes" : "IEEEStdsSingleNote"
136
+ if multi
137
+ p["style"] ||= ""
138
+ p["style"] += "mso-list:l17 level1 lfo#{seq};"
139
+ end
140
140
  end
141
141
  end
142
142
 
143
143
  # override indent via <div class="ListContLevel-n">
144
144
  def list_add(xlist, lvl); end
145
145
 
146
+ def p_div_cleanup(docxml)
147
+ docxml.xpath("//p[div]").each do |p|
148
+ p.xpath("./div").reverse_each do |div|
149
+ p.next = div
150
+ end
151
+ end
152
+ end
153
+
146
154
  private
147
155
 
148
156
  def split_para_at_breaks(para)
@@ -175,8 +175,7 @@ module IsoDoc
175
175
  end
176
176
 
177
177
  def termnote_parse(node, out)
178
- name = node.at(ns("./fmt-name"))
179
- para = node.at(ns("./p"))
178
+ name, para = termnote_parse_prep(node)
180
179
  out.div **note_attrs(node) do |div|
181
180
  div.p do |p|
182
181
  name and termnote_label(p, name)
@@ -186,6 +185,12 @@ module IsoDoc
186
185
  end
187
186
  end
188
187
 
188
+ def termnote_parse_prep(node)
189
+ name = node.at(ns("./fmt-name"))
190
+ para = node.at(ns("./p"))
191
+ [name, para]
192
+ end
193
+
189
194
  def termnote_label(para, name)
190
195
  para.span class: "note_label" do |s|
191
196
  name.children.each { |n| parse(n, s) }
@@ -95,6 +95,20 @@ module IsoDoc
95
95
  end
96
96
  end
97
97
 
98
+ # Whitepaper figure_parse1 emits caption-before-image, so the upstream
99
+ # wrap (img-before-caption) never fires. Wrap the trailing img so it
100
+ # carries Body Text + Centered. https://github.com/metanorma/metanorma-ieee/issues/739
101
+ def word_image_caption(docxml)
102
+ super
103
+ docxml.xpath("//p[@class = 'FigureTitle' or @class = 'SourceTitle']")
104
+ .each do |t|
105
+ n = t.next_element
106
+ n&.name == "img" or next
107
+ n.swap("<p class='figure' style='text-align:center;'>" \
108
+ "#{n.to_xml}</p>")
109
+ end
110
+ end
111
+
98
112
  def authority_cleanup(docxml)
99
113
  %w(copyright disclaimers tm participants).each do |t|
100
114
  authority_cleanup1(docxml, t)
@@ -114,7 +114,7 @@ module Metanorma
114
114
  # Style Manual 11.3
115
115
  def title_validate_type(xml)
116
116
  title = xml.at("//bibdata/title") or return
117
- draft = xml.at("//bibdata//draft")
117
+ draft = xml.at("//bibdata//version")
118
118
  trial = xml.at("//bibdata/ext/trial-use[text() = 'true']")
119
119
  target = draft ? "Draft " : ""
120
120
  target += trial ? "Trial-Use " : ""
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ieee
3
- VERSION = "1.6.9".freeze
3
+ VERSION = "1.6.10".freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
27
27
 
28
- spec.add_dependency "metanorma-standoc", "~> 3.4.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 3.4.2"
29
29
  spec.add_dependency "mnconvert", "~> 1.20"
30
30
  spec.add_dependency "pubid"
31
31
 
@@ -42,5 +42,5 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "simplecov", "~> 0.15"
43
43
  spec.add_development_dependency "timecop", "~> 0.9"
44
44
  spec.add_development_dependency "webmock"
45
- spec.add_development_dependency "canon", "= 0.2.3"
45
+ spec.add_development_dependency "canon" # , "= 0.2.3"
46
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-27 00:00:00.000000000 Z
11
+ date: 2026-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.4.0
19
+ version: 3.4.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.0
26
+ version: 3.4.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -238,16 +238,16 @@ dependencies:
238
238
  name: canon
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - '='
241
+ - - ">="
242
242
  - !ruby/object:Gem::Version
243
- version: 0.2.3
243
+ version: '0'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - '='
248
+ - - ">="
249
249
  - !ruby/object:Gem::Version
250
- version: 0.2.3
250
+ version: '0'
251
251
  description: 'Metanorma for the ITU.
252
252
 
253
253
  '