isodoc 1.5.5 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) 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 +3 -7
  5. data/Gemfile +2 -2
  6. data/Rakefile +2 -2
  7. data/bin/rspec +1 -2
  8. data/isodoc.gemspec +11 -11
  9. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  10. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  11. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  12. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  13. data/lib/isodoc.rb +0 -2
  14. data/lib/isodoc/base_style/all.css +7 -0
  15. data/lib/isodoc/base_style/metanorma_word.css +7 -0
  16. data/lib/isodoc/base_style/metanorma_word.scss +8 -0
  17. data/lib/isodoc/base_style/reset.css +7 -0
  18. data/lib/isodoc/base_style/reset.scss +9 -0
  19. data/lib/isodoc/base_style/scripts.html +187 -0
  20. data/lib/isodoc/class_utils.rb +6 -5
  21. data/lib/isodoc/common.rb +2 -0
  22. data/lib/isodoc/convert.rb +30 -17
  23. data/lib/isodoc/css.rb +43 -34
  24. data/lib/isodoc/function/blocks.rb +21 -4
  25. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  26. data/lib/isodoc/function/cleanup.rb +53 -45
  27. data/lib/isodoc/function/form.rb +51 -0
  28. data/lib/isodoc/function/inline.rb +37 -15
  29. data/lib/isodoc/function/references.rb +55 -42
  30. data/lib/isodoc/function/section.rb +29 -16
  31. data/lib/isodoc/function/table.rb +1 -0
  32. data/lib/isodoc/function/to_word_html.rb +33 -29
  33. data/lib/isodoc/function/utils.rb +180 -159
  34. data/lib/isodoc/gem_tasks.rb +30 -31
  35. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  36. data/lib/isodoc/html_convert.rb +6 -4
  37. data/lib/isodoc/html_function/comments.rb +2 -0
  38. data/lib/isodoc/html_function/footnotes.rb +14 -7
  39. data/lib/isodoc/html_function/form.rb +62 -0
  40. data/lib/isodoc/html_function/html.rb +30 -26
  41. data/lib/isodoc/html_function/postprocess.rb +41 -82
  42. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  43. data/lib/isodoc/i18n.rb +33 -31
  44. data/lib/isodoc/pdf_convert.rb +12 -16
  45. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  46. data/lib/isodoc/presentation_function/block.rb +17 -8
  47. data/lib/isodoc/presentation_function/inline.rb +84 -120
  48. data/lib/isodoc/presentation_function/math.rb +84 -0
  49. data/lib/isodoc/presentation_function/section.rb +20 -22
  50. data/lib/isodoc/presentation_xml_convert.rb +2 -1
  51. data/lib/isodoc/sassc_importer.rb +1 -1
  52. data/lib/isodoc/version.rb +1 -1
  53. data/lib/isodoc/word_function/body.rb +28 -24
  54. data/lib/isodoc/word_function/footnotes.rb +22 -15
  55. data/lib/isodoc/word_function/postprocess.rb +50 -36
  56. data/lib/isodoc/xref.rb +9 -10
  57. data/lib/isodoc/xref/xref_counter.rb +32 -17
  58. data/lib/isodoc/xref/xref_gen.rb +33 -21
  59. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  60. data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
  61. data/lib/isodoc/xslfo_convert.rb +36 -27
  62. data/spec/assets/scripts_override.html +3 -0
  63. data/spec/isodoc/blocks_spec.rb +2490 -2591
  64. data/spec/isodoc/cleanup_spec.rb +1107 -1109
  65. data/spec/isodoc/footnotes_spec.rb +1 -16
  66. data/spec/isodoc/form_spec.rb +156 -0
  67. data/spec/isodoc/i18n_spec.rb +984 -972
  68. data/spec/isodoc/inline_spec.rb +1129 -912
  69. data/spec/isodoc/lists_spec.rb +316 -315
  70. data/spec/isodoc/postproc_spec.rb +1751 -1540
  71. data/spec/isodoc/presentation_xml_spec.rb +403 -323
  72. data/spec/isodoc/ref_spec.rb +718 -723
  73. data/spec/isodoc/section_spec.rb +910 -902
  74. data/spec/isodoc/table_spec.rb +566 -556
  75. data/spec/isodoc/terms_spec.rb +251 -255
  76. data/spec/isodoc/xref_spec.rb +3041 -2992
  77. data/spec/isodoc/xslfo_convert_spec.rb +39 -0
  78. data/spec/spec_helper.rb +30 -29
  79. metadata +77 -65
@@ -1,28 +1,28 @@
1
- require "twitter_cldr"
2
- require "bigdecimal"
3
-
4
1
  module IsoDoc
5
2
  class PresentationXMLConvert < ::IsoDoc::Convert
6
3
  def prefix_container(container, linkend, _target)
7
- l10n(@xrefs.anchor(container, :xref) + ", " + linkend)
4
+ l10n("#{@xrefs.anchor(container, :xref)}, #{linkend}")
8
5
  end
9
6
 
10
7
  def anchor_linkend(node, linkend)
11
8
  if node["citeas"].nil? && node["bibitemid"]
12
- return @xrefs.anchor(node["bibitemid"] ,:xref) || "???"
9
+ return @xrefs.anchor(node["bibitemid"], :xref) || "???"
13
10
  elsif node["target"] && node["droploc"]
14
- return @xrefs.anchor(node["target"], :value) || @xrefs.anchor(node["target"], :label) ||
15
- @xrefs.anchor(node["target"], :xref) || "???"
11
+ return @xrefs.anchor(node["target"], :value) ||
12
+ @xrefs.anchor(node["target"], :label) ||
13
+ @xrefs.anchor(node["target"], :xref) || "???"
16
14
  elsif node["target"] && !/.#./.match(node["target"])
17
15
  linkend = anchor_linkend1(node)
18
16
  end
17
+
19
18
  linkend || "???"
20
19
  end
21
20
 
22
21
  def anchor_linkend1(node)
23
22
  linkend = @xrefs.anchor(node["target"], :xref)
24
23
  container = @xrefs.anchor(node["target"], :container, false)
25
- (container && get_note_container_id(node) != container && @xrefs.get[node["target"]]) &&
24
+ (container && get_note_container_id(node) != container &&
25
+ @xrefs.get[node["target"]]) and
26
26
  linkend = prefix_container(container, linkend, node["target"])
27
27
  capitalise_xref(node, linkend)
28
28
  end
@@ -31,86 +31,112 @@ module IsoDoc
31
31
  return linkend unless %w(Latn Cyrl Grek).include? @script
32
32
  return linkend&.capitalize if node["case"] == "capital"
33
33
  return linkend&.downcase if node["case"] == "lowercase"
34
- return linkend if linkend[0,1].match(/\p{Upper}/)
34
+ return linkend if linkend[0, 1].match?(/\p{Upper}/)
35
+
36
+ capitalise_xref1(node, linkend)
37
+ end
38
+
39
+ def capitalise_xref1(node, linkend)
35
40
  prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
36
41
  node.xpath("./preceding::text()")
37
- (prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map { |p| p.text }.join)) ? linkend&.capitalize : linkend
42
+ if prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join)
43
+ linkend&.capitalize
44
+ else linkend
45
+ end
38
46
  end
39
47
 
40
48
  def nearest_block_parent(node)
41
- until %w(p title td th name formula li dt dd sourcecode pre).include?(node.name)
49
+ until %w(p title td th name formula li dt dd sourcecode pre)
50
+ .include?(node.name)
42
51
  node = node.parent
43
52
  end
44
53
  node
45
54
  end
46
55
 
47
56
  def non_locality_elems(node)
48
- node.children.select do |c|
49
- !%w{locality localityStack}.include? c.name
57
+ node.children.reject do |c|
58
+ %w{locality localityStack}.include? c.name
50
59
  end
51
60
  end
52
61
 
53
- def get_linkend(n)
54
- contents = non_locality_elems(n).select { |c| !c.text? || /\S/.match(c) }
55
- return unless contents.empty?
56
- link = anchor_linkend(n, docid_l10n(n["target"] || n["citeas"]))
57
- link += eref_localities(n.xpath(ns("./locality | ./localityStack")), link)
58
- non_locality_elems(n).each { |n| n.remove }
59
- n.add_child(link)
62
+ def get_linkend(node)
63
+ c1 = non_locality_elems(node).select { |c| !c.text? || /\S/.match(c) }
64
+ return unless c1.empty?
65
+
66
+ link = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
67
+ link += eref_localities(node.xpath(ns("./locality | ./localityStack")),
68
+ link, node)
69
+ non_locality_elems(node).each(&:remove)
70
+ node.add_child(link)
60
71
  end
61
72
  # so not <origin bibitemid="ISO7301" citeas="ISO 7301">
62
73
  # <locality type="section"><reference>3.1</reference></locality></origin>
63
74
 
64
- def eref_localities(refs, target)
75
+ def eref_localities(refs, target, node)
65
76
  ret = ""
66
77
  refs.each_with_index do |r, i|
67
78
  delim = ","
68
- delim = ";" if r.name == "localityStack" && i>0
69
- ret = eref_locality_stack(r, i, target, delim, ret)
79
+ delim = ";" if r.name == "localityStack" && i.positive?
80
+ ret = eref_locality_stack(r, i, target, delim, ret, node)
70
81
  end
71
82
  ret
72
83
  end
73
84
 
74
- def eref_locality_stack(r, i, target, delim, ret)
75
- if r.name == "localityStack"
76
- r.elements.each_with_index do |rr, j|
77
- ret += eref_localities0(rr, j, target, delim)
85
+ def eref_locality_stack(ref, idx, target, delim, ret, node)
86
+ if ref.name == "localityStack"
87
+ ref.elements.each_with_index do |rr, j|
88
+ ret += eref_localities0(rr, j, target, delim, node)
78
89
  delim = ","
79
90
  end
80
91
  else
81
- ret += eref_localities0(r, i, target, delim)
92
+ ret += eref_localities0(ref, idx, target, delim, node)
82
93
  end
83
94
  ret
84
95
  end
85
96
 
86
- def eref_localities0(r, i, target, delim)
87
- if r["type"] == "whole" then l10n("#{delim} #{@i18n.wholeoftext}")
97
+ def eref_localities0(ref, _idx, target, delim, node)
98
+ if ref["type"] == "whole" then l10n("#{delim} #{@i18n.wholeoftext}")
88
99
  else
89
- eref_localities1(target, r["type"], r.at(ns("./referenceFrom")), r.at(ns("./referenceTo")), delim, @lang)
100
+ eref_localities1(target, ref["type"], ref.at(ns("./referenceFrom")),
101
+ ref.at(ns("./referenceTo")), delim, node, @lang)
90
102
  end
91
103
  end
92
104
 
93
105
  # TODO: move to localization file
94
- def eref_localities1_zh(target, type, from, to, delim)
106
+ def eref_localities1_zh(_target, type, from, upto, node, delim)
95
107
  ret = "#{delim} 第#{from.text}" if from
96
- ret += "&ndash;#{to.text}" if to
97
- loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize )
98
- ret += " #{loc}"
108
+ ret += "&ndash;#{upto.text}" if upto
109
+ loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
110
+ ret += " #{loc}" unless node["droploc"] == "true"
99
111
  ret
100
112
  end
101
113
 
102
114
  # TODO: move to localization file
103
- def eref_localities1(target, type, from, to, delim, lang = "en")
115
+ def eref_localities1(target, type, from, upto, delim, node, lang = "en")
104
116
  return "" if type == "anchor"
105
- lang == "zh" and return l10n(eref_localities1_zh(target, type, from, to, delim))
117
+
118
+ lang == "zh" and
119
+ return l10n(eref_localities1_zh(target, type, from, upto, node, delim))
106
120
  ret = delim
107
- loc = @i18n.locality[type] || type.sub(/^locality:/, "").capitalize
108
- ret += " #{loc}"
121
+ ret += eref_locality_populate(type, node)
109
122
  ret += " #{from.text}" if from
110
- ret += "&ndash;#{to.text}" if to
123
+ ret += "&ndash;#{upto.text}" if upto
111
124
  l10n(ret)
112
125
  end
113
126
 
127
+ def eref_locality_populate(type, node)
128
+ return "" if node["droploc"] == "true"
129
+
130
+ loc = @i18n.locality[type] || type.sub(/^locality:/, "")
131
+ loc = case node["case"]
132
+ when "capital" then loc.capitalize
133
+ when "lowercase" then loc.downcase
134
+ else
135
+ loc.capitalize
136
+ end
137
+ " #{loc}"
138
+ end
139
+
114
140
  def xref(docxml)
115
141
  docxml.xpath(ns("//xref")).each { |f| xref1(f) }
116
142
  end
@@ -127,8 +153,8 @@ module IsoDoc
127
153
  docxml.xpath(ns("//quote/source")).each { |f| xref1(f) }
128
154
  end
129
155
 
130
- def xref1(f)
131
- get_linkend(f)
156
+ def xref1(node)
157
+ get_linkend(node)
132
158
  end
133
159
 
134
160
  def concept(docxml)
@@ -136,107 +162,45 @@ module IsoDoc
136
162
  end
137
163
 
138
164
  def concept1(node)
139
- content = node.first_element_child.children.select do |c|
140
- !%w{locality localityStack}.include? c.name
165
+ content = node.first_element_child.children.reject do |c|
166
+ %w{locality localityStack}.include? c.name
141
167
  end.select { |c| !c.text? || /\S/.match(c) }
142
- node.replace content.empty? ?
143
- @i18n.term_defined_in.sub(/%/, node.first_element_child.to_xml) :
144
- "<em>#{node.children.to_xml}</em>"
145
- end
146
-
147
-
148
- MATHML = { "m" => "http://www.w3.org/1998/Math/MathML" }.freeze
149
-
150
- def mathml(docxml)
151
- locale = twitter_cldr_localiser()
152
- docxml.xpath("//m:math", MATHML).each do |f|
153
- mathml1(f, locale)
154
- end
155
- end
156
-
157
- # symbols is merged into
158
- # TwitterCldr::DataReaders::NumberDataReader.new(locale).symbols
159
- def localize_maths(f, locale)
160
- f.xpath(".//m:mn", MATHML).each do |x|
161
- num = BigDecimal(x.text)
162
- precision = /\./.match(x.text) ? x.text.sub(/^.*\./, "").size : 0
163
- x.children = localized_number(num, locale, precision)
164
- end
165
- end
166
-
167
- # By itself twitter-cldr does not support fraction part digits grouping
168
- # and custom delimeter, will decorate fraction part manually
169
- def localized_number(num, locale, precision)
170
- localized = (precision == 0) ? num.localize(locale).to_s :
171
- num.localize(locale).to_decimal.to_s(:precision => precision)
172
- twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
173
- return localized unless twitter_cldr_reader_symbols[:decimal]
174
- integer, fraction = localized.split(twitter_cldr_reader_symbols[:decimal])
175
- return localized if fraction.nil? || fraction.length.zero?
176
- [integer, decorate_fraction_part(fraction, locale)].join(twitter_cldr_reader_symbols[:decimal])
177
- end
178
-
179
- def decorate_fraction_part(fract, locale)
180
- result = []
181
- twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
182
- fract = fract.slice(0..(twitter_cldr_reader_symbols[:precision] || -1))
183
- fr_group_digits = twitter_cldr_reader_symbols[:fraction_group_digits] || 1
184
- until fract.empty?
185
- result.push(fract.slice!(0, fr_group_digits))
186
- end
187
- result.join(twitter_cldr_reader_symbols[:fraction_group].to_s)
188
- end
189
-
190
- def twitter_cldr_localiser_symbols
191
- {}
192
- end
193
-
194
- def twitter_cldr_reader(locale)
195
- num = TwitterCldr::DataReaders::NumberDataReader.new(locale)
196
- num.symbols.merge!(twitter_cldr_localiser_symbols)
197
- end
198
-
199
- def twitter_cldr_localiser()
200
- locale = TwitterCldr.supported_locale?(@lang.to_sym) ? @lang.to_sym : :en
201
- twitter_cldr_reader(locale)
202
- locale
203
- end
204
-
205
- def mathml1(f, locale)
206
- localize_maths(f, locale)
207
- return unless f.elements.size == 1 && f.elements.first.name == "mn"
208
- if f.parent.name == "stem"
209
- f.parent.replace(f.at("./m:mn", MATHML).children)
210
- else
211
- f.replace(f.at("./m:mn", MATHML).children)
212
- end
168
+ n = if content.empty?
169
+ @i18n.term_defined_in.sub(/%/, node.first_element_child.to_xml)
170
+ else
171
+ "<em>#{node.children.to_xml}</em>"
172
+ end
173
+ node.replace(n)
213
174
  end
214
175
 
215
176
  def variant(docxml)
216
177
  docxml.xpath(ns("//variant")).each { |f| variant1(f) }
217
- docxml.xpath(ns("//variant[@remove = 'true']")).each { |f| f.remove }
178
+ docxml.xpath(ns("//variant[@remove = 'true']")).each(&:remove)
218
179
  docxml.xpath(ns("//variant")).each do |v|
219
180
  next unless v&.next&.name == "variant"
181
+
220
182
  v.next = "/"
221
183
  end
222
184
  docxml.xpath(ns("//variant")).each { |f| f.replace(f.children) }
223
185
  end
224
186
 
225
187
  def variant1(node)
226
- if (!node["lang"] || node["lang"] == @lang) && (!node["script"] || node["script"] == @script)
188
+ if (!node["lang"] || node["lang"] == @lang) &&
189
+ (!node["script"] || node["script"] == @script)
227
190
  elsif found_matching_variant_sibling(node)
228
191
  node["remove"] = "true"
229
- else
230
- #return unless !node.at("./preceding-sibling::xmlns:variant")
231
192
  end
232
193
  end
233
194
 
195
+ private
196
+
234
197
  def found_matching_variant_sibling(node)
235
198
  prev = node.xpath("./preceding-sibling::xmlns:variant")
236
199
  foll = node.xpath("./following-sibling::xmlns:variant")
237
200
  found = false
238
201
  (prev + foll).each do |n|
239
- found = true if n["lang"] == @lang && (!n["script"] || n["script"] == @script)
202
+ found = true if n["lang"] == @lang &&
203
+ (!n["script"] || n["script"] == @script)
240
204
  end
241
205
  found
242
206
  end
@@ -0,0 +1,84 @@
1
+ require "twitter_cldr"
2
+ require "bigdecimal"
3
+
4
+ module IsoDoc
5
+ class PresentationXMLConvert < ::IsoDoc::Convert
6
+ MATHML = { "m" => "http://www.w3.org/1998/Math/MathML" }.freeze
7
+
8
+ def mathml(docxml)
9
+ locale = twitter_cldr_localiser
10
+ docxml.xpath("//m:math", MATHML).each do |f|
11
+ mathml1(f, locale)
12
+ end
13
+ end
14
+
15
+ # symbols is merged into
16
+ # TwitterCldr::DataReaders::NumberDataReader.new(locale).symbols
17
+ def localize_maths(node, locale)
18
+ node.xpath(".//m:mn", MATHML).each do |x|
19
+ num = BigDecimal(x.text)
20
+ precision = /\./.match?(x.text) ? x.text.sub(/^.*\./, "").size : 0
21
+ x.children = localized_number(num, locale, precision)
22
+ end
23
+ end
24
+
25
+ # By itself twitter-cldr does not support fraction part digits grouping
26
+ # and custom delimeter, will decorate fraction part manually
27
+ def localized_number(num, locale, precision)
28
+ localized = localized_number1(num, locale, precision)
29
+ twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
30
+ return localized unless twitter_cldr_reader_symbols[:decimal]
31
+
32
+ integer, fraction = localized.split(twitter_cldr_reader_symbols[:decimal])
33
+ return localized if fraction.nil? || fraction.length.zero?
34
+
35
+ [integer, decorate_fraction_part(fraction, locale)]
36
+ .join(twitter_cldr_reader_symbols[:decimal])
37
+ end
38
+
39
+ def localized_number1(num, locale, precision)
40
+ if precision.zero?
41
+ num.localize(locale).to_s
42
+ else
43
+ num.localize(locale).to_decimal.to_s(precision: precision)
44
+ end
45
+ end
46
+
47
+ def decorate_fraction_part(fract, locale)
48
+ result = []
49
+ twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
50
+ fract = fract.slice(0..(twitter_cldr_reader_symbols[:precision] || -1))
51
+ fr_group_digits = twitter_cldr_reader_symbols[:fraction_group_digits] || 1
52
+ until fract.empty?
53
+ result.push(fract.slice!(0, fr_group_digits))
54
+ end
55
+ result.join(twitter_cldr_reader_symbols[:fraction_group].to_s)
56
+ end
57
+
58
+ def twitter_cldr_localiser_symbols
59
+ {}
60
+ end
61
+
62
+ def twitter_cldr_reader(locale)
63
+ num = TwitterCldr::DataReaders::NumberDataReader.new(locale)
64
+ num.symbols.merge!(twitter_cldr_localiser_symbols)
65
+ end
66
+
67
+ def twitter_cldr_localiser
68
+ locale = TwitterCldr.supported_locale?(@lang.to_sym) ? @lang.to_sym : :en
69
+ twitter_cldr_reader(locale)
70
+ locale
71
+ end
72
+
73
+ def mathml1(node, locale)
74
+ localize_maths(node, locale)
75
+ return unless node.elements.size == 1 && node.elements.first.name == "mn"
76
+
77
+ if node.parent.name == "stem"
78
+ node.parent.replace(node.at("./m:mn", MATHML).children)
79
+ else
80
+ node.replace(node.at("./m:mn", MATHML).children)
81
+ end
82
+ end
83
+ end
84
+ end
@@ -2,20 +2,21 @@ module IsoDoc
2
2
  class PresentationXMLConvert < ::IsoDoc::Convert
3
3
  def clause(docxml)
4
4
  docxml.xpath(ns("//clause | "\
5
- "//terms | //definitions | //references")).
6
- each do |f|
5
+ "//terms | //definitions | //references"))
6
+ .each do |f|
7
7
  clause1(f)
8
8
  end
9
9
  end
10
10
 
11
- def clause1(f)
12
- level = @xrefs.anchor(f['id'], :level, false) || "1"
13
- t = f.at(ns("./title")) and t["depth"] = level
14
- return if !f.ancestors("boilerplate").empty?
15
- return if @suppressheadingnumbers || f["unnumbered"]
16
- lbl = @xrefs.anchor(f['id'], :label,
17
- f.parent.name != "sections") or return
18
- prefix_name(f, "<tab/>", "#{lbl}#{clausedelim}", "title")
11
+ def clause1(elem)
12
+ level = @xrefs.anchor(elem["id"], :level, false) || "1"
13
+ t = elem.at(ns("./title")) and t["depth"] = level
14
+ return if !elem.ancestors("boilerplate").empty? ||
15
+ @suppressheadingnumbers || elem["unnumbered"]
16
+
17
+ lbl = @xrefs.anchor(elem["id"], :label,
18
+ elem.parent.name != "sections") or return
19
+ prefix_name(elem, "<tab/>", "#{lbl}#{clausedelim}", "title")
19
20
  end
20
21
 
21
22
  def annex(docxml)
@@ -24,12 +25,12 @@ module IsoDoc
24
25
  end
25
26
  end
26
27
 
27
- def annex1(f)
28
- lbl = @xrefs.anchor(f['id'], :label)
29
- if t = f.at(ns("./title"))
28
+ def annex1(elem)
29
+ lbl = @xrefs.anchor(elem["id"], :label)
30
+ if t = elem.at(ns("./title"))
30
31
  t.children = "<strong>#{t.children.to_xml}</strong>"
31
32
  end
32
- prefix_name(f, "<br/><br/>", lbl, "title")
33
+ prefix_name(elem, "<br/><br/>", lbl, "title")
33
34
  end
34
35
 
35
36
  def term(docxml)
@@ -38,18 +39,15 @@ module IsoDoc
38
39
  end
39
40
  end
40
41
 
41
- def term1(f)
42
- lbl = @xrefs.get[f["id"]][:label] or return
43
- prefix_name(f, "", "#{lbl}#{clausedelim}", "name")
42
+ def term1(elem)
43
+ lbl = @xrefs.get[elem["id"]][:label] or return
44
+ prefix_name(elem, "", "#{lbl}#{clausedelim}", "name")
44
45
  end
45
46
 
46
- def references(docxml)
47
- end
47
+ def references(docxml); end
48
48
 
49
49
  def index(docxml)
50
- docxml.xpath(ns("//index | //index-xref | //indexsect")).each do |f|
51
- f.remove
52
- end
50
+ docxml.xpath(ns("//index | //index-xref | //indexsect")).each(&:remove)
53
51
  end
54
52
  end
55
53
  end