isodoc 0.9.23 → 0.10.0

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: 20dbfc64f7e410c4f6bf45d258e8d96be1cc0937203fdd7615e8fa41b38991a8
4
- data.tar.gz: e24800713e0e575c04caae609024007aef26d398a805dbfada61876a013a4208
3
+ metadata.gz: 01ea09cdb8f862493ac3faba65edeed830efbea957055ca689fc61e2d878e20f
4
+ data.tar.gz: b523e1a7821627a7ad098a1b777dfec1c63c5c46b3d263d05a9f1c67bfdf1405
5
5
  SHA512:
6
- metadata.gz: a91d1ae2d6816fa2b9b499b56b8990bf609853941fe5fd14b6e9d262596096417f1e24c0e4596f81a637a4192c9fe7c2aea4430dad804a14fa9b556cd18dcac1
7
- data.tar.gz: 50603622fbf203a4d2d66ecd1f8028f1abb04e5c925770cce6f96fc4a144ed014766a4a57729f3ec912a89156d37277fb31c4a004e804fa49bd0e6abc6194862
6
+ metadata.gz: de9f3a9943ae506820164db1d009fa6541320879a8e9921c4509a94789a64b0568ce5211a1e6e9e02a861024a2bd733b34fca2fc1acca0c7ae4af34618d6878f
7
+ data.tar.gz: a698d0d759b6dd3b26ed9d325fdd894a244dd1130cd54a5dac1b216ff1bb0bb4f9719af8c0135f2d93f1e932eca5248a7adbad5ddb305109ed52297b0b450c47
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
3
  language: ruby
2
4
  cache: bundler
3
5
  os:
@@ -6,11 +8,11 @@ os:
6
8
  rvm:
7
9
  - 2.5
8
10
  - 2.4
9
- - 2.3
10
11
  - ruby-head
11
- before_install:
12
+ before_install:
12
13
  - nvm install 8
13
14
  - npm install -g puppeteer
15
+ - npm install
14
16
  - gem install bundler -v 2.0.1
15
17
  - bundle update
16
18
  matrix:
data/Gemfile.lock CHANGED
@@ -1,32 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isodoc (0.9.23)
4
+ isodoc (0.10.0)
5
5
  asciimath
6
- html2doc (~> 0.8.6)
6
+ html2doc (~> 0.8.11)
7
7
  htmlentities (~> 4.3.4)
8
8
  liquid
9
9
  metanorma (~> 0.3.0)
10
10
  nokogiri (>= 1)
11
11
  rake (~> 12.0)
12
12
  roman-numerals
13
- sassc (~> 1.12.1)
13
+ sassc (~> 2)
14
14
  thread_safe
15
15
  uuidtools
16
16
 
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- asciidoctor (2.0.9)
20
+ asciidoctor (2.0.10)
21
21
  asciimath (1.0.8)
22
22
  ast (2.4.0)
23
23
  byebug (9.1.0)
24
24
  coderay (1.1.2)
25
25
  diff-lcs (1.3)
26
- docile (1.3.1)
26
+ docile (1.3.2)
27
27
  equivalent-xml (0.6.0)
28
28
  nokogiri (>= 1.4.3)
29
- ffi (1.9.25)
29
+ ffi (1.11.1)
30
30
  formatador (0.2.5)
31
31
  guard (2.15.0)
32
32
  formatador (>= 0.2.4)
@@ -42,7 +42,7 @@ GEM
42
42
  guard (~> 2.1)
43
43
  guard-compat (~> 1.1)
44
44
  rspec (>= 2.99.0, < 4.0)
45
- html2doc (0.8.10)
45
+ html2doc (0.8.11)
46
46
  asciimath (~> 1.0.7)
47
47
  htmlentities (~> 4.3.4)
48
48
  image_size
@@ -51,7 +51,7 @@ GEM
51
51
  thread_safe
52
52
  uuidtools
53
53
  htmlentities (4.3.4)
54
- image_size (2.0.0)
54
+ image_size (2.0.1)
55
55
  json (2.2.0)
56
56
  liquid (4.0.3)
57
57
  listen (3.1.5)
@@ -90,15 +90,15 @@ GEM
90
90
  rspec-core (~> 3.8.0)
91
91
  rspec-expectations (~> 3.8.0)
92
92
  rspec-mocks (~> 3.8.0)
93
- rspec-core (3.8.0)
93
+ rspec-core (3.8.1)
94
94
  rspec-support (~> 3.8.0)
95
- rspec-expectations (3.8.3)
95
+ rspec-expectations (3.8.4)
96
96
  diff-lcs (>= 1.2.0, < 2.0)
97
97
  rspec-support (~> 3.8.0)
98
- rspec-mocks (3.8.0)
98
+ rspec-mocks (3.8.1)
99
99
  diff-lcs (>= 1.2.0, < 2.0)
100
100
  rspec-support (~> 3.8.0)
101
- rspec-support (3.8.0)
101
+ rspec-support (3.8.2)
102
102
  rubocop (0.54.0)
103
103
  parallel (~> 1.10)
104
104
  parser (>= 2.5)
@@ -106,16 +106,11 @@ GEM
106
106
  rainbow (>= 2.2.2, < 4.0)
107
107
  ruby-progressbar (~> 1.7)
108
108
  unicode-display_width (~> 1.0, >= 1.0.1)
109
- ruby-progressbar (1.10.0)
109
+ ruby-progressbar (1.10.1)
110
110
  ruby_dep (1.5.0)
111
- sass (3.7.4)
112
- sass-listen (~> 4.0.0)
113
- sass-listen (4.0.0)
114
- rb-fsevent (~> 0.9, >= 0.9.4)
115
- rb-inotify (~> 0.9, >= 0.9.7)
116
- sassc (1.12.1)
117
- ffi (~> 1.9.6)
118
- sass (>= 3.3.0)
111
+ sassc (2.0.1)
112
+ ffi (~> 1.9)
113
+ rake
119
114
  shellany (0.0.1)
120
115
  simplecov (0.16.1)
121
116
  docile (~> 1.1)
@@ -125,7 +120,7 @@ GEM
125
120
  thor (0.20.3)
126
121
  thread_safe (0.3.6)
127
122
  timecop (0.9.1)
128
- unicode-display_width (1.5.0)
123
+ unicode-display_width (1.6.0)
129
124
  uuidtools (2.1.5)
130
125
 
131
126
  PLATFORMS
data/appveyor.yml CHANGED
@@ -1,10 +1,14 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
3
  version: '{build}'
2
4
 
5
+ cache:
6
+ - vendor/bundle
7
+
3
8
  environment:
4
9
  matrix:
5
10
  - RUBY_VERSION: 25
6
11
  - RUBY_VERSION: 24
7
- - RUBY_VERSION: 23
8
12
  - RUBY_VERSION: _trunk
9
13
 
10
14
  matrix:
@@ -17,6 +21,8 @@ install:
17
21
 
18
22
  build_script:
19
23
  - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
24
+ - set GIT_TERMINAL_PROMPT=0
25
+ - bundle config --local path vendor/bundle
20
26
  - bundle update
21
27
  - bundle install
22
28
 
@@ -27,4 +33,3 @@ before_test:
27
33
 
28
34
  test_script:
29
35
  - bundle exec rake
30
-
data/isodoc.gemspec CHANGED
@@ -26,17 +26,17 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.files = `git ls-files`.split("\n")
28
28
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
29
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
29
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
30
 
31
31
  spec.add_dependency "asciimath"
32
32
  spec.add_dependency "htmlentities", "~> 4.3.4"
33
33
  spec.add_dependency "nokogiri", ">= 1"
34
34
  spec.add_dependency "thread_safe"
35
35
  spec.add_dependency "uuidtools"
36
- spec.add_dependency "html2doc", "~> 0.8.6"
36
+ spec.add_dependency "html2doc", "~> 0.8.11"
37
37
  spec.add_dependency "liquid"
38
38
  spec.add_dependency "roman-numerals"
39
- spec.add_dependency "sassc", "~> 1.12.1"
39
+ spec.add_dependency "sassc", "~> 2"
40
40
  spec.add_dependency "metanorma", "~> 0.3.0"
41
41
  spec.add_dependency "rake", "~> 12.0"
42
42
 
@@ -44,11 +44,16 @@ module IsoDoc::Function
44
44
  def figure_name_parse(node, div, name)
45
45
  return if name.nil? && node.at(ns("./figure"))
46
46
  div.p **{ class: "FigureTitle", align: "center" } do |p|
47
- p << l10n("#{@figure_lbl} #{get_anchors[node['id']][:label]}")
48
- if name
47
+ lbl = anchor(node['id'], :label, false)
48
+ lbl.nil? or p << l10n("#{@figure_lbl} #{lbl}")
49
+ name and !lbl.nil? and p << "&nbsp;&mdash; "
50
+ =begin
51
+ get_anchors[node['id']][:label].nil? or
52
+ p << l10n("#{@figure_lbl} #{get_anchors[node['id']][:label]}")
53
+ name and !get_anchors[node['id']][:label].nil? and
49
54
  p << "&nbsp;&mdash; "
50
- name.children.each { |n| parse(n, div) }
51
- end
55
+ =end
56
+ name and name.children.each { |n| parse(n, div) }
52
57
  end
53
58
  end
54
59
 
@@ -73,7 +78,7 @@ module IsoDoc::Function
73
78
 
74
79
  def example_label(node)
75
80
  n = get_anchors[node["id"]]
76
- return @example_lbl if n.nil? || n[:label].empty?
81
+ return @example_lbl if n.nil? || n[:label].nil? || n[:label].empty?
77
82
  l10n("#{@example_lbl} #{n[:label]}")
78
83
  end
79
84
 
@@ -118,7 +123,7 @@ module IsoDoc::Function
118
123
 
119
124
  def sourcecode_name_parse(_node, div, name)
120
125
  div.p **{ class: "SourceTitle", align: "center" } do |p|
121
- name.children.each { |n| parse(n, p) }
126
+ name.children.each { |n| parse(n, p) }
122
127
  end
123
128
  end
124
129
 
@@ -187,8 +192,13 @@ module IsoDoc::Function
187
192
  out.div **attr_code(id: node["id"], class: "formula") do |div|
188
193
  div.p do |p|
189
194
  parse(node.at(ns("./stem")), div)
190
- insert_tab(div, 1)
191
- div << "(#{get_anchors[node['id']][:label]})"
195
+ lbl = anchor(node['id'], :label, false)
196
+ #unless get_anchors[node['id']][:label].nil?
197
+ unless lbl.nil?
198
+ insert_tab(div, 1)
199
+ #div << "(#{get_anchors[node['id']][:label]})"
200
+ div << "(#{lbl})"
201
+ end
192
202
  end
193
203
  end
194
204
  end
@@ -266,7 +276,10 @@ module IsoDoc::Function
266
276
  label = node.at(ns("./label"))
267
277
  title = node.at(ns("./title"))
268
278
  out.p **{ class: "AdmonitionTitle" } do |b|
269
- b << l10n("#{type} #{get_anchors[node['id']][:label]}:")
279
+ lbl = anchor(node['id'], :label, false)
280
+ lbl.nil? or b << l10n("#{type} #{lbl}:")
281
+ #get_anchors[node['id']][:label].nil? or
282
+ #b << l10n("#{type} #{get_anchors[node['id']][:label]}:")
270
283
  if label || title
271
284
  b.br
272
285
  label and label.children.each { |n| parse(n,b) }
@@ -23,20 +23,25 @@ module IsoDoc::Function
23
23
  end
24
24
 
25
25
  def prefix_container(container, linkend, _target)
26
- l10n(get_anchors[container][:xref] + ", " + linkend)
26
+ #l10n(get_anchors[container][:xref] + ", " + linkend)
27
+ l10n(anchor(container, :xref) + ", " + linkend)
27
28
  end
28
29
 
29
30
  def anchor_linkend(node, linkend)
30
- if node["citeas"].nil? && node["bibitemid"] &&
31
- get_anchors.has_key?(node["bibitemid"])
32
- return get_anchors.dig(node["bibitemid"] ,:xref)
33
- elsif node["target"] && get_anchors.has_key?(node["target"])
34
- linkend = get_anchors[node["target"]][:xref]
35
- container = get_anchors[node["target"]][:container]
31
+ if node["citeas"].nil? && node["bibitemid"] #&&
32
+ #get_anchors.has_key?(node["bibitemid"])
33
+ #return get_anchors.dig(node["bibitemid"] ,:xref)
34
+ return anchor(node["bibitemid"] ,:xref) || "???"
35
+ #elsif node["target"] && get_anchors.has_key?(node["target"])
36
+ elsif node["target"] && !/.#./.match(node["target"])
37
+ #linkend = get_anchors[node["target"]][:xref]
38
+ linkend = anchor(node["target"], :xref)
39
+ #container = get_anchors[node["target"]][:container]
40
+ container = anchor(node["target"], :container, false)
36
41
  (container && get_note_container_id(node) != container) &&
37
42
  linkend = prefix_container(container, linkend, node["target"])
38
43
  end
39
- linkend
44
+ linkend || "???"
40
45
  end
41
46
 
42
47
  def get_linkend(node)
@@ -200,7 +200,7 @@ module IsoDoc::Function
200
200
  prefix = ref.at(ns("./docidentifier/@type"))
201
201
  # return ref_names(ref) unless docid
202
202
  date = ref.at(ns("./date[@type = 'published']"))
203
- allparts = ref.at(ns("./allparts"))
203
+ allparts = ref.at(ns("./extent[@type='part'][referenceFrom='all']"))
204
204
  reference = format_ref(docid_l10n(docid.text), prefix&.text, isopub, date, allparts)
205
205
  @anchors[ref["id"]] = { xref: reference }
206
206
  end
@@ -8,8 +8,10 @@ module IsoDoc::Function
8
8
  title = c1&.content || ""
9
9
  out.span **{ class: "zzMoveToFollowing" } do |s|
10
10
  s.b do |b|
11
- if get_anchors[node['id']][:label] && !@suppressheadingnumbers
12
- b << "#{get_anchors[node['id']][:label]}#{clausedelim} "
11
+ #if get_anchors[node['id']][:label] && !@suppressheadingnumbers
12
+ if anchor(node['id'], :label, false) && !@suppressheadingnumbers
13
+ #b << "#{get_anchors[node['id']][:label]}#{clausedelim} "
14
+ b << "#{anchor(node['id'], :label)}#{clausedelim} "
13
15
  end
14
16
  b << "#{title} "
15
17
  end
@@ -20,8 +22,10 @@ module IsoDoc::Function
20
22
  if node["inline-header"] == "true"
21
23
  inline_header_title(out, node, c1)
22
24
  else
23
- div.send "h#{get_anchors[node['id']][:level]}" do |h|
24
- lbl = get_anchors[node['id']][:label]
25
+ #div.send "h#{get_anchors[node['id']][:level]}" do |h|
26
+ div.send "h#{anchor(node['id'], :level) || '1'}" do |h|
27
+ #lbl = get_anchors[node['id']][:label]
28
+ lbl = anchor(node['id'], :label, false)
25
29
  h << "#{lbl}#{clausedelim} " if lbl && !@suppressheadingnumbers
26
30
  c1&.children&.each { |c2| parse(c2, h) }
27
31
  end
@@ -56,7 +60,8 @@ module IsoDoc::Function
56
60
  def clause(isoxml, out)
57
61
  isoxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each do |c|
58
62
  out.div **attr_code(id: c["id"]) do |s|
59
- clause_name(get_anchors[c['id']][:label],
63
+ #clause_name(get_anchors[c['id']][:label],
64
+ clause_name(anchor(c['id'], :label),
60
65
  c&.at(ns("./title"))&.content, s, nil)
61
66
  c.elements.reject { |c1| c1.name == "title" }.each do |c1|
62
67
  parse(c1, s)
@@ -67,7 +72,8 @@ module IsoDoc::Function
67
72
 
68
73
  def annex_name(annex, name, div)
69
74
  div.h1 **{ class: "Annex" } do |t|
70
- t << "#{get_anchors[annex['id']][:label]}<br/><br/>"
75
+ #t << "#{get_anchors[annex['id']][:label]}<br/><br/>"
76
+ t << "#{anchor(annex['id'], :label)}<br/><br/>"
71
77
  t.b do |b|
72
78
  name&.children&.each { |c2| parse(c2, b) }
73
79
  end
@@ -121,7 +127,7 @@ module IsoDoc::Function
121
127
 
122
128
  def term_defs_boilerplate_cont(src, term)
123
129
  sources = sentence_join(src.map do |s|
124
- "<a href=##{s["bibitemid"]}>#{@anchors.dig(s["bibitemid"], :xref)}</a>"
130
+ "<a href=##{s["bibitemid"]}>#{anchor(s["bibitemid"], :xref)}</a>"
125
131
  end)
126
132
  if src.empty? then @internal_terms_boilerplate
127
133
  elsif term.nil? then external_terms_boilerplate(sources)
@@ -4,11 +4,16 @@ module IsoDoc::Function
4
4
  def table_title_parse(node, out)
5
5
  name = node.at(ns("./name"))
6
6
  out.p **{ class: "TableTitle", align: "center" } do |p|
7
- p << l10n("#{@table_lbl} #{get_anchors[node['id']][:label]}")
8
- if name
7
+ lbl = anchor(node['id'], :label, false)
8
+ lbl.nil? or p << l10n("#{@table_lbl} #{lbl}")
9
+ name and !lbl.nil? and p << l10n("&nbsp;&mdash; ")
10
+ =begin
11
+ get_anchors[node['id']][:label].nil? or
12
+ p << l10n("#{@table_lbl} #{get_anchors[node['id']][:label]}")
13
+ name and !get_anchors[node['id']][:label].nil? and
9
14
  p << l10n("&nbsp;&mdash; ")
10
- name.children.each { |n| parse(n, p) }
11
- end
15
+ =end
16
+ name and name.children.each { |n| parse(n, p) }
12
17
  end
13
18
  end
14
19
 
@@ -43,8 +43,9 @@ module IsoDoc::Function
43
43
  out.div **{ class: "Note" } do |div|
44
44
  first = node.first_element_child
45
45
  div.p do |p|
46
- anchor = get_anchors[node['id']]
47
- p << "#{anchor&.dig(:label) || '???'}: "
46
+ #anchor = get_anchors[node['id']]
47
+ #p << "#{anchor&.dig(:label) || '???'}: "
48
+ p << "#{anchor(node['id'], :label) || '???'}: "
48
49
  para_then_remainder(first, node, p, div)
49
50
  end
50
51
  end
@@ -9,6 +9,14 @@ module IsoDoc::Function
9
9
  @anchors
10
10
  end
11
11
 
12
+ def anchor(id, lbl, warning = true)
13
+ unless @anchors[id]
14
+ warning and warn "No label has been processed for ID #{id}"
15
+ return nil
16
+ end
17
+ @anchors.dig(id, lbl)
18
+ end
19
+
12
20
  def termnote_label(n)
13
21
  @termnote_lbl.gsub(/%/, n.to_s)
14
22
  end
@@ -20,7 +28,7 @@ module IsoDoc::Function
20
28
  @anchors[n["id"]] =
21
29
  { label: termnote_label(i + 1),
22
30
  type: "termnote",
23
- xref: l10n("#{@anchors.dig(t['id'], :xref)}, "\
31
+ xref: l10n("#{anchor(t['id'], :xref)}, "\
24
32
  "#{@note_xref_lbl} #{i + 1}") }
25
33
  end
26
34
  end
@@ -34,7 +42,7 @@ module IsoDoc::Function
34
42
  idx = examples.size == 1 ? "" : (i + 1).to_s
35
43
  @anchors[n["id"]] = {
36
44
  type: "termexample",
37
- label: idx, xref: l10n("#{@anchors.dig(t['id'], :xref)}, "\
45
+ label: idx, xref: l10n("#{anchor(t['id'], :xref)}, "\
38
46
  "#{@note_xref_lbl} #{i + 1}") }
39
47
  end
40
48
  end
@@ -57,7 +65,7 @@ module IsoDoc::Function
57
65
  next if @anchors[n["id"]]
58
66
  next if n["id"].nil? || n["id"].empty?
59
67
  idx = notes.size == 1 ? "" : " #{i + 1}"
60
- @anchors[n["id"]] = anchor_struct(idx, n, @note_xref_lbl, "note")
68
+ @anchors[n["id"]] = anchor_struct(idx, n, @note_xref_lbl, "note", false)
61
69
  end
62
70
  note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
63
71
  end
@@ -73,12 +81,14 @@ module IsoDoc::Function
73
81
  def example_anchor_names(sections)
74
82
  sections.each do |s|
75
83
  notes = s.xpath(CHILD_EXAMPLES_XPATH)
76
- notes.each_with_index do |n, i|
84
+ i = 0
85
+ notes.each do |n|
77
86
  next if @anchors[n["id"]]
78
87
  next if n["id"].nil? || n["id"].empty?
79
88
  idx = notes.size == 1 ? "" : " #{i + 1}"
80
89
  @anchors[n["id"]] = anchor_struct(idx, n, @example_xref_lbl,
81
- "example")
90
+ "example", n["unnumbered"])
91
+ i += 1 unless n["unnumbered"]
82
92
  end
83
93
  example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
84
94
  end
@@ -91,7 +101,7 @@ module IsoDoc::Function
91
101
  notes.each_with_index do |n, i|
92
102
  next if n["id"].nil? || n["id"].empty?
93
103
  idx = notes.size == 1 ? "" : " #{i + 1}"
94
- @anchors[n["id"]] = anchor_struct(idx, n, @list_lbl, "list")
104
+ @anchors[n["id"]] = anchor_struct(idx, n, @list_lbl, "list", false)
95
105
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
96
106
  end
97
107
  list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -139,11 +149,11 @@ module IsoDoc::Function
139
149
  if t.parent.name == "figure" then j += 1
140
150
  else
141
151
  j = 0
142
- i += 1
152
+ i += 1 unless t["unnumbered"]
143
153
  end
144
154
  label = i.to_s + (j.zero? ? "" : "-#{j}")
145
155
  next if t["id"].nil? || t["id"].empty?
146
- @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure")
156
+ @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
147
157
  end
148
158
  end
149
159
 
@@ -163,10 +173,10 @@ module IsoDoc::Function
163
173
  end
164
174
  end
165
175
 
166
- def anchor_struct(lbl, container, elem, type)
176
+ def anchor_struct(lbl, container, elem, type, unnumbered = false)
167
177
  ret = {}
168
- ret[:label] = anchor_struct_label(lbl, elem)
169
- ret[:xref] = anchor_struct_xref(lbl, elem)
178
+ ret[:label] = unnumbered == "true" ? nil : anchor_struct_label(lbl, elem)
179
+ ret[:xref] = anchor_struct_xref(unnumbered == "true" ? "(??)" : lbl, elem)
170
180
  ret[:xref].gsub!(/ $/, "")
171
181
  ret[:container] = get_clause_id(container) unless container.nil?
172
182
  ret[:type] = type
@@ -174,81 +184,97 @@ module IsoDoc::Function
174
184
  end
175
185
 
176
186
  def sequential_table_names(clause)
177
- clause.xpath(ns(".//table")).each_with_index do |t, i|
187
+ i = 0
188
+ clause.xpath(ns(".//table")).each do |t|
178
189
  next if t["id"].nil? || t["id"].empty?
179
- @anchors[t["id"]] = anchor_struct(i + 1, nil, @table_lbl, "table")
190
+ @anchors[t["id"]] = anchor_struct(i + 1, nil, @table_lbl, "table", t["unnumbered"])
191
+ i += 1 unless t["unnumbered"]
180
192
  end
181
193
  end
182
194
 
183
195
  def sequential_formula_names(clause)
184
- clause.xpath(ns(".//formula")).each_with_index do |t, i|
196
+ i = 0
197
+ clause.xpath(ns(".//formula")).each do |t|
185
198
  next if t["id"].nil? || t["id"].empty?
186
- @anchors[t["id"]] = anchor_struct(i + 1, t, @formula_lbl, "formula")
199
+ @anchors[t["id"]] = anchor_struct(i + 1, t, @formula_lbl, "formula", t["unnumbered"])
200
+ i += 1 unless t["unnumbered"]
187
201
  end
188
202
  end
189
203
 
190
204
  FIRST_LVL_REQ = "[not(ancestor::permission or ancestor::requirement or ancestor::recommendation)]".freeze
191
205
 
192
206
  def sequential_permission_names(clause)
193
- clause.xpath(ns(".//permission#{FIRST_LVL_REQ}")).each_with_index do |t, i|
207
+ i = 0
208
+ clause.xpath(ns(".//permission#{FIRST_LVL_REQ}")).each do |t|
194
209
  next if t["id"].nil? || t["id"].empty?
195
- @anchors[t["id"]] = anchor_struct(i + 1, t, @permission_lbl, "permission")
210
+ @anchors[t["id"]] = anchor_struct(i + 1, t, @permission_lbl, "permission", t["unnumbered"])
196
211
  sequential_permission_names1(t, i + 1)
197
212
  sequential_requirement_names1(t, i + 1)
198
213
  sequential_recommendation_names1(t, i + 1)
214
+ i += 1 unless t["unnumbered"]
199
215
  end
200
216
  end
201
217
 
202
218
  def sequential_permission_names1(block, lbl)
203
- block.xpath(ns("./permission")).each_with_index do |t, i|
219
+ i = 0
220
+ block.xpath(ns("./permission")).each do |t|
204
221
  next if t["id"].nil? || t["id"].empty?
205
222
  newlbl = "#{lbl}#{hierfigsep}#{i + 1}"
206
- @anchors[t["id"]] = anchor_struct(newlbl, t, @permission_lbl, "permission")
223
+ @anchors[t["id"]] = anchor_struct(newlbl, t, @permission_lbl, "permission", t["unnumbered"])
207
224
  sequential_permission_names1(t, newlbl)
208
225
  sequential_requirement_names1(t, newlbl)
209
226
  sequential_recommendation_names1(t, newlbl)
227
+ i += 1 unless t["unnumbered"]
210
228
  end
211
229
  end
212
230
 
213
231
  def sequential_requirement_names(clause)
214
- clause.xpath(ns(".//requirement#{FIRST_LVL_REQ}")).each_with_index do |t, i|
232
+ i = 0
233
+ clause.xpath(ns(".//requirement#{FIRST_LVL_REQ}")).each do |t|
215
234
  next if t["id"].nil? || t["id"].empty?
216
- @anchors[t["id"]] = anchor_struct(i + 1, t, @requirement_lbl, "requirement")
235
+ @anchors[t["id"]] = anchor_struct(i + 1, t, @requirement_lbl, "requirement", t["unnumbered"])
217
236
  sequential_permission_names1(t, i + 1)
218
237
  sequential_requirement_names1(t, i + 1)
219
238
  sequential_recommendation_names1(t, i + 1)
239
+ i += 1 unless t["unnumbered"]
220
240
  end
221
241
  end
222
242
 
223
243
  def sequential_requirement_names1(block, lbl)
224
- block.xpath(ns("./requirement")).each_with_index do |t, i|
244
+ i = 0
245
+ block.xpath(ns("./requirement")).each do |t|
225
246
  next if t["id"].nil? || t["id"].empty?
226
247
  newlbl = "#{lbl}#{hierfigsep}#{i + 1}"
227
- @anchors[t["id"]] = anchor_struct(newlbl, t, @requirement_lbl, "requirement")
248
+ @anchors[t["id"]] = anchor_struct(newlbl, t, @requirement_lbl, "requirement", t["unnumbered"])
228
249
  sequential_permission_names1(t, newlbl)
229
250
  sequential_requirement_names1(t, newlbl)
230
251
  sequential_recommendation_names1(t, newlbl)
252
+ i += 1 unless t["unnumbered"]
231
253
  end
232
254
  end
233
255
 
234
256
  def sequential_recommendation_names(clause)
235
- clause.xpath(ns(".//recommendation#{FIRST_LVL_REQ}")).each_with_index do |t, i|
257
+ i = 0
258
+ clause.xpath(ns(".//recommendation#{FIRST_LVL_REQ}")).each do |t|
236
259
  next if t["id"].nil? || t["id"].empty?
237
- @anchors[t["id"]] = anchor_struct(i + 1, t, @recommendation_lbl, "recommendation")
260
+ @anchors[t["id"]] = anchor_struct(i + 1, t, @recommendation_lbl, "recommendation", t["unnumbered"])
238
261
  sequential_permission_names1(t, i + 1)
239
262
  sequential_requirement_names1(t, i + 1)
240
263
  sequential_recommendation_names1(t, i + 1)
264
+ i += 1 unless t["unnumbered"]
241
265
  end
242
266
  end
243
267
 
244
268
  def sequential_recommendation_names1(block, lbl)
245
- block.xpath(ns("./recommendation")).each_with_index do |t, i|
269
+ i = 0
270
+ block.xpath(ns("./recommendation")).each do |t|
246
271
  next if t["id"].nil? || t["id"].empty?
247
272
  newlbl = "#{lbl}#{hierfigsep}#{i + 1}"
248
- @anchors[t["id"]] = anchor_struct(newlbl, t, @recommendation_lbl, "recommendation")
273
+ @anchors[t["id"]] = anchor_struct(newlbl, t, @recommendation_lbl, "recommendation", t["unnumbered"])
249
274
  sequential_permission_names1(t, newlbl)
250
275
  sequential_requirement_names1(t, newlbl)
251
276
  sequential_recommendation_names1(t, newlbl)
277
+ i += 1 unless t["unnumbered"]
252
278
  end
253
279
  end
254
280
 
@@ -275,19 +301,21 @@ module IsoDoc::Function
275
301
  if t.parent.name == "figure" then j += 1
276
302
  else
277
303
  j = 0
278
- i += 1
304
+ i += 1 unless t["unnumbered"]
279
305
  end
280
306
  label = "#{num}#{hiersep}#{i}" + (j.zero? ? "" : "#{hierfigsep}#{j}")
281
307
  next if t["id"].nil? || t["id"].empty?
282
- @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure")
308
+ @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
283
309
  end
284
310
  end
285
311
 
286
312
  def hierarchical_table_names(clause, num)
287
- clause.xpath(ns(".//table")).each_with_index do |t, i|
313
+ i = 0
314
+ clause.xpath(ns(".//table")).each do |t|
288
315
  next if t["id"].nil? || t["id"].empty?
289
316
  @anchors[t["id"]] = anchor_struct("#{num}#{hiersep}#{i + 1}",
290
- nil, @table_lbl, "table")
317
+ nil, @table_lbl, "table", t["unnumbered"])
318
+ i += 1 unless t["unnumbered"]
291
319
  end
292
320
  end
293
321
 
@@ -301,43 +329,51 @@ module IsoDoc::Function
301
329
  end
302
330
 
303
331
  def hierarchical_formula_names(clause, num)
304
- clause.xpath(ns(".//formula")).each_with_index do |t, i|
332
+ i = 0
333
+ clause.xpath(ns(".//formula")).each do |t|
305
334
  next if t["id"].nil? || t["id"].empty?
306
335
  @anchors[t["id"]] = anchor_struct("#{num}#{hiersep}#{i + 1}",
307
- t, @formula_lbl, "formula")
336
+ t, @formula_lbl, "formula", t["unnumbered"])
337
+ i += 1 unless t["unnumbered"]
308
338
  end
309
339
  end
310
340
 
311
341
  def hierarchical_permission_names(clause, num)
312
- clause.xpath(ns(".//permission#{FIRST_LVL_REQ}")).each_with_index do |t, i|
342
+ i = 0
343
+ clause.xpath(ns(".//permission#{FIRST_LVL_REQ}")).each do |t|
313
344
  next if t["id"].nil? || t["id"].empty?
314
345
  lbl = "#{num}#{hiersep}#{i + 1}"
315
- @anchors[t["id"]] = anchor_struct(lbl, t, @permission_lbl, "permission")
346
+ @anchors[t["id"]] = anchor_struct(lbl, t, @permission_lbl, "permission", t["unnumbered"])
316
347
  sequential_permission_names1(t, lbl)
317
348
  sequential_requirement_names1(t, lbl)
318
349
  sequential_recommendation_names1(t, lbl)
350
+ i += 1 unless t["unnumbered"]
319
351
  end
320
352
  end
321
353
 
322
354
  def hierarchical_requirement_names(clause, num)
323
- clause.xpath(ns(".//requirement#{FIRST_LVL_REQ}")).each_with_index do |t, i|
355
+ i = 0
356
+ clause.xpath(ns(".//requirement#{FIRST_LVL_REQ}")).each do |t|
324
357
  next if t["id"].nil? || t["id"].empty?
325
358
  lbl = "#{num}#{hiersep}#{i + 1}"
326
- @anchors[t["id"]] = anchor_struct(lbl, t, @requirement_lbl, "requirement")
359
+ @anchors[t["id"]] = anchor_struct(lbl, t, @requirement_lbl, "requirement", t["unnumbered"])
327
360
  sequential_permission_names1(t, lbl)
328
361
  sequential_requirement_names1(t, lbl)
329
362
  sequential_recommendation_names1(t, lbl)
363
+ i += 1 unless t["unnumbered"]
330
364
  end
331
365
  end
332
366
 
333
367
  def hierarchical_recommendation_names(clause, num)
334
- clause.xpath(ns(".//recommendation#{FIRST_LVL_REQ}")).each_with_index do |t, i|
368
+ i = 0
369
+ clause.xpath(ns(".//recommendation#{FIRST_LVL_REQ}")).each do |t|
335
370
  next if t["id"].nil? || t["id"].empty?
336
371
  lbl = "#{num}#{hiersep}#{i + 1}"
337
- @anchors[t["id"]] = anchor_struct(lbl, t, @recommendation_lbl, "recommendation")
372
+ @anchors[t["id"]] = anchor_struct(lbl, t, @recommendation_lbl, "recommendation", t["unnumbered"])
338
373
  sequential_permission_names1(t, lbl)
339
374
  sequential_requirement_names1(t, lbl)
340
375
  sequential_recommendation_names1(t, lbl)
376
+ i += 1 unless t["unnumbered"]
341
377
  end
342
378
  end
343
379
  end