isodoc 2.5.5 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6ca47f20afd4ccef8c44ce28bfca11c4803f9aa8988e950cf1842dc251dc855
4
- data.tar.gz: 9f2ca8a82bb0528e05f8a6cc631cfad987c0fe8d819937af79580a119955a921
3
+ metadata.gz: 7c7354811120c945f0a478b34503c89e841a49a8cffc6655e0be43f5b565ad35
4
+ data.tar.gz: 0f9dae634d16cbf5521eb048cbf4ff6de3d2e9d48d2284322183f598df7fc19b
5
5
  SHA512:
6
- metadata.gz: 10170334bf2d0bbf492237695054a1a164c8c7f056a8cec5d782cd468f4a367524fc9dc841fccf4c3f7c90038af32d83e962d5cf224d66e5f7d05323b1b65083
7
- data.tar.gz: 9fc62b5c28d0baff4b369f15f8811a6be8b0bd85e1b63db6a9b36017e9a84a276c9df3034c679c0bd11ecbca0d5f7056bd2aa1627873a561be29b67f5619db9a
6
+ metadata.gz: 98e9b5625dfe9ab222ba00b03b02216e9f3ee00affa6e655c58be6acbeedb8bb05663b7d6832fbc94a76a8da02bc732a9f1b2c309532e968089990b1f50fe6ba
7
+ data.tar.gz: 756d64e9edbf24c6ba0ae909421e0a7c0a7f916fff8b5f6622d5792c9952728f05c8d2854888a559d3c6b36aa4a54d394ce7cfeded705fc168c0293240ea04b9
@@ -140,6 +140,7 @@ module IsoDoc
140
140
  def ol(docxml)
141
141
  docxml.xpath(ns("//ol")).each { |f| ol1(f) }
142
142
  @xrefs.list_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
143
+ docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
143
144
  end
144
145
 
145
146
  # We don't really want users to specify type of ordered list;
@@ -157,6 +158,13 @@ module IsoDoc
157
158
 
158
159
  def ol1(elem)
159
160
  elem["type"] ||= ol_depth(elem).to_s
161
+ elem.xpath(ns("./li")).each do |li|
162
+ li["id"] ||= "_#{UUIDTools::UUID.random_create}"
163
+ end
164
+ end
165
+
166
+ def ol_label(elem)
167
+ elem["label"] = @xrefs.anchor(elem["id"], :label, false)
160
168
  end
161
169
 
162
170
  def requirement_render_preprocessing(docxml); end
@@ -89,6 +89,17 @@ module IsoDoc
89
89
  end
90
90
  end
91
91
 
92
+ def date(docxml)
93
+ (docxml.xpath(ns("//date")) -
94
+ docxml.xpath(ns("//bibdata/date | //bibitem//date"))).each do |d|
95
+ date1(d)
96
+ end
97
+ end
98
+
99
+ def date1(elem)
100
+ elem.replace(@i18n.date(elem["value"], elem["format"].strip))
101
+ end
102
+
92
103
  private
93
104
 
94
105
  def found_matching_variant_sibling(node)
@@ -6,8 +6,8 @@ module IsoDoc
6
6
  end
7
7
 
8
8
  def anchor_value(id)
9
- @xrefs.anchor(id, :value) || @xrefs.anchor(id, :label) ||
10
- @xrefs.anchor(id, :xref)
9
+ @xrefs.anchor(id, :bare_xref) || @xrefs.anchor(id, :value) ||
10
+ @xrefs.anchor(id, :label) || @xrefs.anchor(id, :xref)
11
11
  end
12
12
 
13
13
  def anchor_linkend(node, linkend)
@@ -85,6 +85,7 @@ module IsoDoc
85
85
  mathml docxml
86
86
  variant docxml
87
87
  identifier docxml
88
+ date docxml
88
89
  end
89
90
 
90
91
  def terms(docxml)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.5.5".freeze
2
+ VERSION = "2.5.6".freeze
3
3
  end
@@ -107,6 +107,13 @@ module IsoDoc
107
107
  end
108
108
 
109
109
  def increment_letter
110
+ clock_letter
111
+ @letter = (@letter.ord + 1).chr.to_s
112
+ @skip_i && %w(i I).include?(@letter) and
113
+ @letter = (@letter.ord + 1).chr.to_s
114
+ end
115
+
116
+ def clock_letter
110
117
  case @letter
111
118
  when "Z"
112
119
  @letter = "@"
@@ -115,9 +122,6 @@ module IsoDoc
115
122
  @letter = "`"
116
123
  @base = string_inc(@base, "a")
117
124
  end
118
- @letter = (@letter.ord + 1).chr.to_s
119
- @skip_i && %w(i I).include?(@letter) and
120
- @letter = (@letter.ord + 1).chr.to_s
121
125
  end
122
126
 
123
127
  def blank?(str)
@@ -171,18 +171,27 @@ module IsoDoc
171
171
  refer_list)
172
172
  c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
173
173
  list.xpath(ns("./li")).each do |li|
174
- label = c.increment(li).listlabel(list, depth)
175
- label = list_item_anchor_label(label, list_anchor, prev_label,
176
- refer_list)
174
+ bare_label, label =
175
+ list_item_value(li, c, depth, { list_anchor: list_anchor, prev_label: prev_label,
176
+ refer_list: refer_list })
177
177
  li["id"] and @anchors[li["id"]] =
178
- { xref: "#{label})", type: "listitem", refer_list:
179
- refer_list, container: list_anchor[:container] }
178
+ { label: bare_label, bare_xref: "#{label})",
179
+ xref: "#{label})",
180
+ type: "listitem", refer_list: refer_list,
181
+ container: list_anchor[:container] }
180
182
  (li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
181
183
  list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
182
184
  end
183
185
  end
184
186
  end
185
187
 
188
+ def list_item_value(entry, counter, depth, opts)
189
+ label = counter.increment(entry).listlabel(entry.parent, depth)
190
+ [label,
191
+ list_item_anchor_label(label, opts[:list_anchor], opts[:prev_label],
192
+ opts[:refer_list])]
193
+ end
194
+
186
195
  def list_item_anchor_label(label, list_anchor, prev_label, refer_list)
187
196
  prev_label.empty? or
188
197
  label = @i18n.list_nested_xref.sub(/%1/, "#{prev_label})")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-22 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html2doc