isodoc 1.0.28 → 1.1.3.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +4 -8
  3. data/.github/workflows/ubuntu.yml +18 -16
  4. data/.github/workflows/windows.yml +4 -8
  5. data/Rakefile +3 -1
  6. data/isodoc.gemspec +2 -2
  7. data/lib/isodoc.rb +2 -0
  8. data/lib/isodoc/base_style/metanorma_word.scss +0 -1
  9. data/lib/isodoc/base_style/reset.scss +3 -3
  10. data/lib/isodoc/common.rb +0 -4
  11. data/lib/isodoc/convert.rb +121 -58
  12. data/lib/isodoc/function/blocks.rb +42 -53
  13. data/lib/isodoc/function/blocks_example_note.rb +108 -0
  14. data/lib/isodoc/function/i18n.rb +1 -0
  15. data/lib/isodoc/function/inline.rb +25 -8
  16. data/lib/isodoc/function/lists.rb +12 -6
  17. data/lib/isodoc/function/references.rb +31 -36
  18. data/lib/isodoc/function/reqt.rb +14 -5
  19. data/lib/isodoc/function/section.rb +7 -11
  20. data/lib/isodoc/function/table.rb +4 -4
  21. data/lib/isodoc/function/terms.rb +3 -3
  22. data/lib/isodoc/function/to_word_html.rb +2 -2
  23. data/lib/isodoc/function/utils.rb +57 -50
  24. data/lib/isodoc/gem_tasks.rb +110 -0
  25. data/lib/isodoc/headlesshtml_convert.rb +7 -6
  26. data/lib/isodoc/html_convert.rb +2 -1
  27. data/lib/isodoc/html_function/html.rb +2 -2
  28. data/lib/isodoc/html_function/postprocess.rb +1 -1
  29. data/lib/isodoc/metadata.rb +69 -63
  30. data/lib/isodoc/pdf_convert.rb +8 -6
  31. data/lib/isodoc/presentation_xml_convert.rb +29 -0
  32. data/lib/isodoc/sassc_importer.rb +11 -0
  33. data/lib/isodoc/version.rb +1 -1
  34. data/lib/isodoc/word_convert.rb +2 -1
  35. data/lib/isodoc/word_function/body.rb +14 -48
  36. data/lib/isodoc/word_function/inline.rb +75 -0
  37. data/lib/isodoc/word_function/postprocess.rb +1 -0
  38. data/lib/isodoc/word_function/table.rb +3 -3
  39. data/lib/isodoc/xref.rb +59 -0
  40. data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
  41. data/lib/isodoc/xref/xref_counter.rb +74 -0
  42. data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
  43. data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
  44. data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
  45. data/lib/isodoc/xslfo_convert.rb +16 -4
  46. data/spec/assets/{html.css → html.scss} +0 -0
  47. data/spec/assets/odf.emf +0 -0
  48. data/spec/assets/odf.svg +4 -0
  49. data/spec/assets/odf1.svg +4 -0
  50. data/spec/isodoc/blocks_spec.rb +216 -44
  51. data/spec/isodoc/footnotes_spec.rb +2 -2
  52. data/spec/isodoc/inline_spec.rb +208 -1
  53. data/spec/isodoc/lists_spec.rb +8 -8
  54. data/spec/isodoc/metadata_spec.rb +107 -3
  55. data/spec/isodoc/postproc_spec.rb +1320 -1350
  56. data/spec/isodoc/presentation_xml_spec.rb +20 -0
  57. data/spec/isodoc/ref_spec.rb +5 -5
  58. data/spec/isodoc/section_spec.rb +52 -0
  59. data/spec/isodoc/table_spec.rb +4 -4
  60. data/spec/isodoc/terms_spec.rb +7 -7
  61. data/spec/isodoc/xref_spec.rb +165 -45
  62. metadata +37 -29
  63. data/lib/isodoc/function/blocks_example.rb +0 -53
  64. data/lib/isodoc/function/xref_counter.rb +0 -50
@@ -0,0 +1,75 @@
1
+ module IsoDoc::WordFunction
2
+ module Body
3
+ def section_break(body)
4
+ body.p do |p|
5
+ p.br **{ clear: "all", class: "section" }
6
+ end
7
+ end
8
+
9
+ def page_break(out)
10
+ out.p do |p|
11
+ p.br **{ clear: "all",
12
+ style: "mso-special-character:line-break;"\
13
+ "page-break-before:always" }
14
+ end
15
+ end
16
+
17
+ def pagebreak_parse(node, out)
18
+ return page_break(out) if node["orientation"].nil?
19
+ out.p do |p|
20
+ p.br **{clear: "all", class: "section",
21
+ orientation: node["orientation"] }
22
+ end
23
+ end
24
+
25
+ def imgsrc(node)
26
+ ret = svg_to_emf(node) and return ret
27
+ return node["src"] unless %r{^data:image/}.match node["src"]
28
+ save_dataimage(node["src"])
29
+ end
30
+
31
+ def image_parse(node, out, caption)
32
+ attrs = { src: imgsrc(node),
33
+ height: node["height"],
34
+ alt: node["alt"],
35
+ title: node["title"],
36
+ width: node["width"] }
37
+ out.img **attr_code(attrs)
38
+ image_title_parse(out, caption)
39
+ end
40
+
41
+ def svg_to_emf_filename(uri)
42
+ File.join(File.dirname(uri), File.basename(uri, ".*")) + ".emf"
43
+ end
44
+
45
+ def svg_to_emf(node)
46
+ return unless node["mimetype"] == "image/svg+xml"
47
+ uri = node["src"]
48
+ %r{^data:image/}.match(uri) and uri = save_dataimage(uri)
49
+ ret = svg_to_emf_filename(uri)
50
+ File.exists?(ret) and return ret
51
+ exe = inkscape_installed? or return nil
52
+ system %(#{exe} --export-type="emf" #{uri}) and
53
+ return ret
54
+ nil
55
+ end
56
+
57
+ def inkscape_installed?
58
+ cmd = "inkscape"
59
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
60
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
61
+ exts.each do |ext|
62
+ exe = File.join(path, "#{cmd}#{ext}")
63
+ return exe if File.executable?(exe) && !File.directory?(exe)
64
+ end
65
+ end
66
+ nil
67
+ end
68
+
69
+ def xref_parse(node, out)
70
+ target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".doc#") :
71
+ "##{node["target"]}"
72
+ out.a(**{ "href": target }) { |l| l << get_linkend(node) }
73
+ end
74
+ end
75
+ end
@@ -32,6 +32,7 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
32
32
  end
33
33
 
34
34
  def postprocess(result, filename, dir)
35
+ filename = filename.sub(/\.doc$/, "")
35
36
  header = generate_header(filename, dir)
36
37
  result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
37
38
  toWord(result, filename, dir, header)
@@ -33,12 +33,12 @@ module IsoDoc::WordFunction
33
33
  align: td["align"], style: style.gsub(/\n/, "") }
34
34
  end
35
35
 
36
- def make_table_attr(node)
36
+ def table_attrs(node)
37
37
  super.merge(attr_code({
38
38
  summary: node["summary"],
39
39
  width: node["width"],
40
40
  style: "mso-table-anchor-horizontal:column;"\
41
- "mso-table-overlap:never;border-spacing:0;border-width:1px;"
41
+ "mso-table-overlap:never;border-spacing:0;border-width:1px;#{keep_style(node)}"
42
42
  }))
43
43
  end
44
44
 
@@ -46,7 +46,7 @@ module IsoDoc::WordFunction
46
46
  @in_table = true
47
47
  table_title_parse(node, out)
48
48
  out.div **{ align: "center", class: "table_container" } do |div|
49
- div.table **make_table_attr(node) do |t|
49
+ div.table **table_attrs(node) do |t|
50
50
  thead_parse(node, t)
51
51
  tbody_parse(node, t)
52
52
  tfoot_parse(node, t)
@@ -0,0 +1,59 @@
1
+ require_relative "xref/xref_anchor"
2
+ require_relative "xref/xref_counter"
3
+ require_relative "xref/xref_gen_seq"
4
+ require_relative "xref/xref_gen"
5
+ require_relative "xref/xref_sect_gen"
6
+ require_relative "class_utils"
7
+
8
+ module IsoDoc
9
+ class Xref
10
+ include XrefGen::Anchor
11
+ include XrefGen::Blocks
12
+ include XrefGen::Sections
13
+
14
+ def initialize(lang, script, klass, labels, options = {})
15
+ @anchors = {}
16
+ @lang = lang
17
+ @script = script
18
+ @klass = klass
19
+ @labels = labels
20
+ @options = options
21
+ end
22
+
23
+ def get
24
+ @anchors
25
+ end
26
+
27
+ def anchor(id, lbl, warning = true)
28
+ return nil if id.nil? || id.empty?
29
+ unless @anchors[id]
30
+ if warning
31
+ @seen ||= Seen_Anchor.instance
32
+ @seen.seen(id) or warn "No label has been processed for ID #{id}"
33
+ @seen.add(id)
34
+ return "[#{id}]"
35
+ end
36
+ end
37
+ @anchors.dig(id, lbl)
38
+ end
39
+
40
+ # extract names for all anchors, xref and label
41
+ def parse(docxml)
42
+ initial_anchor_names(docxml)
43
+ back_anchor_names(docxml)
44
+ # preempt clause notes with all other types of note (ISO default)
45
+ note_anchor_names(docxml.xpath(ns("//table | //figure")))
46
+ note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
47
+ example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
48
+ list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
49
+ end
50
+
51
+ def ns(xpath)
52
+ Common::ns(xpath)
53
+ end
54
+
55
+ def l10n(a, lang = @lang, script = @script)
56
+ IsoDoc::Function::I18n::l10n(a, lang, script)
57
+ end
58
+ end
59
+ end
@@ -1,7 +1,7 @@
1
1
  require "singleton"
2
2
 
3
- module IsoDoc::Function
4
- module XrefGen
3
+ module IsoDoc::XrefGen
4
+ module Anchor
5
5
  class Seen_Anchor
6
6
  include Singleton
7
7
 
@@ -12,34 +12,23 @@ module IsoDoc::Function
12
12
  def seen(x)
13
13
  @seen.has_key?(x)
14
14
  end
15
-
15
+
16
16
  def add(x)
17
17
  @seen[x] = true
18
18
  end
19
19
  end
20
20
 
21
- @anchors = {}
21
+ def initialize()
22
+ @anchors = {}
23
+ end
22
24
 
23
25
  def get_anchors
24
26
  @anchors
25
27
  end
26
28
 
27
- def anchor(id, lbl, warning = true)
28
- return nil if id.nil? || id.empty?
29
- unless @anchors[id]
30
- if warning
31
- @seen ||= Seen_Anchor.instance
32
- @seen.seen(id) or warn "No label has been processed for ID #{id}"
33
- @seen.add(id)
34
- return "[#{id}]"
35
- end
36
- end
37
- @anchors.dig(id, lbl)
38
- end
39
-
40
29
  def anchor_struct_label(lbl, elem)
41
30
  case elem
42
- when @appendix_lbl then l10n("#{elem} #{lbl}")
31
+ when @labels["appendix"] then l10n("#{elem} #{lbl}")
43
32
  else
44
33
  lbl.to_s
45
34
  end
@@ -47,8 +36,8 @@ module IsoDoc::Function
47
36
 
48
37
  def anchor_struct_xref(lbl, elem)
49
38
  case elem
50
- when @formula_lbl then l10n("#{elem} (#{lbl})")
51
- when @inequality_lbl then l10n("#{elem} (#{lbl})")
39
+ when @labels["formula"] then l10n("#{elem} (#{lbl})")
40
+ when @labels["inequality"] then l10n("#{elem} (#{lbl})")
52
41
  else
53
42
  l10n("#{elem} #{lbl}")
54
43
  end
@@ -59,7 +48,7 @@ module IsoDoc::Function
59
48
  ret[:label] = unnumbered == "true" ? nil : anchor_struct_label(lbl, elem)
60
49
  ret[:xref] = anchor_struct_xref(unnumbered == "true" ? "(??)" : lbl, elem)
61
50
  ret[:xref].gsub!(/ $/, "")
62
- ret[:container] = get_clause_id(container) unless container.nil?
51
+ ret[:container] = @klass.get_clause_id(container) unless container.nil?
63
52
  ret[:type] = type
64
53
  ret
65
54
  end
@@ -0,0 +1,74 @@
1
+ require "roman-numerals"
2
+
3
+ module IsoDoc::XrefGen
4
+ class Counter
5
+ def initialize
6
+ @num = 0
7
+ @letter = ""
8
+ @subseq = ""
9
+ @letter_override = nil
10
+ @number_override = nil
11
+ end
12
+
13
+ def new_subseq_increment(node)
14
+ @subseq = node["subsequence"]
15
+ @num += 1
16
+ @letter = node["subsequence"] ? "a" : ""
17
+ if node["number"]
18
+ /^(?<n>\d*)(?<a>[a-z]*)$/ =~ node["number"]
19
+ if n || a
20
+ @letter_override = @letter = a if a
21
+ @number_override = @num = n.to_i if n
22
+ else
23
+ @letter_override = node["number"]
24
+ @letter = @letter_override if /^[a-z]$/.match(@letter_override)
25
+ end
26
+ end
27
+ end
28
+
29
+ def sequence_increment(node)
30
+ if node["number"]
31
+ @number_override = node["number"]
32
+ @num = @number_override.to_i if /^\d+$/.match(@number_override)
33
+ else
34
+ @num += 1
35
+ end
36
+ end
37
+
38
+ def subsequence_increment(node)
39
+ if node["number"]
40
+ @letter_override = node["number"]
41
+ @letter = @letter_override if /^[a-z]$/.match(@letter_override)
42
+ else
43
+ @letter = (@letter.ord + 1).chr.to_s
44
+ end
45
+ end
46
+
47
+ def increment(node)
48
+ return self if node["unnumbered"]
49
+ @letter_override = nil
50
+ @number_override = nil
51
+ if node["subsequence"] != @subseq
52
+ new_subseq_increment(node)
53
+ elsif @letter.empty?
54
+ sequence_increment(node)
55
+ else
56
+ subsequence_increment(node)
57
+ end
58
+ self
59
+ end
60
+
61
+ def print
62
+ "#{@number_override || @num}#{@letter_override || @letter}"
63
+ end
64
+
65
+ def listlabel(depth)
66
+ return @num.to_s if [2, 7].include? depth
67
+ return (96 + @num).chr.to_s if [1, 6].include? depth
68
+ return (64 + @num).chr.to_s if [4, 9].include? depth
69
+ return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
70
+ return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
71
+ return @num.to_s
72
+ end
73
+ end
74
+ end
@@ -1,11 +1,9 @@
1
- require_relative "xref_counter"
2
- require_relative "xref_anchor"
3
- require_relative "xref_gen_seq"
1
+ require_relative "xref_gen_seq.rb"
4
2
 
5
- module IsoDoc::Function
6
- module XrefGen
3
+ module IsoDoc::XrefGen
4
+ module Blocks
7
5
  def termnote_label(n)
8
- @termnote_lbl.gsub(/%/, n.to_s)
6
+ @labels["termnote"].gsub(/%/, n.to_s)
9
7
  end
10
8
 
11
9
  def termnote_anchor_names(docxml)
@@ -17,7 +15,7 @@ module IsoDoc::Function
17
15
  @anchors[n["id"]] =
18
16
  { label: termnote_label(c.print), type: "termnote",
19
17
  xref: l10n("#{anchor(t['id'], :xref)}, "\
20
- "#{@note_xref_lbl} #{c.print}") }
18
+ "#{@labels["note_xref"]} #{c.print}") }
21
19
  end
22
20
  end
23
21
  end
@@ -33,7 +31,7 @@ module IsoDoc::Function
33
31
  @anchors[n["id"]] = {
34
32
  type: "termexample", label: idx,
35
33
  xref: l10n("#{anchor(t['id'], :xref)}, "\
36
- "#{@example_xref_lbl} #{c.print}") }
34
+ "#{@labels["example_xref"]} #{c.print}") }
37
35
  end
38
36
  end
39
37
  end
@@ -57,7 +55,7 @@ module IsoDoc::Function
57
55
  notes.each do |n|
58
56
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
59
57
  idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
60
- @anchors[n["id"]] = anchor_struct(idx, n, @note_xref_lbl,
58
+ @anchors[n["id"]] = anchor_struct(idx, n, @labels["note_xref"],
61
59
  "note", false)
62
60
  end
63
61
  note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -79,7 +77,7 @@ module IsoDoc::Function
79
77
  next if @anchors[n["id"]]
80
78
  next if n["id"].nil? || n["id"].empty?
81
79
  idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
82
- @anchors[n["id"]] = anchor_struct(idx, n, @example_xref_lbl,
80
+ @anchors[n["id"]] = anchor_struct(idx, n, @labels["example_xref"],
83
81
  "example", n["unnumbered"])
84
82
  end
85
83
  example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -94,7 +92,7 @@ module IsoDoc::Function
94
92
  notes.each do |n|
95
93
  next if n["id"].nil? || n["id"].empty?
96
94
  idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
97
- @anchors[n["id"]] = anchor_struct(idx, n, @list_lbl, "list", false)
95
+ @anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list", false)
98
96
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
99
97
  end
100
98
  list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -115,16 +113,5 @@ module IsoDoc::Function
115
113
  end
116
114
  end
117
115
  end
118
-
119
- # extract names for all anchors, xref and label
120
- def anchor_names(docxml)
121
- initial_anchor_names(docxml)
122
- back_anchor_names(docxml)
123
- # preempt clause notes with all other types of note (ISO default)
124
- note_anchor_names(docxml.xpath(ns("//table | //figure")))
125
- note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
126
- example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
127
- list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
128
- end
129
116
  end
130
117
  end
@@ -1,19 +1,32 @@
1
- module IsoDoc::Function
2
- module XrefGen
1
+ module IsoDoc::XrefGen
2
+ module Blocks
3
+ def hiersep
4
+ "."
5
+ end
6
+
7
+ def hierfigsep
8
+ "-"
9
+ end
10
+
11
+ def subfigure_increment(j, c, t)
12
+ if t.parent.name == "figure" then j += 1
13
+ else
14
+ j = 0
15
+ c.increment(t)
16
+ end
17
+ j
18
+ end
19
+
3
20
  def sequential_figure_names(clause)
4
21
  c = Counter.new
5
22
  j = 0
6
23
  clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
7
24
  each do |t|
8
- if t.parent.name == "figure" then j += 1
9
- else
10
- j = 0
11
- c.increment(t)
12
- end
25
+ j = subfigure_increment(j, c, t)
13
26
  label = c.print + (j.zero? ? "" : "-#{j}")
14
27
  next if t["id"].nil? || t["id"].empty?
15
28
  @anchors[t["id"]] =
16
- anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
29
+ anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
17
30
  end
18
31
  end
19
32
 
@@ -22,7 +35,7 @@ module IsoDoc::Function
22
35
  clause.xpath(ns(".//table")).each do |t|
23
36
  next if t["id"].nil? || t["id"].empty?
24
37
  @anchors[t["id"]] = anchor_struct(c.increment(t).print, nil,
25
- @table_lbl, "table", t["unnumbered"])
38
+ @labels["table"], "table", t["unnumbered"])
26
39
  end
27
40
  end
28
41
 
@@ -32,7 +45,7 @@ module IsoDoc::Function
32
45
  next if t["id"].nil? || t["id"].empty?
33
46
  @anchors[t["id"]] =
34
47
  anchor_struct(c.increment(t).print, t,
35
- t["inequality"] ? @inequality_lbl : @formula_lbl,
48
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
36
49
  "formula", t["unnumbered"])
37
50
  end
38
51
  end
@@ -51,9 +64,9 @@ module IsoDoc::Function
51
64
  end
52
65
 
53
66
  def sequential_permission_names2(t, id)
54
- sequential_permission_names1(t, id, "permission", @permission_lbl)
55
- sequential_permission_names1(t, id, "requirement", @requirement_lbl)
56
- sequential_permission_names1(t, id, "recommendation", @recommendation_lbl)
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"])
57
70
  end
58
71
 
59
72
  def sequential_permission_names1(block, lbl, klass, label)
@@ -70,9 +83,9 @@ module IsoDoc::Function
70
83
  sequential_table_names(clause)
71
84
  sequential_figure_names(clause)
72
85
  sequential_formula_names(clause)
73
- sequential_permission_names(clause, "permission", @permission_lbl)
74
- sequential_permission_names(clause, "requirement", @requirement_lbl)
75
- sequential_permission_names(clause, "recommendation", @recommendation_lbl)
86
+ sequential_permission_names(clause, "permission", @labels["permission"])
87
+ sequential_permission_names(clause, "requirement", @labels["requirement"])
88
+ sequential_permission_names(clause, "recommendation", @labels["recommendation"])
76
89
  end
77
90
 
78
91
  def hierarchical_figure_names(clause, num)
@@ -80,15 +93,11 @@ module IsoDoc::Function
80
93
  j = 0
81
94
  clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
82
95
  each do |t|
83
- if t.parent.name == "figure" then j += 1
84
- else
85
- j = 0
86
- c.increment(t)
87
- end
96
+ j = subfigure_increment(j, c, t)
88
97
  label = "#{num}#{hiersep}#{c.print}" +
89
98
  (j.zero? ? "" : "#{hierfigsep}#{j}")
90
99
  next if t["id"].nil? || t["id"].empty?
91
- @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure",
100
+ @anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure",
92
101
  t["unnumbered"])
93
102
  end
94
103
  end
@@ -99,7 +108,7 @@ module IsoDoc::Function
99
108
  next if t["id"].nil? || t["id"].empty?
100
109
  @anchors[t["id"]] =
101
110
  anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
102
- nil, @table_lbl, "table", t["unnumbered"])
111
+ nil, @labels["table"], "table", t["unnumbered"])
103
112
  end
104
113
  end
105
114
 
@@ -107,11 +116,11 @@ module IsoDoc::Function
107
116
  hierarchical_table_names(clause, num)
108
117
  hierarchical_figure_names(clause, num)
109
118
  hierarchical_formula_names(clause, num)
110
- hierarchical_permission_names(clause, num, "permission", @permission_lbl)
119
+ hierarchical_permission_names(clause, num, "permission", @labels["permission"])
111
120
  hierarchical_permission_names(clause, num, "requirement",
112
- @requirement_lbl)
121
+ @labels["requirement"])
113
122
  hierarchical_permission_names(clause, num, "recommendation",
114
- @recommendation_lbl)
123
+ @labels["recommendation"])
115
124
  end
116
125
 
117
126
  def hierarchical_formula_names(clause, num)
@@ -120,7 +129,7 @@ module IsoDoc::Function
120
129
  next if t["id"].nil? || t["id"].empty?
121
130
  @anchors[t["id"]] =
122
131
  anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", nil,
123
- t["inequality"] ? @inequality_lbl : @formula_lbl,
132
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
124
133
  "formula", t["unnumbered"])
125
134
  end
126
135
  end
@@ -135,13 +144,13 @@ module IsoDoc::Function
135
144
  end
136
145
  end
137
146
 
138
- def hierarchical_permission_names2(t, id)
139
- hierarchical_permission_names1(t, id, "permission", @permission_lbl)
140
- hierarchical_permission_names1(t, id, "requirement", @requirement_lbl)
141
- hierarchical_permission_names1(t, id, "recommendation", @recommendation_lbl)
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"])
142
151
  end
143
152
 
144
- def hierarchical_permission_names1(block, lbl, klass, label)
153
+ def hierarchical_permission_names1(block, lbl, klass, label)
145
154
  c = Counter.new
146
155
  block.xpath(ns("./#{klass}")).each do |t|
147
156
  next if t["id"].nil? || t["id"].empty?