isodoc 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/README.adoc +34 -22
  4. data/isodoc.gemspec +1 -1
  5. data/lib/isodoc.rb +3 -1
  6. data/lib/isodoc/blocks.rb +1 -1
  7. data/lib/isodoc/cleanup.rb +1 -1
  8. data/lib/isodoc/convert.rb +9 -8
  9. data/lib/isodoc/{comments.rb → htmlconvert/comments.rb} +1 -1
  10. data/lib/isodoc/htmlconvert/convert.rb +13 -0
  11. data/lib/isodoc/{footnotes.rb → htmlconvert/footnotes.rb} +1 -1
  12. data/lib/isodoc/{html.rb → htmlconvert/html.rb} +29 -4
  13. data/lib/isodoc/i18n-en.yaml +5 -5
  14. data/lib/isodoc/i18n.rb +6 -2
  15. data/lib/isodoc/inline.rb +8 -8
  16. data/lib/isodoc/iso/convert.rb +4 -0
  17. data/lib/isodoc/iso/html/style-human.scss +3 -3
  18. data/lib/isodoc/iso/html/style-iso.scss +2 -2
  19. data/lib/isodoc/iso/html/wordstyle.scss +27 -0
  20. data/lib/isodoc/iso/wordconvert.rb +5 -2
  21. data/lib/isodoc/iso2wordhtml.rb +15 -16
  22. data/lib/isodoc/lists.rb +1 -1
  23. data/lib/isodoc/metadata.rb +66 -49
  24. data/lib/isodoc/references.rb +21 -11
  25. data/lib/isodoc/section.rb +3 -3
  26. data/lib/isodoc/table.rb +1 -1
  27. data/lib/isodoc/terms.rb +1 -1
  28. data/lib/isodoc/utils.rb +20 -21
  29. data/lib/isodoc/version.rb +1 -1
  30. data/lib/isodoc/wordconvert/comments.rb +122 -117
  31. data/lib/isodoc/wordconvert/convert.rb +5 -2
  32. data/lib/isodoc/wordconvert/footnotes.rb +14 -1
  33. data/lib/isodoc/wordconvert/postprocess.rb +7 -2
  34. data/lib/isodoc/wordconvert/wordconvertmodule.rb +12 -1
  35. data/lib/isodoc/xref_gen.rb +12 -2
  36. data/lib/isodoc/xref_sect_gen.rb +5 -4
  37. data/spec/isodoc/blocks_spec.rb +1 -1
  38. data/spec/isodoc/footnotes_spec.rb +3 -3
  39. data/spec/isodoc/i18n_spec.rb +10 -10
  40. data/spec/isodoc/inline_spec.rb +2 -2
  41. data/spec/isodoc/iso_spec.rb +79 -0
  42. data/spec/isodoc/metadata_spec.rb +12 -4
  43. data/spec/isodoc/postproc_spec.rb +7 -7
  44. data/spec/isodoc/ref_spec.rb +7 -19
  45. data/spec/isodoc/section_spec.rb +19 -84
  46. data/spec/isodoc/terms_spec.rb +1 -1
  47. data/spec/isodoc/xref_spec.rb +14 -14
  48. data/spec/spec_helper.rb +3 -3
  49. metadata +9 -8
data/lib/isodoc/table.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- class Convert
2
+ class Common
3
3
  def table_title_parse(node, out)
4
4
  name = node.at(ns("./name"))
5
5
  out.p **{ class: "TableTitle", align: "center" } do |p|
data/lib/isodoc/terms.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- class Convert
2
+ class Common
3
3
  def definition_parse(node, out)
4
4
  node.children.each { |n| parse(n, out) }
5
5
  end
data/lib/isodoc/utils.rb CHANGED
@@ -1,33 +1,32 @@
1
1
  module IsoDoc
2
- class Convert
3
- def ns(xpath)
2
+ class Common
3
+ def self.ns(xpath)
4
4
  xpath.gsub(%r{/([a-zA-z])}, "/xmlns:\\1").
5
5
  gsub(%r{::([a-zA-z])}, "::xmlns:\\1").
6
6
  gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1").
7
7
  gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]*\])}, "[xmlns:\\1")
8
8
  end
9
9
 
10
- def insert_tab(out, n)
11
- [1..n].each { out << "&nbsp; " }
10
+ def ns(xpath)
11
+ Common::ns(xpath)
12
12
  end
13
13
 
14
- STAGE_ABBRS = {
15
- "00": "PWI",
16
- "10": "NWIP",
17
- "20": "WD",
18
- "30": "CD",
19
- "40": "DIS",
20
- "50": "FDIS",
21
- "60": "IS",
22
- "90": "(Review)",
23
- "95": "(Withdrawal)",
24
- }.freeze
14
+ def self.date_range(date)
15
+ from = date.at(ns("./from"))
16
+ to = date.at(ns("./to"))
17
+ on = date.at(ns("./on"))
18
+ return on.text if on
19
+ ret = "#{from.text}&ndash;"
20
+ ret += to.text if to
21
+ ret
22
+ end
25
23
 
26
- def stage_abbrev(stage, iter, draft)
27
- stage = STAGE_ABBRS[stage.to_sym] || "??"
28
- stage += iter.text if iter
29
- stage = "Pre" + stage if draft&.text =~ /^0\./
30
- stage
24
+ def date_range(date)
25
+ Common::date_range(date)
26
+ end
27
+
28
+ def insert_tab(out, n)
29
+ [1..n].each { out << "&nbsp; " }
31
30
  end
32
31
 
33
32
  NOKOHEAD = <<~HERE.freeze
@@ -133,7 +132,7 @@ module IsoDoc
133
132
  end
134
133
 
135
134
  def populate_template(docxml, _format)
136
- meta = get_metadata.merge(@labels)
135
+ meta = @meta.get.merge(@labels)
137
136
  docxml = docxml.
138
137
  gsub(/\[TERMREF\]\s*/, l10n("[#{@source_lbl}: ")).
139
138
  gsub(/\s*\[\/TERMREF\]\s*/, l10n("]")).
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "0.7.0".freeze
2
+ VERSION = "0.7.1".freeze
3
3
  end
@@ -1,140 +1,145 @@
1
- def in_comment
2
- @in_comment
3
- end
1
+ module IsoDoc
2
+ class WordConvert < Common
4
3
 
5
- def comments(div)
6
- return if @comments.empty?
7
- div.div **{ style: "mso-element:comment-list" } do |div1|
8
- @comments.each { |fn| div1.parent << fn }
9
- end
10
- end
11
-
12
- def review_note_parse(node, out)
13
- fn = @comments.length + 1
14
- make_comment_link(out, fn, node)
15
- @in_comment = true
16
- @comments << make_comment_text(node, fn)
17
- @in_comment = false
18
- end
4
+ def in_comment
5
+ @in_comment
6
+ end
19
7
 
20
- def comment_link_attrs(fn, node)
21
- { style: "MsoCommentReference", target: fn,
22
- class: "commentLink", from: node["from"],
23
- to: node["to"] }
24
- end
8
+ def comments(div)
9
+ return if @comments.empty?
10
+ div.div **{ style: "mso-element:comment-list" } do |div1|
11
+ @comments.each { |fn| div1.parent << fn }
12
+ end
13
+ end
25
14
 
26
- # add in from and to links to move the comment into place
27
- def make_comment_link(out, fn, node)
28
- out.span(**comment_link_attrs(fn, node)) do |s1|
29
- s1.span **{ lang: "EN-GB", style: "font-size:9.0pt" } do |s2|
30
- s2.a **{ style: "mso-comment-reference:SMC_#{fn};"\
31
- "mso-comment-date:#{node['date'].gsub(/[:-]+/, '')}" }
32
- s2.span **{ style: "mso-special-character:comment",
33
- target: fn } # do |s|
15
+ def review_note_parse(node, out)
16
+ fn = @comments.length + 1
17
+ make_comment_link(out, fn, node)
18
+ @in_comment = true
19
+ @comments << make_comment_text(node, fn)
20
+ @in_comment = false
34
21
  end
35
- end
36
- end
37
22
 
38
- def make_comment_target(out)
39
- out.span **{ style: "MsoCommentReference" } do |s1|
40
- s1.span **{ lang: "EN-GB", style: "font-size:9.0pt" } do |s2|
41
- s2.span **{ style: "mso-special-character:comment" }
23
+ def comment_link_attrs(fn, node)
24
+ { style: "MsoCommentReference", target: fn,
25
+ class: "commentLink", from: node["from"],
26
+ to: node["to"] }
42
27
  end
43
- end
44
- end
45
28
 
46
- def make_comment_text(node, fn)
47
- noko do |xml|
48
- xml.div **{ style: "mso-element:comment", id: fn } do |div|
49
- div.span **{ style: %{mso-comment-author:"#{node['reviewer']}"} }
50
- make_comment_target(div)
51
- node.children.each { |n| parse(n, div) }
29
+ # add in from and to links to move the comment into place
30
+ def make_comment_link(out, fn, node)
31
+ out.span(**comment_link_attrs(fn, node)) do |s1|
32
+ s1.span **{ lang: "EN-GB", style: "font-size:9.0pt" } do |s2|
33
+ s2.a **{ style: "mso-comment-reference:SMC_#{fn};"\
34
+ "mso-comment-date:#{node['date'].gsub(/[:-]+/, '')}" }
35
+ s2.span **{ style: "mso-special-character:comment",
36
+ target: fn } # do |s|
37
+ end
38
+ end
52
39
  end
53
- end.join("\n")
54
- end
55
40
 
56
- def comment_cleanup(docxml)
57
- move_comment_link_to_from(docxml)
58
- reorder_comments_by_comment_link(docxml)
59
- embed_comment_in_comment_list(docxml)
60
- end
41
+ def make_comment_target(out)
42
+ out.span **{ style: "MsoCommentReference" } do |s1|
43
+ s1.span **{ lang: "EN-GB", style: "font-size:9.0pt" } do |s2|
44
+ s2.span **{ style: "mso-special-character:comment" }
45
+ end
46
+ end
47
+ end
61
48
 
62
- COMMENT_IN_COMMENT_LIST1 =
63
- '//div[@style="mso-element:comment-list"]//'\
64
- 'span[@style="MsoCommentReference"]'.freeze
49
+ def make_comment_text(node, fn)
50
+ noko do |xml|
51
+ xml.div **{ style: "mso-element:comment", id: fn } do |div|
52
+ div.span **{ style: %{mso-comment-author:"#{node['reviewer']}"} }
53
+ make_comment_target(div)
54
+ node.children.each { |n| parse(n, div) }
55
+ end
56
+ end.join("\n")
57
+ end
65
58
 
66
- def embed_comment_in_comment_list(docxml)
67
- #docxml.xpath(COMMENT_IN_COMMENT_LIST).each do |x|
68
- docxml.xpath(COMMENT_IN_COMMENT_LIST1).each do |x|
69
- n = x.next_element
70
- n&.children&.first&.add_previous_sibling(x.remove)
71
- end
72
- docxml
73
- end
59
+ def comment_cleanup(docxml)
60
+ move_comment_link_to_from(docxml)
61
+ reorder_comments_by_comment_link(docxml)
62
+ embed_comment_in_comment_list(docxml)
63
+ end
74
64
 
75
- def move_comment_link_to_from1(x, fromlink)
76
- x.remove
77
- link = x.at(".//a")
78
- fromlink.replace(x)
79
- link.children = fromlink
80
- end
65
+ COMMENT_IN_COMMENT_LIST1 =
66
+ '//div[@style="mso-element:comment-list"]//'\
67
+ 'span[@style="MsoCommentReference"]'.freeze
68
+
69
+ def embed_comment_in_comment_list(docxml)
70
+ #docxml.xpath(COMMENT_IN_COMMENT_LIST).each do |x|
71
+ docxml.xpath(COMMENT_IN_COMMENT_LIST1).each do |x|
72
+ n = x.next_element
73
+ n&.children&.first&.add_previous_sibling(x.remove)
74
+ end
75
+ docxml
76
+ end
81
77
 
82
- def comment_attributes(docxml, x)
83
- fromlink = docxml.at("//*[@id='#{x['from']}']")
84
- return(nil) if fromlink.nil?
85
- tolink = docxml.at("//*[@id='#{x['to']}']") || fromlink
86
- target = docxml.at("//*[@id='#{x['target']}']")
87
- { from: fromlink, to: tolink, target: target }
88
- end
78
+ def move_comment_link_to_from1(x, fromlink)
79
+ x.remove
80
+ link = x.at(".//a")
81
+ fromlink.replace(x)
82
+ link.children = fromlink
83
+ end
89
84
 
90
- def wrap_comment_cont(from, target)
91
- s = from.replace("<span style='mso-comment-continuation:#{target}'>")
92
- s.first.children = from
93
- end
85
+ def comment_attributes(docxml, x)
86
+ fromlink = docxml.at("//*[@id='#{x['from']}']")
87
+ return(nil) if fromlink.nil?
88
+ tolink = docxml.at("//*[@id='#{x['to']}']") || fromlink
89
+ target = docxml.at("//*[@id='#{x['target']}']")
90
+ { from: fromlink, to: tolink, target: target }
91
+ end
94
92
 
95
- def skip_comment_wrap(from)
96
- from["style"] != "mso-special-character:comment"
97
- end
93
+ def wrap_comment_cont(from, target)
94
+ s = from.replace("<span style='mso-comment-continuation:#{target}'>")
95
+ s.first.children = from
96
+ end
98
97
 
99
- def insert_comment_cont(from, to, target)
100
- # includes_to = from.at(".//*[@id='#{to}']")
101
- while !from.nil? && from["id"] != to
102
- following = from.xpath("./following::*")
103
- (from = following.shift) && incl_to = from.at(".//*[@id='#{to}']")
104
- while !incl_to.nil? && !from.nil? && skip_comment_wrap(from)
105
- (from = following.shift) && incl_to = from.at(".//*[@id='#{to}']")
98
+ def skip_comment_wrap(from)
99
+ from["style"] != "mso-special-character:comment"
106
100
  end
107
- wrap_comment_cont(from, target) if !from.nil?
108
- end
109
- end
110
101
 
111
- def move_comment_link_to_from(docxml)
112
- docxml.xpath('//span[@style="MsoCommentReference"][@from]').each do |x|
113
- attrs = comment_attributes(docxml, x) || next
114
- move_comment_link_to_from1(x, attrs[:from])
115
- insert_comment_cont(attrs[:from], x["to"], x["target"])
116
- end
117
- end
102
+ def insert_comment_cont(from, to, target)
103
+ # includes_to = from.at(".//*[@id='#{to}']")
104
+ while !from.nil? && from["id"] != to
105
+ following = from.xpath("./following::*")
106
+ (from = following.shift) && incl_to = from.at(".//*[@id='#{to}']")
107
+ while !incl_to.nil? && !from.nil? && skip_comment_wrap(from)
108
+ (from = following.shift) && incl_to = from.at(".//*[@id='#{to}']")
109
+ end
110
+ wrap_comment_cont(from, target) if !from.nil?
111
+ end
112
+ end
118
113
 
119
- def get_comments_from_text(docxml, link_order)
120
- comments = []
121
- docxml.xpath("//div[@style='mso-element:comment']").each do |c|
122
- next unless c["id"] && !link_order[c["id"]].nil?
123
- comments << { text: c.remove.to_s, id: c["id"] }
124
- end
125
- comments.sort! { |a, b| link_order[a[:id]] <=> link_order[b[:id]] }
126
- # comments
127
- end
114
+ def move_comment_link_to_from(docxml)
115
+ docxml.xpath('//span[@style="MsoCommentReference"][@from]').each do |x|
116
+ attrs = comment_attributes(docxml, x) || next
117
+ move_comment_link_to_from1(x, attrs[:from])
118
+ insert_comment_cont(attrs[:from], x["to"], x["target"])
119
+ end
120
+ end
128
121
 
129
- COMMENT_TARGET_XREFS1 =
130
- "//span[@style='mso-special-character:comment']/@target".freeze
122
+ def get_comments_from_text(docxml, link_order)
123
+ comments = []
124
+ docxml.xpath("//div[@style='mso-element:comment']").each do |c|
125
+ next unless c["id"] && !link_order[c["id"]].nil?
126
+ comments << { text: c.remove.to_s, id: c["id"] }
127
+ end
128
+ comments.sort! { |a, b| link_order[a[:id]] <=> link_order[b[:id]] }
129
+ # comments
130
+ end
131
131
 
132
- def reorder_comments_by_comment_link(docxml)
133
- link_order = {}
134
- docxml.xpath(COMMENT_TARGET_XREFS1).each_with_index do |target, i|
135
- link_order[target.value] = i
132
+ COMMENT_TARGET_XREFS1 =
133
+ "//span[@style='mso-special-character:comment']/@target".freeze
134
+
135
+ def reorder_comments_by_comment_link(docxml)
136
+ link_order = {}
137
+ docxml.xpath(COMMENT_TARGET_XREFS1).each_with_index do |target, i|
138
+ link_order[target.value] = i
139
+ end
140
+ comments = get_comments_from_text(docxml, link_order)
141
+ list = docxml.at("//*[@style='mso-element:comment-list']") || return
142
+ list.children = comments.map { |c| c[:text] }.join("\n")
143
+ end
136
144
  end
137
- comments = get_comments_from_text(docxml, link_order)
138
- list = docxml.at("//*[@style='mso-element:comment-list']") || return
139
- list.children = comments.map { |c| c[:text] }.join("\n")
140
145
  end
@@ -5,9 +5,11 @@ require "liquid"
5
5
  require_relative "wordconvertmodule"
6
6
  require_relative "comments"
7
7
  require_relative "footnotes"
8
+ require_relative "postprocess"
8
9
 
9
10
  module IsoDoc
10
11
 
12
+ =begin
11
13
  module WordConvertModule
12
14
  # http://tech.tulentsev.com/2012/02/ruby-how-to-override-class-method-with-a-module/
13
15
  # https://www.ruby-forum.com/topic/148303
@@ -24,9 +26,10 @@ module IsoDoc
24
26
  end
25
27
  end
26
28
  end
29
+ =end
27
30
 
28
- class WordConvert < Convert
29
- include WordConvertModule
31
+ class WordConvert < Common
32
+ #include WordConvertModule
30
33
  end
31
34
  end
32
35
 
@@ -1,4 +1,7 @@
1
- def footnotes(div)
1
+ module IsoDoc
2
+ class WordConvert < Common
3
+
4
+ def footnotes(div)
2
5
  return if @footnotes.empty?
3
6
  @footnotes.each { |fn| div.parent << fn }
4
7
  end
@@ -66,3 +69,13 @@ def footnote_parse(node, out)
66
69
  @in_footnote = false
67
70
  @seen_footnote << fn
68
71
  end
72
+
73
+ def make_footnote(node, fn)
74
+ return if @seen_footnote.include?(fn)
75
+ @in_footnote = true
76
+ @footnotes << make_generic_footnote_text(node, fn)
77
+ @in_footnote = false
78
+ @seen_footnote << fn
79
+ end
80
+ end
81
+ end
@@ -1,4 +1,7 @@
1
- def postprocess(result, filename, dir)
1
+ module IsoDoc
2
+ class WordConvert < Common
3
+
4
+ def postprocess(result, filename, dir)
2
5
  generate_header(filename, dir)
3
6
  result = from_xhtml(cleanup(to_xhtml(result)))
4
7
  toWord(result, filename, dir)
@@ -53,7 +56,7 @@ end
53
56
  def generate_header(filename, _dir)
54
57
  return unless @header
55
58
  template = Liquid::Template.parse(File.read(@header, encoding: "UTF-8"))
56
- meta = get_metadata
59
+ meta = @meta.get
57
60
  meta[:filename] = filename
58
61
  params = meta.map { |k, v| [k.to_s, v] }.to_h
59
62
  File.open("header.html", "w") do |f|
@@ -107,4 +110,6 @@ def make_WordToC(docxml)
107
110
  end
108
111
  toc.sub(/(<p class="MsoToc1">)/,
109
112
  %{\\1#{WORD_TOC_PREFACE1}}) + WORD_TOC_SUFFIX1
113
+ end
114
+ end
110
115
  end
@@ -1,4 +1,13 @@
1
- def make_body2(body, docxml)
1
+ module IsoDoc
2
+ class WordConvert < Common
3
+ def make_body1(body, _docxml)
4
+ body.div **{ class: "WordSection1" } do |div1|
5
+ div1.p { |p| p << "&nbsp;" } # placeholder
6
+ end
7
+ section_break(body)
8
+ end
9
+
10
+ def make_body2(body, docxml)
2
11
  body.div **{ class: "WordSection2" } do |div2|
3
12
  info docxml, div2
4
13
  foreword docxml, div2
@@ -136,4 +145,6 @@ def figure_aside_process(f, aside, key)
136
145
  a.delete("class")
137
146
  a.parent = dd
138
147
  end
148
+ end
149
+ end
139
150
  end
@@ -1,7 +1,7 @@
1
1
  require "roman-numerals"
2
2
 
3
3
  module IsoDoc
4
- class Convert
4
+ class Common
5
5
  @anchors = {}
6
6
 
7
7
  def get_anchors
@@ -15,6 +15,7 @@ module IsoDoc
15
15
  def termnote_anchor_names(docxml)
16
16
  docxml.xpath(ns("//term[termnote]")).each do |t|
17
17
  t.xpath(ns("./termnote")).each_with_index do |n, i|
18
+ return if n["id"].nil? || n["id"].empty?
18
19
  @anchors[n["id"]] =
19
20
  { label: termnote_label(i + 1),
20
21
  xref: l10n("#{@anchors[t['id']][:xref]}, "\
@@ -26,6 +27,7 @@ module IsoDoc
26
27
  def termexample_anchor_names(docxml)
27
28
  docxml.xpath(ns("//term[termexample]")).each do |t|
28
29
  t.xpath(ns("./termexample")).each_with_index do |n, i|
30
+ return if n["id"].nil? || n["id"].empty?
29
31
  @anchors[n["id"]] =
30
32
  { label: (i + 1).to_s,
31
33
  xref: l10n("#{@anchors[t['id']][:xref]}, "\
@@ -48,7 +50,7 @@ module IsoDoc
48
50
  notes = s.xpath(CHILD_NOTES_XPATH)
49
51
  notes.each_with_index do |n, i|
50
52
  next if @anchors[n["id"]]
51
- next if n["id"].nil?
53
+ next if n["id"].nil? || n["id"].empty?
52
54
  idx = notes.size == 1 ? "" : " #{i + 1}"
53
55
  @anchors[n["id"]] = anchor_struct(idx, s, @note_xref_lbl)
54
56
  end
@@ -65,6 +67,7 @@ module IsoDoc
65
67
  notes = s.xpath(CHILD_EXAMPLES_XPATH)
66
68
  notes.each_with_index do |n, i|
67
69
  next if @anchors[n["id"]]
70
+ next if n["id"].nil? || n["id"].empty?
68
71
  idx = notes.size == 1 ? "" : " #{i + 1}"
69
72
  @anchors[n["id"]] = anchor_struct(idx, s, @example_xref_lbl)
70
73
  end
@@ -77,6 +80,7 @@ module IsoDoc
77
80
  notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
78
81
  s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
79
82
  notes.each_with_index do |n, i|
83
+ next if n["id"].nil? || n["id"].empty?
80
84
  idx = notes.size == 1 ? "" : " #{i + 1}"
81
85
  @anchors[n["id"]] = anchor_struct(idx, s, @list_lbl)
82
86
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
@@ -128,6 +132,7 @@ module IsoDoc
128
132
  i += 1
129
133
  end
130
134
  label = i.to_s + (j.zero? ? "" : "-#{j}")
135
+ next if t["id"].nil? || t["id"].empty?
131
136
  @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl)
132
137
  end
133
138
  end
@@ -159,10 +164,12 @@ module IsoDoc
159
164
 
160
165
  def sequential_asset_names(clause)
161
166
  clause.xpath(ns(".//table")).each_with_index do |t, i|
167
+ next if t["id"].nil? || t["id"].empty?
162
168
  @anchors[t["id"]] = anchor_struct(i + 1, nil, @table_lbl)
163
169
  end
164
170
  sequential_figure_names(clause)
165
171
  clause.xpath(ns(".//formula")).each_with_index do |t, i|
172
+ next if t["id"].nil? || t["id"].empty?
166
173
  @anchors[t["id"]] = anchor_struct(i + 1, t, @formula_lbl)
167
174
  end
168
175
  end
@@ -176,16 +183,19 @@ module IsoDoc
176
183
  i += 1
177
184
  end
178
185
  label = "#{num}.#{i}" + (j.zero? ? "" : "-#{j}")
186
+ next if t["id"].nil? || t["id"].empty?
179
187
  @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl)
180
188
  end
181
189
  end
182
190
 
183
191
  def hierarchical_asset_names(clause, num)
184
192
  clause.xpath(ns(".//table")).each_with_index do |t, i|
193
+ next if t["id"].nil? || t["id"].empty?
185
194
  @anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}", nil, @table_lbl)
186
195
  end
187
196
  hierarchical_figure_names(clause, num)
188
197
  clause.xpath(ns(".//formula")).each_with_index do |t, i|
198
+ next if t["id"].nil? || t["id"].empty?
189
199
  @anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}", t, @formula_lbl)
190
200
  end
191
201
  end