metanorma-ieee 1.5.5 → 1.5.6

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"]
@@ -87,32 +87,43 @@ module IsoDoc
87
87
  docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
88
88
  end
89
89
 
90
- def ol_numbering(docxml)
91
- p = "//clause | //annex | //foreword | //acknowledgements | " \
90
+ def ol_numbering_containers
91
+ "//clause | //annex | //foreword | //acknowledgements | " \
92
92
  "//introduction | //preface/abstract | //appendix | //terms | " \
93
93
  "//term | //definitions | //references | //colophon"
94
- docxml.xpath(ns(p)).each do |c|
94
+ end
95
+
96
+ def ol_numbering(docxml)
97
+ docxml.xpath(ns(ol_numbering_containers)).each do |c|
98
+ i = -1
95
99
  (c.xpath(ns(".//ol")) -
96
100
  c.xpath(ns("./clause//ol | ./appendix//ol | ./term//ol | " \
97
101
  "./terms//ol | ./definitions//ol | " \
98
- "/references//ol | ./colophon//ol")))
99
- .each_with_index do |o, i|
102
+ "/references//ol | ./colophon//ol"))).each do |o|
103
+ (o.ancestors("ol").size + o.ancestors("ul").size).zero? and
104
+ i += 1 # ol root list
100
105
  ol_numbering1(o, i)
101
106
  end
102
107
  end
103
108
  end
104
109
 
105
110
  def ol_numbering1(elem, idx)
106
- elem["type"] = ol_depth_rotate(elem, idx).to_s
111
+ ancestors = elem.ancestors.map(&:name).reverse
112
+ ul_loc = ancestors.index("ul")
113
+ ol_loc = ancestors.index("ol")
114
+ # is this a ul//ol list? if so, ignore idx of list in labelling
115
+ ul_root = ul_loc && (!ol_loc || ul_loc < ol_loc)
116
+ elem["type"] = ol_depth_rotate(elem, ul_root ? 0 : idx).to_s
107
117
  end
108
118
 
109
119
  # overrides IsoDoc:: XrefGen::OlTypeProvider: we trigger
110
120
  # @xrefs.list_anchor_names after this is called, with elem["type"] set
121
+ # use the order of the ol in the clause to rotate the labelling
111
122
  def ol_depth_rotate(node, idx)
112
- depth = node.ancestors("ol").size + idx
123
+ depth = node.ancestors("ol").size + node.ancestors("ul").size + idx
113
124
  type = :alphabet
114
- type = :arabic if [2, 5, 8].include? depth
115
- type = :roman if [3, 6, 9].include? depth
125
+ type = :arabic if [1, 4, 7].include? depth
126
+ type = :roman if [2, 5, 8].include? depth
116
127
  type
117
128
  end
118
129
 
@@ -125,17 +136,6 @@ module IsoDoc
125
136
  end
126
137
  end
127
138
 
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
139
  def middle_title_template
140
140
  <<~OUTPUT
141
141
  <p class='zzSTDTitle1'>{{ full_doctitle -}}
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ieee
3
- VERSION = "1.5.5".freeze
3
+ VERSION = "1.5.6".freeze
4
4
  end
5
5
  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.6
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-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc