isodoc 1.5.5 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,59 @@
1
+ module IsoDoc::HtmlFunction
2
+ module Html
3
+ def update_footnote_filter(fn, x, i, seen)
4
+ if seen[fn.text]
5
+ x.at("./sup").content = seen[fn.text][:num].to_s
6
+ fn.remove unless x["href"] == seen[fn.text][:href]
7
+ x["href"] = seen[fn.text][:href]
8
+ else
9
+ seen[fn.text] = { num: i, href: x["href"] }
10
+ x.at("./sup").content = i.to_s
11
+ i += 1
12
+ end
13
+ [i, seen]
14
+ end
15
+
16
+ def html_footnote_filter(docxml)
17
+ seen = {}
18
+ i = 1
19
+ docxml.xpath('//a[@class = "FootnoteRef"]').each do |x|
20
+ fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
21
+ i, seen = update_footnote_filter(fn, x, i, seen)
22
+ end
23
+ docxml
24
+ end
25
+
26
+ def footnote_backlinks1(x, fn)
27
+ xdup = x.dup
28
+ xdup.remove["id"]
29
+ if fn.elements.empty?
30
+ fn.children.first.previous = xdup
31
+ else
32
+ fn.elements.first.children.first.previous = xdup
33
+ end
34
+ end
35
+
36
+ def footnote_backlinks(docxml)
37
+ seen = {}
38
+ docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
39
+ seen[x["href"]] and next or seen[x["href"]] = true
40
+ fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
41
+ footnote_backlinks1(x, fn)
42
+ x["id"] ||= "fnref:#{i + 1}"
43
+ fn.add_child "<a href='##{x['id']}'>&#x21A9;</a>"
44
+ end
45
+ docxml
46
+ end
47
+
48
+ def footnote_format(docxml)
49
+ docxml.xpath("//a[@class = 'FootnoteRef']/sup").each do |x|
50
+ footnote_reference_format(x)
51
+ end
52
+ docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
53
+ "//span[@class = 'TableFootnoteRef']").each do |x|
54
+ table_footnote_reference_format(x)
55
+ end
56
+ docxml
57
+ end
58
+ end
59
+ end
data/lib/isodoc/i18n.rb CHANGED
@@ -5,44 +5,47 @@ module IsoDoc
5
5
  def load_yaml(lang, script, i18nyaml = nil)
6
6
  ret = load_yaml1(lang, script)
7
7
  return normalise_hash(ret.merge(YAML.load_file(i18nyaml))) if i18nyaml
8
+
8
9
  normalise_hash(ret)
9
10
  end
10
11
 
11
12
  def normalise_hash(ret)
12
- if ret.is_a? Hash
13
+ case ret
14
+ when Hash
13
15
  ret.each do |k, v|
14
16
  ret[k] = normalise_hash(v)
15
17
  end
16
18
  ret
17
- elsif ret.is_a? Array then ret.map { |n| normalise_hash(n) }
18
- elsif ret.is_a? String then ret.unicode_normalize(:nfc)
19
- else
20
- ret
19
+ when Array then ret.map { |n| normalise_hash(n) }
20
+ when String then ret.unicode_normalize(:nfc)
21
+ else ret
21
22
  end
22
23
  end
23
24
 
24
25
  def load_yaml1(lang, script)
25
- if lang == "en"
26
- YAML.load_file(File.join(File.dirname(__FILE__),
27
- "../isodoc-yaml/i18n-en.yaml"))
28
- elsif lang == "fr"
29
- YAML.load_file(File.join(File.dirname(__FILE__),
30
- "../isodoc-yaml/i18n-fr.yaml"))
31
- elsif lang == "zh" && script == "Hans"
32
- YAML.load_file(File.join(File.dirname(__FILE__),
33
- "../isodoc-yaml/i18n-zh-Hans.yaml"))
26
+ case lang
27
+ when "en", "fr", "ru", "de", "es", "ar"
28
+ load_yaml2(lang)
29
+ when "zh"
30
+ if script == "Hans" then load_yaml2("zh-Hans")
31
+ else load_yaml2("en")
32
+ end
34
33
  else
35
- YAML.load_file(File.join(File.dirname(__FILE__),
36
- "../isodoc-yaml/i18n-en.yaml"))
34
+ load_yaml2("en")
37
35
  end
38
36
  end
39
37
 
38
+ def load_yaml2(str)
39
+ YAML.load_file(File.join(File.dirname(__FILE__),
40
+ "../isodoc-yaml/i18n-#{str}.yaml"))
41
+ end
42
+
40
43
  def get
41
44
  @labels
42
45
  end
43
46
 
44
- def set(x, y)
45
- @labels[x] = y
47
+ def set(key, val)
48
+ @labels[key] = val
46
49
  end
47
50
 
48
51
  def initialize(lang, script, i18nyaml = nil)
@@ -57,37 +60,36 @@ module IsoDoc
57
60
  end
58
61
  end
59
62
 
60
- def self.l10n(x, lang = @lang, script = @script)
61
- l10n(x, lang, script)
63
+ def self.l10n(text, lang = @lang, script = @script)
64
+ l10n(text, lang, script)
62
65
  end
63
66
 
64
67
  # TODO: move to localization file
65
68
  # function localising spaces and punctuation.
66
69
  # Not clear if period needs to be localised for zh
67
- def l10n(x, lang = @lang, script = @script)
70
+ def l10n(text, lang = @lang, script = @script)
68
71
  if lang == "zh" && script == "Hans"
69
- xml = Nokogiri::HTML::DocumentFragment.parse(x)
72
+ xml = Nokogiri::HTML::DocumentFragment.parse(text)
70
73
  xml.traverse do |n|
71
74
  next unless n.text?
72
- n.replace(n.text.gsub(/ /, "").gsub(/:/, ":").gsub(/,/, "、").
73
- gsub(/\(/, "").gsub(/\)/, "").
74
- gsub(/\[/, "【").gsub(/\]/, "】"))
75
+
76
+ n.replace(n.text.gsub(/ /, "").gsub(/:/, ":").gsub(/,/, "")
77
+ .gsub(/\(/, "(").gsub(/\)/, ")").gsub(/\[/, "【").gsub(/\]/, "】"))
75
78
  end
76
79
  xml.to_xml.gsub(/<b>/, "").gsub("</b>", "").gsub(/<\?[^>]+>/, "")
77
- else
78
- x
80
+ else text
79
81
  end
80
82
  end
81
83
 
82
84
  def multiple_and(names, andword)
83
- return '' if names.empty?
85
+ return "" if names.empty?
84
86
  return names[0] if names.length == 1
87
+
85
88
  (names.length == 2) &&
86
89
  (return l10n("#{names[0]} #{andword} #{names[1]}", @lang, @script))
87
- l10n(names[0..-2].join(', ') + " #{andword} #{names[-1]}", @lang, @script)
90
+ l10n(names[0..-2].join(", ") + " #{andword} #{names[-1]}", @lang, @script)
88
91
  end
89
92
 
90
- #module_function :l10n
91
-
93
+ # module_function :l10n
92
94
  end
93
95
  end
@@ -1,11 +1,10 @@
1
- require_relative "html_function/comments.rb"
2
- require_relative "html_function/footnotes.rb"
3
- require_relative "html_function/html.rb"
1
+ require_relative "html_function/comments"
2
+ require_relative "html_function/footnotes"
3
+ require_relative "html_function/html"
4
4
  require "metanorma"
5
5
 
6
6
  module IsoDoc
7
7
  class PdfConvert < ::IsoDoc::Convert
8
-
9
8
  include HtmlFunction::Comments
10
9
  include HtmlFunction::Footnotes
11
10
  include HtmlFunction::Html
@@ -13,6 +12,8 @@ module IsoDoc
13
12
  def initialize(options)
14
13
  @standardstylesheet = nil
15
14
  super
15
+ @format = :pdf
16
+ @suffix = "pdf"
16
17
  @scripts = @scripts_pdf if @scripts_pdf
17
18
  @maxwidth = 500
18
19
  @maxheight = 800
@@ -22,29 +23,24 @@ module IsoDoc
22
23
  "_pdfimages"
23
24
  end
24
25
 
25
- def initialize(options)
26
- @format = :pdf
27
- @suffix = "pdf"
28
- super
29
- end
30
-
31
26
  def convert(input_filename, file = nil, debug = false, output_filename = nil)
32
27
  file = File.read(input_filename, encoding: "utf-8") if file.nil?
33
28
  @openmathdelim, @closemathdelim = extract_delims(file)
34
29
  docxml, filename, dir = convert_init(file, input_filename, debug)
35
30
  result = convert1(docxml, filename, dir)
36
31
  return result if debug
37
- postprocess(result, filename + ".tmp.html", dir)
32
+
33
+ postprocess(result, "#{filename}.tmp.html", dir)
38
34
  FileUtils.rm_rf dir
39
- ::Metanorma::Output::Pdf.new.convert("#{filename}.tmp.html",
40
- output_filename || "#{filename}.#{@suffix}")
35
+ ::Metanorma::Output::Pdf.new.convert(
36
+ "#{filename}.tmp.html",
37
+ output_filename || "#{filename}.#{@suffix}",
38
+ )
41
39
  FileUtils.rm_rf ["#{filename}.tmp.html", tmpimagedir]
42
40
  end
43
41
 
44
42
  def xref_parse(node, out)
45
- target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".pdf#") :
46
- "##{node["target"]}"
47
- out.a(**{ "href": target }) { |l| l << get_linkend(node) }
43
+ out.a(**{ "href": target_pdf(node) }) { |l| l << get_linkend(node) }
48
44
  end
49
45
  end
50
46
  end
@@ -2,12 +2,32 @@ module IsoDoc
2
2
  class PresentationXMLConvert < ::IsoDoc::Convert
3
3
  def bibdata(docxml)
4
4
  a = bibdata_current(docxml) or return
5
+ address_precompose(a)
5
6
  bibdata_i18n(a)
6
7
  a.next =
7
- "<localized-strings>#{i8n_name(trim_hash(@i18n.get), "").join("")}"\
8
+ "<localized-strings>#{i8n_name(trim_hash(@i18n.get), '').join('')}"\
8
9
  "</localized-strings>"
9
10
  end
10
11
 
12
+ def address_precompose(bib)
13
+ bib.xpath(ns("//bibdata//address")).each do |b|
14
+ next if b.at(ns("./formattedAddress"))
15
+
16
+ x = address_precompose1(b)
17
+ b.children = "<formattedAddress>#{x}</formattedAddress>"
18
+ end
19
+ end
20
+
21
+ def address_precompose1(addr)
22
+ ret = []
23
+ addr.xpath(ns("./street")).each { |s| ret << s.children.to_xml }
24
+ a = addr.at(ns("./city")) and ret << a.children.to_xml
25
+ addr.xpath(ns("./state")).each { |s| ret << s.children.to_xml }
26
+ a = addr.at(ns("./country")) and ret << a.children.to_xml
27
+ a = addr.at(ns("./postcode")) and ret[-1] += " #{a.children.to_xml}"
28
+ ret.join("<br/>")
29
+ end
30
+
11
31
  def bibdata_current(docxml)
12
32
  a = docxml.at(ns("//bibdata")) or return
13
33
  a.xpath(ns("./language")).each do |l|
@@ -19,10 +39,10 @@ module IsoDoc
19
39
  a
20
40
  end
21
41
 
22
- def bibdata_i18n(b)
23
- hash_translate(b, @i18n.get["doctype_dict"], "./ext/doctype")
24
- hash_translate(b, @i18n.get["stage_dict"], "./status/stage")
25
- hash_translate(b, @i18n.get["substage_dict"], "./status/substage")
42
+ def bibdata_i18n(bib)
43
+ hash_translate(bib, @i18n.get["doctype_dict"], "./ext/doctype")
44
+ hash_translate(bib, @i18n.get["stage_dict"], "./status/stage")
45
+ hash_translate(bib, @i18n.get["substage_dict"], "./status/substage")
26
46
  end
27
47
 
28
48
  def hash_translate(bibdata, hash, xpath, lang = @lang)
@@ -35,58 +55,62 @@ module IsoDoc
35
55
  x.next.children = hash[x.text]
36
56
  end
37
57
 
38
- def i18n_tag(k, v)
39
- "<localized-string key='#{k}' language='#{@lang}'>#{v}</localized-string>"
58
+ def i18n_tag(key, value)
59
+ "<localized-string key='#{key}' language='#{@lang}'>#{value}"\
60
+ "</localized-string>"
40
61
  end
41
62
 
42
- def i18n_safe(k)
43
- k.to_s.gsub(/\s|\./, "_")
63
+ def i18n_safe(key)
64
+ key.to_s.gsub(/\s|\./, "_")
44
65
  end
45
66
 
46
- def i8n_name(h, pref)
47
- if h.is_a? Hash then i8n_name1(h, pref)
48
- elsif h.is_a? Array
49
- h.reject { |a| blank?(a) }.each_with_object([]).
50
- with_index do |(v1, g), i|
67
+ def i8n_name(hash, pref)
68
+ if hash.is_a? Hash then i8n_name1(hash, pref)
69
+ elsif hash.is_a? Array
70
+ hash.reject { |a| blank?(a) }.each_with_object([])
71
+ .with_index do |(v1, g), i|
51
72
  i8n_name(v1, "#{i18n_safe(k)}.#{i}").each { |x| g << x }
52
73
  end
53
- else [i18n_tag(pref, h)]
74
+ else [i18n_tag(pref, hash)]
54
75
  end
55
76
  end
56
77
 
57
- def i8n_name1(h, pref)
58
- h.reject { |k, v| blank?(v) }.each_with_object([]) do |(k, v), g|
78
+ def i8n_name1(hash, pref)
79
+ hash.reject { |_k, v| blank?(v) }.each_with_object([]) do |(k, v), g|
59
80
  if v.is_a? Hash then i8n_name(v, i18n_safe(k)).each { |x| g << x }
60
81
  elsif v.is_a? Array
61
82
  v.reject { |a| blank?(a) }.each_with_index do |v1, i|
62
83
  i8n_name(v1, "#{i18n_safe(k)}.#{i}").each { |x| g << x }
63
84
  end
64
85
  else
65
- g << i18n_tag("#{pref}#{pref.empty? ? "" : "."}#{i18n_safe(k)}", v)
86
+ g << i18n_tag("#{pref}#{pref.empty? ? '' : '.'}#{i18n_safe(k)}", v)
66
87
  end
67
88
  end
68
89
  end
69
90
 
70
- #https://stackoverflow.com/a/31822406
71
- def blank?(v)
72
- v.nil? || v.respond_to?(:empty?) && v.empty?
91
+ # https://stackoverflow.com/a/31822406
92
+ def blank?(elem)
93
+ elem.nil? || elem.respond_to?(:empty?) && elem.empty?
73
94
  end
74
95
 
75
- def trim_hash(h)
96
+ def trim_hash(hash)
76
97
  loop do
77
- h_new = trim_hash1(h)
78
- break h if h==h_new
79
- h = h_new
98
+ h_new = trim_hash1(hash)
99
+ break hash if hash == h_new
100
+
101
+ hash = h_new
80
102
  end
81
103
  end
82
104
 
83
- def trim_hash1(h)
84
- return h unless h.is_a? Hash
85
- h.each_with_object({}) do |(k,v), g|
105
+ def trim_hash1(hash)
106
+ return hash unless hash.is_a? Hash
107
+
108
+ hash.each_with_object({}) do |(k, v), g|
86
109
  next if blank?(v)
87
- g[k] = if v.is_a? Hash then trim_hash1(h[k])
110
+
111
+ g[k] = if v.is_a? Hash then trim_hash1(hash[k])
88
112
  elsif v.is_a? Array
89
- h[k].map { |a| trim_hash1(a) }.reject { |a| blank?(a) }
113
+ hash[k].map { |a| trim_hash1(a) }.reject { |a| blank?(a) }
90
114
  else
91
115
  v
92
116
  end
@@ -3,7 +3,8 @@ require "base64"
3
3
  module IsoDoc
4
4
  class PresentationXMLConvert < ::IsoDoc::Convert
5
5
  def lower2cap(s)
6
- return s if /^[[:upper:]][[:upper:]]/.match(s)
6
+ return s if /^[[:upper:]][[:upper:]]/.match?(s)
7
+
7
8
  s.capitalize
8
9
  end
9
10
 
@@ -19,8 +20,10 @@ module IsoDoc
19
20
  end
20
21
 
21
22
  def svg_extract(f)
22
- return unless %r{^data:image/svg\+xml;base64,}.match(f["src"])
23
- svg = Base64.strict_decode64(f["src"].sub(%r{^data:image/svg\+xml;base64,}, ""))
23
+ return unless %r{^data:image/svg\+xml;base64,}.match?(f["src"])
24
+
25
+ svg = Base64.strict_decode64(f["src"]
26
+ .sub(%r{^data:image/svg\+xml;base64,}, ""))
24
27
  f.replace(svg.sub(/<\?xml[^>]*>/, ""))
25
28
  end
26
29
 
@@ -28,12 +31,15 @@ module IsoDoc
28
31
  return sourcecode1(f) if f["class"] == "pseudocode" || f["type"] == "pseudocode"
29
32
  return if labelled_ancestor(f) && f.ancestors("figure").empty?
30
33
  return if f.at(ns("./figure")) and !f.at(ns("./name"))
34
+
31
35
  lbl = @xrefs.anchor(f['id'], :label, false) or return
32
- prefix_name(f, "&nbsp;&mdash; ", l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
36
+ prefix_name(f, "&nbsp;&mdash; ",
37
+ l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
33
38
  end
34
39
 
35
40
  def prefix_name(f, delim, number, elem)
36
41
  return if number.nil? || number.empty?
42
+
37
43
  unless name = f.at(ns("./#{elem}"))
38
44
  f.children.empty? and f.add_child("<#{elem}></#{elem}>") or
39
45
  f.children.first.previous = "<#{elem}></#{elem}>"
@@ -52,6 +58,7 @@ module IsoDoc
52
58
  def sourcecode1(f)
53
59
  return if labelled_ancestor(f)
54
60
  return unless f.ancestors("example").empty?
61
+
55
62
  lbl = @xrefs.anchor(f['id'], :label, false) or return
56
63
  prefix_name(f, "&nbsp;&mdash; ", l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
57
64
  end
@@ -96,6 +103,7 @@ module IsoDoc
96
103
  # introduce name element
97
104
  def note1(f)
98
105
  return if f.parent.name == "bibitem"
106
+
99
107
  n = @xrefs.get[f["id"]]
100
108
  lbl = (@i18n.note if n.nil? || n[:label].nil? || n[:label].empty?) ?
101
109
  @i18n.note: l10n("#{@i18n.note} #{n[:label]}")
@@ -110,7 +118,7 @@ module IsoDoc
110
118
 
111
119
  # introduce name element
112
120
  def termnote1(f)
113
- lbl = l10n(@xrefs.anchor(f['id'], :label) || '???')
121
+ lbl = l10n(@xrefs.anchor(f["id"], :label) || "???")
114
122
  prefix_name(f, "", lower2cap(lbl), "name")
115
123
  end
116
124
 
@@ -134,7 +142,7 @@ module IsoDoc
134
142
 
135
143
  # introduce name element
136
144
  def recommendation1(f, type)
137
- n = @xrefs.anchor(f['id'], :label, false)
145
+ n = @xrefs.anchor(f["id"], :label, false)
138
146
  lbl = (n.nil? ? type : l10n("#{type} #{n}"))
139
147
  prefix_name(f, "", lbl, "name")
140
148
  end
@@ -148,7 +156,8 @@ module IsoDoc
148
156
  def table1(f)
149
157
  return if labelled_ancestor(f)
150
158
  return if f["unnumbered"] && !f.at(ns("./name"))
151
- n = @xrefs.anchor(f['id'], :label, false)
159
+
160
+ n = @xrefs.anchor(f["id"], :label, false)
152
161
  prefix_name(f, "&nbsp;&mdash; ", l10n("#{lower2cap @i18n.table} #{n}"), "name")
153
162
  end
154
163
 
@@ -160,7 +169,7 @@ module IsoDoc
160
169
  end
161
170
 
162
171
  def amend1(f)
163
- f.xpath(ns("./autonumber")).each { |a| a.remove }
172
+ f.xpath(ns("./autonumber")).each(&:remove)
164
173
  f.xpath(ns("./newcontent")).each { |a| a.name = "quote" }
165
174
  f.xpath(ns("./description")).each { |a| a.replace(a.children) }
166
175
  f.replace(f.children)