isodoc 1.6.0 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/Rakefile +2 -2
  6. data/bin/rspec +1 -2
  7. data/isodoc.gemspec +4 -3
  8. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  9. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  10. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  11. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  12. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  13. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  14. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  15. data/lib/isodoc.rb +0 -2
  16. data/lib/isodoc/common.rb +2 -0
  17. data/lib/isodoc/convert.rb +10 -4
  18. data/lib/isodoc/css.rb +30 -26
  19. data/lib/isodoc/function/blocks.rb +26 -8
  20. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  21. data/lib/isodoc/function/cleanup.rb +53 -45
  22. data/lib/isodoc/function/form.rb +51 -0
  23. data/lib/isodoc/function/inline.rb +8 -7
  24. data/lib/isodoc/function/references.rb +71 -77
  25. data/lib/isodoc/function/section.rb +28 -16
  26. data/lib/isodoc/function/table.rb +22 -22
  27. data/lib/isodoc/function/terms.rb +6 -7
  28. data/lib/isodoc/function/to_word_html.rb +19 -25
  29. data/lib/isodoc/function/utils.rb +180 -160
  30. data/lib/isodoc/gem_tasks.rb +36 -38
  31. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  32. data/lib/isodoc/html_convert.rb +10 -4
  33. data/lib/isodoc/html_function/comments.rb +14 -12
  34. data/lib/isodoc/html_function/footnotes.rb +14 -7
  35. data/lib/isodoc/html_function/form.rb +62 -0
  36. data/lib/isodoc/html_function/html.rb +30 -26
  37. data/lib/isodoc/html_function/postprocess.rb +191 -226
  38. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  39. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  40. data/lib/isodoc/i18n.rb +33 -31
  41. data/lib/isodoc/metadata.rb +22 -20
  42. data/lib/isodoc/metadata_contributor.rb +31 -28
  43. data/lib/isodoc/pdf_convert.rb +11 -13
  44. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  45. data/lib/isodoc/presentation_function/block.rb +17 -8
  46. data/lib/isodoc/presentation_function/inline.rb +72 -120
  47. data/lib/isodoc/presentation_function/math.rb +84 -0
  48. data/lib/isodoc/presentation_function/section.rb +55 -19
  49. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  50. data/lib/isodoc/sassc_importer.rb +1 -1
  51. data/lib/isodoc/version.rb +1 -1
  52. data/lib/isodoc/word_function/body.rb +28 -24
  53. data/lib/isodoc/word_function/footnotes.rb +22 -15
  54. data/lib/isodoc/word_function/postprocess.rb +50 -36
  55. data/lib/isodoc/xref.rb +11 -10
  56. data/lib/isodoc/xref/xref_counter.rb +32 -17
  57. data/lib/isodoc/xref/xref_gen.rb +33 -21
  58. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  59. data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
  60. data/spec/assets/scripts_override.html +3 -0
  61. data/spec/isodoc/blocks_spec.rb +2258 -2622
  62. data/spec/isodoc/cleanup_spec.rb +1103 -1107
  63. data/spec/isodoc/form_spec.rb +156 -0
  64. data/spec/isodoc/i18n_spec.rb +802 -917
  65. data/spec/isodoc/inline_spec.rb +1105 -921
  66. data/spec/isodoc/lists_spec.rb +316 -315
  67. data/spec/isodoc/metadata_spec.rb +384 -379
  68. data/spec/isodoc/postproc_spec.rb +1783 -1549
  69. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  70. data/spec/isodoc/ref_spec.rb +718 -723
  71. data/spec/isodoc/section_spec.rb +216 -199
  72. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  73. data/spec/isodoc/table_spec.rb +41 -42
  74. data/spec/isodoc/terms_spec.rb +84 -84
  75. data/spec/isodoc/xref_spec.rb +1024 -930
  76. metadata +33 -7
data/lib/isodoc/xref.rb CHANGED
@@ -11,7 +11,9 @@ module IsoDoc
11
11
  include XrefGen::Blocks
12
12
  include XrefGen::Sections
13
13
 
14
- def initialize(lang, script, klass, i18n, options = {})
14
+ attr_reader :klass
15
+
16
+ def initialize(lang, script, klass, i18n, options = {})
15
17
  @anchors = {}
16
18
  @lang = lang
17
19
  @script = script
@@ -28,13 +30,12 @@ module IsoDoc
28
30
 
29
31
  def anchor(id, lbl, warning = true)
30
32
  return nil if id.nil? || id.empty?
31
- unless @anchors[id]
32
- if warning
33
- @seen ||= Seen_Anchor.instance
34
- @seen.seen(id) or warn "No label has been processed for ID #{id}"
35
- @seen.add(id)
36
- return "[#{id}]"
37
- end
33
+
34
+ if warning && !@anchors[id]
35
+ @seen ||= Seen_Anchor.instance
36
+ @seen.seen(id) or warn "No label has been processed for ID #{id}"
37
+ @seen.add(id)
38
+ return "[#{id}]"
38
39
  end
39
40
  @anchors.dig(id, lbl)
40
41
  end
@@ -56,8 +57,8 @@ module IsoDoc
56
57
  Common::ns(xpath)
57
58
  end
58
59
 
59
- def l10n(a, lang = @lang, script = @script)
60
- @i18n.l10n(a, lang, script)
60
+ def l10n(text, lang = @lang, script = @script)
61
+ @i18n.l10n(text, lang, script)
61
62
  end
62
63
  end
63
64
  end
@@ -2,16 +2,17 @@ require "roman-numerals"
2
2
 
3
3
  module IsoDoc::XrefGen
4
4
  class Counter
5
- def initialize(num = 0, opts = {numerals: :arabic})
5
+ def initialize(num = 0, opts = { numerals: :arabic })
6
6
  @num = num
7
7
  @letter = ""
8
8
  @subseq = ""
9
9
  @letter_override = nil
10
10
  @number_override = nil
11
11
  @style = opts[:numerals]
12
+ @skip_i = opts[:skip_i]
12
13
  @base = ""
13
14
  if num.is_a? String
14
- if /^\d+$/.match(num)
15
+ if /^\d+$/.match?(num)
15
16
  @num = num.to_i
16
17
  else
17
18
  @num = nil
@@ -34,7 +35,7 @@ module IsoDoc::XrefGen
34
35
  @base = b
35
36
  else
36
37
  @letter_override = node["number"]
37
- @letter = @letter_override if /^[a-zA-Z]$/.match(@letter_override)
38
+ @letter = @letter_override if /^[a-zA-Z]$/.match?(@letter_override)
38
39
  end
39
40
  end
40
41
  end
@@ -48,8 +49,7 @@ module IsoDoc::XrefGen
48
49
  @base = node["number"][0..-2]
49
50
  @letter = @letter_override = node["number"][-1]
50
51
  else
51
- @number_override = node["number"]
52
- @num = n.to_i
52
+ @number_override = @num = n.to_i
53
53
  @base = b
54
54
  @letter = ""
55
55
  end
@@ -64,7 +64,7 @@ module IsoDoc::XrefGen
64
64
  @letter_override = node["number"]
65
65
  /^(?<b>.*?)(?<n>\d*)(?<a>[a-zA-Z])$/ =~ node["number"]
66
66
  if blank?(a)
67
- if /^\d+$/.match(node["number"])
67
+ if /^\d+$/.match?(node["number"])
68
68
  @letter_override = @letter = ""
69
69
  @number_override = @num = node["number"].to_i
70
70
  else
@@ -80,32 +80,46 @@ module IsoDoc::XrefGen
80
80
  @number_override = @num = n.to_i unless n.empty?
81
81
  end
82
82
  else
83
- @letter = (@letter.ord + 1).chr.to_s
83
+ increment_letter
84
+ end
85
+ end
86
+
87
+ def increment_letter
88
+ case @letter
89
+ when "Z"
90
+ @letter = "@"
91
+ @base = @base.empty? ? "A" : @base[0..-2] + (@base[-1].ord + 1).chr.to_s
92
+ when "z"
93
+ @letter = "`"
94
+ @base = @base.empty? ? "a" : @base[0..-2] + (@base[-1].ord + 1).chr.to_s
84
95
  end
96
+ @letter = (@letter.ord + 1).chr.to_s
97
+ @skip_i && %w(i I).include?(@letter) and
98
+ @letter = (@letter.ord + 1).chr.to_s
85
99
  end
86
100
 
87
- def blank?(x)
88
- x.nil? || x.empty?
101
+ def blank?(str)
102
+ str.nil? || str.empty?
89
103
  end
90
104
 
91
105
  def increment(node)
92
106
  return self if node["unnumbered"]
107
+
93
108
  @letter_override = nil
94
109
  @number_override = nil
95
- if node["subsequence"] != @subseq && !(blank?(node["subsequence"]) && blank?(@subseq))
110
+ if node["subsequence"] != @subseq &&
111
+ !(blank?(node["subsequence"]) && blank?(@subseq))
96
112
  new_subseq_increment(node)
97
- elsif @letter.empty?
98
- sequence_increment(node)
99
- else
100
- subsequence_increment(node)
113
+ elsif @letter.empty? then sequence_increment(node)
114
+ else subsequence_increment(node)
101
115
  end
102
116
  self
103
117
  end
104
118
 
105
119
  def print
106
120
  num = @number_override || @num
107
- num_out = @style == :roman && !num.nil? ? RomanNumerals.to_roman(num) : num
108
- "#{@base}#{num_out}#{@letter_override || @letter}"
121
+ out = @style == :roman && !num.nil? ? RomanNumerals.to_roman(num) : num
122
+ "#{@base}#{out}#{@letter_override || @letter}"
109
123
  end
110
124
 
111
125
  def ol_type(list, depth)
@@ -115,7 +129,8 @@ module IsoDoc::XrefGen
115
129
  return :alphabet_upper if [4, 9].include? depth
116
130
  return :roman if [3, 8].include? depth
117
131
  return :roman_upper if [5, 10].include? depth
118
- return :arabic
132
+
133
+ :arabic
119
134
  end
120
135
 
121
136
  def listlabel(list, depth)
@@ -1,4 +1,4 @@
1
- require_relative "xref_gen_seq.rb"
1
+ require_relative "xref_gen_seq"
2
2
 
3
3
  module IsoDoc::XrefGen
4
4
  module Blocks
@@ -10,35 +10,43 @@ module IsoDoc::XrefGen
10
10
  autonum = amend_autonums(a)
11
11
  NUMBERED_BLOCKS.each do |b|
12
12
  a.xpath(ns("./newcontent//#{b}")).each_with_index do |e, i|
13
- autonum[b] and i == 0 and e["number"] = autonum[b]
13
+ autonum[b] && i.zero? and e["number"] = autonum[b]
14
14
  !autonum[b] and e["unnumbered"] = "true"
15
15
  end
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
- def amend_autonums(a)
20
+ def amend_autonums(amend)
21
21
  autonum = {}
22
- a.xpath(ns("./autonumber")).each do |n|
22
+ amend.xpath(ns("./autonumber")).each do |n|
23
23
  autonum[n["type"]] = n.text
24
24
  end
25
25
  autonum
26
26
  end
27
27
 
28
- def termnote_label(n)
29
- @labels["termnote"].gsub(/%/, n.to_s)
28
+ def termnote_label(note)
29
+ @labels["termnote"].gsub(/%/, note.to_s)
30
+ end
31
+
32
+ def increment_label(elems, node, counter, increment = true)
33
+ return "" if elems.size == 1 && !node["number"]
34
+
35
+ counter.increment(node) if increment
36
+ " #{counter.print}"
30
37
  end
31
38
 
32
39
  def termnote_anchor_names(docxml)
33
40
  docxml.xpath(ns("//term[descendant::termnote]")).each do |t|
34
41
  c = Counter.new
35
42
  t.xpath(ns(".//termnote")).each do |n|
36
- return if n["id"].nil? || n["id"].empty?
43
+ next if n["id"].nil? || n["id"].empty?
44
+
37
45
  c.increment(n)
38
46
  @anchors[n["id"]] =
39
47
  { label: termnote_label(c.print), type: "termnote", value: c.print,
40
48
  xref: l10n("#{anchor(t['id'], :xref)}, "\
41
- "#{@labels["note_xref"]} #{c.print}") }
49
+ "#{@labels['note_xref']} #{c.print}") }
42
50
  end
43
51
  end
44
52
  end
@@ -48,13 +56,14 @@ module IsoDoc::XrefGen
48
56
  examples = t.xpath(ns(".//termexample"))
49
57
  c = Counter.new
50
58
  examples.each do |n|
51
- return if n["id"].nil? || n["id"].empty?
59
+ next if n["id"].nil? || n["id"].empty?
60
+
52
61
  c.increment(n)
53
- idx = examples.size == 1 && !n["number"] ? "" : c.print
62
+ idx = increment_label(examples, n, c, false)
54
63
  @anchors[n["id"]] = {
55
64
  type: "termexample", label: idx, value: c.print,
56
65
  xref: l10n("#{anchor(t['id'], :xref)}, "\
57
- "#{@labels["example_xref"]} #{c.print}") }
66
+ "#{@labels['example_xref']} #{c.print}") }
58
67
  end
59
68
  end
60
69
  end
@@ -81,9 +90,10 @@ module IsoDoc::XrefGen
81
90
  c = Counter.new
82
91
  notes.each do |n|
83
92
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
84
- idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
85
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["note_xref"],
86
- "note", false)
93
+
94
+ @anchors[n["id"]] =
95
+ anchor_struct(increment_label(notes, n, c), n,
96
+ @labels["note_xref"], "note", false)
87
97
  end
88
98
  note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
89
99
  end
@@ -103,10 +113,10 @@ module IsoDoc::XrefGen
103
113
  c = Counter.new
104
114
  notes.each do |n|
105
115
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
106
- idx = notes.size == 1 && !n["number"] ? "" :
107
- " #{c.increment(n).print}"
108
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["example_xref"],
109
- "example", n["unnumbered"])
116
+
117
+ @anchors[n["id"]] =
118
+ anchor_struct(increment_label(notes, n, c), n,
119
+ @labels["example_xref"], "example", n["unnumbered"])
110
120
  end
111
121
  example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
112
122
  end
@@ -119,9 +129,9 @@ module IsoDoc::XrefGen
119
129
  c = Counter.new
120
130
  notes.each do |n|
121
131
  next if n["id"].nil? || n["id"].empty?
122
- idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
123
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list",
124
- false)
132
+
133
+ @anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
134
+ @labels["list"], "list", false)
125
135
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
126
136
  end
127
137
  list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -146,9 +156,11 @@ module IsoDoc::XrefGen
146
156
  def bookmark_anchor_names(docxml)
147
157
  docxml.xpath(ns(".//bookmark")).each do |n|
148
158
  next if n["id"].nil? || n["id"].empty?
159
+
149
160
  parent = nil
150
161
  n.ancestors.each do |a|
151
162
  next unless a["id"] && parent = @anchors.dig(a["id"], :xref)
163
+
152
164
  break
153
165
  end
154
166
  @anchors[n["id"]] = { type: "bookmark", label: nil, value: nil,
@@ -8,25 +8,27 @@ module IsoDoc::XrefGen
8
8
  "-"
9
9
  end
10
10
 
11
- def subfigure_increment(j, c, t)
12
- if t.parent.name == "figure" then j += 1
11
+ def subfigure_increment(idx, counter, elem)
12
+ if elem.parent.name == "figure" then idx += 1
13
13
  else
14
- j = 0
15
- c.increment(t)
14
+ idx = 0
15
+ counter.increment(elem)
16
16
  end
17
- j
17
+ idx
18
18
  end
19
19
 
20
20
  def sequential_figure_names(clause)
21
21
  c = Counter.new
22
22
  j = 0
23
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
24
- each do |t|
23
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
24
+ .each do |t|
25
25
  j = subfigure_increment(j, c, t)
26
26
  label = c.print + (j.zero? ? "" : "-#{j}")
27
27
  next if t["id"].nil? || t["id"].empty?
28
- @anchors[t["id"]] =
29
- anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
28
+
29
+ @anchors[t["id"]] = anchor_struct(
30
+ label, nil, @labels["figure"], "figure", t["unnumbered"]
31
+ )
30
32
  end
31
33
  end
32
34
 
@@ -34,8 +36,11 @@ module IsoDoc::XrefGen
34
36
  c = Counter.new
35
37
  clause.xpath(ns(".//table")).each do |t|
36
38
  next if t["id"].nil? || t["id"].empty?
37
- @anchors[t["id"]] = anchor_struct(c.increment(t).print, nil,
38
- @labels["table"], "table", t["unnumbered"])
39
+
40
+ @anchors[t["id"]] = anchor_struct(
41
+ c.increment(t).print, nil,
42
+ @labels["table"], "table", t["unnumbered"]
43
+ )
39
44
  end
40
45
  end
41
46
 
@@ -43,10 +48,12 @@ module IsoDoc::XrefGen
43
48
  c = Counter.new
44
49
  clause.xpath(ns(".//formula")).each do |t|
45
50
  next if t["id"].nil? || t["id"].empty?
46
- @anchors[t["id"]] =
47
- anchor_struct(c.increment(t).print, t,
48
- t["inequality"] ? @labels["inequality"] : @labels["formula"],
49
- "formula", t["unnumbered"])
51
+
52
+ @anchors[t["id"]] = anchor_struct(
53
+ c.increment(t).print, t,
54
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
55
+ "formula", t["unnumbered"]
56
+ )
50
57
  end
51
58
  end
52
59
 
@@ -57,22 +64,27 @@ module IsoDoc::XrefGen
57
64
  c = Counter.new
58
65
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
59
66
  next if t["id"].nil? || t["id"].empty?
67
+
60
68
  id = c.increment(t).print
61
69
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
62
70
  sequential_permission_names2(t, id)
63
71
  end
64
72
  end
65
73
 
66
- def sequential_permission_names2(t, id)
67
- sequential_permission_names1(t, id, "permission", @labels["permission"])
68
- sequential_permission_names1(t, id, "requirement", @labels["requirement"])
69
- sequential_permission_names1(t, id, "recommendation", @labels["recommendation"])
74
+ def sequential_permission_names2(elem, ident)
75
+ sequential_permission_names1(elem, ident, "permission",
76
+ @labels["permission"])
77
+ sequential_permission_names1(elem, ident, "requirement",
78
+ @labels["requirement"])
79
+ sequential_permission_names1(elem, ident, "recommendation",
80
+ @labels["recommendation"])
70
81
  end
71
82
 
72
83
  def sequential_permission_names1(block, lbl, klass, label)
73
84
  c = Counter.new
74
85
  block.xpath(ns("./#{klass}")).each do |t|
75
86
  next if t["id"].nil? || t["id"].empty?
87
+
76
88
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
77
89
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
78
90
  sequential_permission_names2(t, id)
@@ -85,20 +97,22 @@ module IsoDoc::XrefGen
85
97
  sequential_formula_names(clause)
86
98
  sequential_permission_names(clause, "permission", @labels["permission"])
87
99
  sequential_permission_names(clause, "requirement", @labels["requirement"])
88
- sequential_permission_names(clause, "recommendation", @labels["recommendation"])
100
+ sequential_permission_names(clause, "recommendation",
101
+ @labels["recommendation"])
89
102
  end
90
103
 
91
104
  def hierarchical_figure_names(clause, num)
92
105
  c = Counter.new
93
106
  j = 0
94
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
95
- each do |t|
107
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
108
+ .each do |t|
96
109
  j = subfigure_increment(j, c, t)
97
110
  label = "#{num}#{hiersep}#{c.print}" +
98
111
  (j.zero? ? "" : "#{hierfigsep}#{j}")
99
112
  next if t["id"].nil? || t["id"].empty?
100
- @anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure",
101
- t["unnumbered"])
113
+
114
+ @anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"],
115
+ "figure", t["unnumbered"])
102
116
  end
103
117
  end
104
118
 
@@ -106,6 +120,7 @@ module IsoDoc::XrefGen
106
120
  c = Counter.new
107
121
  clause.xpath(ns(".//table")).each do |t|
108
122
  next if t["id"].nil? || t["id"].empty?
123
+
109
124
  @anchors[t["id"]] =
110
125
  anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
111
126
  nil, @labels["table"], "table", t["unnumbered"])
@@ -116,7 +131,8 @@ module IsoDoc::XrefGen
116
131
  hierarchical_table_names(clause, num)
117
132
  hierarchical_figure_names(clause, num)
118
133
  hierarchical_formula_names(clause, num)
119
- hierarchical_permission_names(clause, num, "permission", @labels["permission"])
134
+ hierarchical_permission_names(clause, num, "permission",
135
+ @labels["permission"])
120
136
  hierarchical_permission_names(clause, num, "requirement",
121
137
  @labels["requirement"])
122
138
  hierarchical_permission_names(clause, num, "recommendation",
@@ -127,10 +143,12 @@ module IsoDoc::XrefGen
127
143
  c = Counter.new
128
144
  clause.xpath(ns(".//formula")).each do |t|
129
145
  next if t["id"].nil? || t["id"].empty?
130
- @anchors[t["id"]] =
131
- anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", nil,
132
- t["inequality"] ? @labels["inequality"] : @labels["formula"],
133
- "formula", t["unnumbered"])
146
+
147
+ @anchors[t["id"]] = anchor_struct(
148
+ "#{num}#{hiersep}#{c.increment(t).print}", nil,
149
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
150
+ "formula", t["unnumbered"]
151
+ )
134
152
  end
135
153
  end
136
154
 
@@ -138,24 +156,31 @@ module IsoDoc::XrefGen
138
156
  c = Counter.new
139
157
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
140
158
  next if t["id"].nil? || t["id"].empty?
159
+
141
160
  id = "#{num}#{hiersep}#{c.increment(t).print}"
142
- @anchors[t["id"]] = anchor_struct(id, nil, label, klass, t["unnumbered"])
161
+ @anchors[t["id"]] =
162
+ anchor_struct(id, nil, label, klass, t["unnumbered"])
143
163
  hierarchical_permission_names2(t, id)
144
164
  end
145
165
  end
146
166
 
147
- def hierarchical_permission_names2(t, id)
148
- hierarchical_permission_names1(t, id, "permission", @labels["permission"])
149
- hierarchical_permission_names1(t, id, "requirement", @labels["requirement"])
150
- hierarchical_permission_names1(t, id, "recommendation", @labels["recommendation"])
167
+ def hierarchical_permission_names2(elem, ident)
168
+ hierarchical_permission_names1(elem, ident, "permission",
169
+ @labels["permission"])
170
+ hierarchical_permission_names1(elem, ident, "requirement",
171
+ @labels["requirement"])
172
+ hierarchical_permission_names1(elem, ident, "recommendation",
173
+ @labels["recommendation"])
151
174
  end
152
175
 
153
176
  def hierarchical_permission_names1(block, lbl, klass, label)
154
177
  c = Counter.new
155
178
  block.xpath(ns("./#{klass}")).each do |t|
156
179
  next if t["id"].nil? || t["id"].empty?
180
+
157
181
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
158
- @anchors[t["id"]] = anchor_struct(id, nil, label, klass, t["unnumbered"])
182
+ @anchors[t["id"]] =
183
+ anchor_struct(id, nil, label, klass, t["unnumbered"])
159
184
  hierarchical_permission_names2(t, id)
160
185
  end
161
186
  end