metanorma-ieee 1.5.5 → 1.5.7

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.
@@ -22,8 +22,8 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def bibrenderer
25
- ::Relaton::Render::Ieee::General.new(language: @lang,
26
- i18nhash: @i18n.get)
25
+ ::Relaton::Render::Ieee::General
26
+ .new(language: @lang, script: @script, i18nhash: @i18n.get)
27
27
  end
28
28
 
29
29
  def fileloc(loc)
@@ -53,7 +53,7 @@ module IsoDoc
53
53
  node["style"] == "no-biblio-tag" or tag = bib[:ord]
54
54
  if !c1.empty?
55
55
  c2.each(&:remove)
56
- c1.map(&:to_xml).join
56
+ [c1.map(&:to_xml).join, tag].compact.join(" ")
57
57
  elsif node.at(ns("./location"))
58
58
  linkend
59
59
  elsif node["citeas"] == bib[:ord] then node["citeas"]
@@ -81,38 +81,48 @@ module IsoDoc
81
81
  warn "Failure to convert MathML to LaTeX\n#{node.parent.to_xml}\n#{e}"
82
82
  end
83
83
 
84
- def ol(docxml)
85
- ol_numbering(docxml)
86
- @xrefs.list_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
87
- docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
88
- end
84
+ #def ol(docxml)
85
+ #ol_prep(docxml)
86
+ # docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
87
+ #end
89
88
 
90
- def ol_numbering(docxml)
91
- p = "//clause | //annex | //foreword | //acknowledgements | " \
89
+ def ol_numbering_containers
90
+ "//clause | //annex | //foreword | //acknowledgements | " \
92
91
  "//introduction | //preface/abstract | //appendix | //terms | " \
93
92
  "//term | //definitions | //references | //colophon"
94
- docxml.xpath(ns(p)).each do |c|
93
+ end
94
+
95
+ def ol_numbering(docxml)
96
+ docxml.xpath(ns(ol_numbering_containers)).each do |c|
97
+ i = -1
95
98
  (c.xpath(ns(".//ol")) -
96
99
  c.xpath(ns("./clause//ol | ./appendix//ol | ./term//ol | " \
97
100
  "./terms//ol | ./definitions//ol | " \
98
- "/references//ol | ./colophon//ol")))
99
- .each_with_index do |o, i|
101
+ "/references//ol | ./colophon//ol"))).each do |o|
102
+ (o.ancestors("ol").size + o.ancestors("ul").size).zero? and
103
+ i += 1 # ol root list
100
104
  ol_numbering1(o, i)
101
105
  end
102
106
  end
103
107
  end
104
108
 
105
109
  def ol_numbering1(elem, idx)
106
- elem["type"] = ol_depth_rotate(elem, idx).to_s
110
+ ancestors = elem.ancestors.map(&:name).reverse
111
+ ul_loc = ancestors.index("ul")
112
+ ol_loc = ancestors.index("ol")
113
+ # is this a ul//ol list? if so, ignore idx of list in labelling
114
+ ul_root = ul_loc && (!ol_loc || ul_loc < ol_loc)
115
+ elem["type"] = ol_depth_rotate(elem, ul_root ? 0 : idx).to_s
107
116
  end
108
117
 
109
118
  # overrides IsoDoc:: XrefGen::OlTypeProvider: we trigger
110
119
  # @xrefs.list_anchor_names after this is called, with elem["type"] set
120
+ # use the order of the ol in the clause to rotate the labelling
111
121
  def ol_depth_rotate(node, idx)
112
- depth = node.ancestors("ol").size + idx
122
+ depth = node.ancestors("ol").size + node.ancestors("ul").size + idx
113
123
  type = :alphabet
114
- type = :arabic if [2, 5, 8].include? depth
115
- type = :roman if [3, 6, 9].include? depth
124
+ type = :arabic if [1, 4, 7].include? depth
125
+ type = :roman if [2, 5, 8].include? depth
116
126
  type
117
127
  end
118
128
 
@@ -125,17 +135,6 @@ module IsoDoc
125
135
  end
126
136
  end
127
137
 
128
- # KILL
129
- def middle_title_body
130
- ret = "<p class='zzSTDTitle1'>#{@meta.get[:full_doctitle]}"
131
- @meta.get[:amd] || @meta.get[:corr] and ret += "<br/>"
132
- @meta.get[:amd] and ret += "Amendment #{@meta.get[:amd]}"
133
- @meta.get[:amd] && @meta.get[:corr] and ret += " "
134
- @meta.get[:corr] and ret += "Corrigenda #{@meta.get[:corr]}"
135
- ret += "</p>"
136
- ret
137
- end
138
-
139
138
  def middle_title_template
140
139
  <<~OUTPUT
141
140
  <p class='zzSTDTitle1'>{{ full_doctitle -}}
@@ -173,6 +173,7 @@ module IsoDoc
173
173
  end
174
174
 
175
175
  def abstract_header(dest)
176
+ dest.elements.empty? and return
176
177
  dest.elements.first.add_first_child <<~XML
177
178
  <span class='IEEEStdsAbstractHeader'><span lang='EN-US'>Abstract:</span></span>
178
179
  XML
@@ -869,7 +869,7 @@ depending on whether the items exist as independent documents, or are parts of a
869
869
  </zeroOrMore>
870
870
  </element>
871
871
  </define>
872
- <define name="BibItemType" combine="choice">
872
+ <define name="BibItemType">
873
873
  <a:documentation>Type of bibliographic item.
874
874
  The value list complies with the types provided in ISO 690:2021.
875
875
  NOTE: These values represent a strict superset to BibTeX
@@ -147,21 +147,9 @@ module Metanorma
147
147
 
148
148
  def bibitem_cleanup(xmldoc)
149
149
  super
150
- supply_designations(xmldoc)
151
150
  supply_withdrawn_notes(xmldoc)
152
151
  end
153
152
 
154
- # force existence of a designation for standards
155
- def supply_designations(xmldoc)
156
- xmldoc.xpath("//references/bibitem[@type = 'standard']").each do |b|
157
- b.at("./docidentifier[not(@type = 'metanorma' or @type = 'DOI' or " \
158
- "@type = 'metanorma-ordinal')]") and next
159
- t = b.at("./title") or next
160
- b.at("./title[last()]").next =
161
- "<docidentifier type='title' primary='true'>#{t.text}</docidentifier>"
162
- end
163
- end
164
-
165
153
  def supply_withdrawn_notes(xmldoc)
166
154
  f = File.join(File.dirname(__FILE__), "ieee-footnotes.yaml")
167
155
  @provenance_notes = YAML.safe_load(File.read(f))
@@ -178,9 +166,8 @@ module Metanorma
178
166
  .map(&:text)
179
167
  end
180
168
 
181
- def reference_names(xmldoc)
182
- #require "debug"; binding.b
183
- super
169
+ def empty_docid_to_title?(bibitem)
170
+ bibitem["type"] == "standard"
184
171
  end
185
172
  end
186
173
  end
@@ -311,17 +311,28 @@ and is intended to be referenced by a callout within the source code</a:document
311
311
  </ref>
312
312
  </optional>
313
313
  <choice>
314
- <a:documentation>Content of the figure</a:documentation>
315
- <ref name="image"/>
314
+ <a:documentation>Content of the figure </a:documentation>
315
+ <ref name="image">
316
+ <a:documentation>by default the content of a figure is a media file</a:documentation>
317
+ </ref>
316
318
  <ref name="video"/>
317
319
  <ref name="audio"/>
318
- <ref name="pre"/>
320
+ <ref name="pre">
321
+ <a:documentation>figures can contain ASCII art</a:documentation>
322
+ </ref>
319
323
  <oneOrMore>
320
- <ref name="paragraph-with-footnote"/>
324
+ <ref name="paragraph-with-footnote">
325
+ <a:documentation>figures can contain discursive art</a:documentation>
326
+ </ref>
321
327
  </oneOrMore>
322
328
  <zeroOrMore>
323
- <ref name="figure"/>
329
+ <ref name="figure">
330
+ <a:documentation>subfigures, nested directly within a figure</a:documentation>
331
+ </ref>
324
332
  </zeroOrMore>
333
+ <ref name="table">
334
+ <a:documentation>Table is understood in this context to be a tabular arrangement of subfigures</a:documentation>
335
+ </ref>
325
336
  </choice>
326
337
  <zeroOrMore>
327
338
  <ref name="fn">
@@ -354,17 +365,28 @@ and is intended to be referenced by a callout within the source code</a:document
354
365
  </ref>
355
366
  </optional>
356
367
  <choice>
357
- <a:documentation>Content of the figure</a:documentation>
358
- <ref name="image-no-id"/>
368
+ <a:documentation>Content of the figure </a:documentation>
369
+ <ref name="image-no-id">
370
+ <a:documentation>by default the content of a figure is a media file</a:documentation>
371
+ </ref>
359
372
  <ref name="video-no-id"/>
360
373
  <ref name="audio-no-id"/>
361
- <ref name="pre-no-id"/>
374
+ <ref name="pre-no-id">
375
+ <a:documentation>figures can contain ASCII art</a:documentation>
376
+ </ref>
362
377
  <oneOrMore>
363
- <ref name="paragraph-with-footnote-no-id"/>
378
+ <ref name="paragraph-with-footnote-no-id">
379
+ <a:documentation>figures can contain discursive art</a:documentation>
380
+ </ref>
364
381
  </oneOrMore>
365
382
  <zeroOrMore>
366
- <ref name="figure-no-id"/>
383
+ <ref name="figure-no-id">
384
+ <a:documentation>subfigures, nested directly within a figure</a:documentation>
385
+ </ref>
367
386
  </zeroOrMore>
387
+ <ref name="table-no-id">
388
+ <a:documentation>Table is understood in this context to be a tabular arrangement of subfigures</a:documentation>
389
+ </ref>
368
390
  </choice>
369
391
  <zeroOrMore>
370
392
  <ref name="fn">
@@ -876,6 +898,9 @@ titlecase, or lowercase</a:documentation>
876
898
  <data type="boolean"/>
877
899
  </attribute>
878
900
  </optional>
901
+ <ref name="LocalizedStringAttributes">
902
+ <a:documentation>Specify language of bibitem, can be used to render it with language-specific bibliographic style</a:documentation>
903
+ </ref>
879
904
  <ref name="ReducedBibliographicItem"/>
880
905
  </element>
881
906
  </define>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ieee
3
- VERSION = "1.5.5".freeze
3
+ VERSION = "1.5.7".freeze
4
4
  end
5
5
  end
@@ -41,5 +41,5 @@ spec.add_development_dependency "rubocop-performance"
41
41
  spec.add_development_dependency "simplecov", "~> 0.15"
42
42
  spec.add_development_dependency "timecop", "~> 0.9"
43
43
  spec.add_development_dependency "webmock"
44
- spec.add_development_dependency "canon"
44
+ spec.add_development_dependency "canon", "= 0.1.3"
45
45
  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.5.5
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-15 00:00:00.000000000 Z
11
+ date: 2025-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -224,16 +224,16 @@ dependencies:
224
224
  name: canon
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - ">="
227
+ - - '='
228
228
  - !ruby/object:Gem::Version
229
- version: '0'
229
+ version: 0.1.3
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">="
234
+ - - '='
235
235
  - !ruby/object:Gem::Version
236
- version: '0'
236
+ version: 0.1.3
237
237
  description: 'Metanorma for the ITU.
238
238
 
239
239
  '