isodoc 1.0.22 → 1.0.27

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +12 -5
  3. data/.github/workflows/ubuntu.yml +27 -6
  4. data/.github/workflows/windows.yml +13 -7
  5. data/README.adoc +3 -2
  6. data/lib/isodoc-yaml/i18n-en.yaml +18 -1
  7. data/lib/isodoc-yaml/i18n-fr.yaml +18 -1
  8. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +18 -1
  9. data/lib/isodoc/base_style/bands.scss +6 -3
  10. data/lib/isodoc/base_style/reset.scss +1 -1
  11. data/lib/isodoc/convert.rb +1 -0
  12. data/lib/isodoc/function/blocks.rb +5 -0
  13. data/lib/isodoc/function/cleanup.rb +12 -1
  14. data/lib/isodoc/function/i18n.rb +5 -5
  15. data/lib/isodoc/function/inline.rb +47 -12
  16. data/lib/isodoc/function/references.rb +47 -33
  17. data/lib/isodoc/function/reqt.rb +21 -6
  18. data/lib/isodoc/function/section.rb +18 -8
  19. data/lib/isodoc/function/table.rb +0 -1
  20. data/lib/isodoc/function/to_word_html.rb +4 -2
  21. data/lib/isodoc/function/utils.rb +10 -4
  22. data/lib/isodoc/function/xref_gen.rb +2 -1
  23. data/lib/isodoc/function/xref_sect_gen.rb +24 -24
  24. data/lib/isodoc/headlesshtml_convert.rb +5 -0
  25. data/lib/isodoc/html_convert.rb +5 -0
  26. data/lib/isodoc/html_function/footnotes.rb +2 -2
  27. data/lib/isodoc/html_function/html.rb +3 -0
  28. data/lib/isodoc/html_function/postprocess.rb +3 -2
  29. data/lib/isodoc/metadata.rb +30 -7
  30. data/lib/isodoc/metadata_date.rb +39 -0
  31. data/lib/isodoc/pdf_convert.rb +5 -0
  32. data/lib/isodoc/version.rb +1 -1
  33. data/lib/isodoc/word_convert.rb +5 -0
  34. data/lib/isodoc/word_function/body.rb +0 -4
  35. data/lib/isodoc/word_function/footnotes.rb +2 -2
  36. data/lib/isodoc/word_function/postprocess.rb +13 -2
  37. data/lib/isodoc/word_function/table.rb +1 -3
  38. data/lib/isodoc/xslfo_convert.rb +5 -0
  39. data/spec/isodoc/blocks_spec.rb +188 -8
  40. data/spec/isodoc/cleanup_spec.rb +181 -18
  41. data/spec/isodoc/i18n_spec.rb +12 -12
  42. data/spec/isodoc/inline_spec.rb +65 -5
  43. data/spec/isodoc/metadata_spec.rb +77 -2
  44. data/spec/isodoc/postproc_spec.rb +33 -11
  45. data/spec/isodoc/ref_spec.rb +12 -6
  46. data/spec/isodoc/section_spec.rb +220 -205
  47. data/spec/isodoc/table_spec.rb +24 -24
  48. data/spec/isodoc/terms_spec.rb +50 -6
  49. data/spec/isodoc/xref_spec.rb +64 -26
  50. metadata +3 -2
@@ -9,24 +9,26 @@ module IsoDoc::Function
9
9
  end
10
10
 
11
11
  # TODO generate formatted ref if not present
12
- def nonstd_bibitem(list, b, ordinal, bibliography)
13
- list.p **attr_code(iso_bibitem_entry_attrs(b, bibliography)) do |r|
14
- id = bibitem_ref_code(b)
15
- identifier = render_identifier(id)
16
- if bibliography then ref_entry_code(r, ordinal, identifier, id)
12
+ def nonstd_bibitem(list, b, ordinal, biblio)
13
+ list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
14
+ ids = bibitem_ref_code(b)
15
+ identifiers = render_identifier(ids)
16
+ if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
17
17
  else
18
- r << "#{identifier}, "
18
+ ref << "#{identifiers[0] || identifiers[1]}, "
19
+ ref << "#{identifiers[1]}, " if identifiers[0] && identifiers[1]
19
20
  end
20
- reference_format(b, r)
21
+ reference_format(b, ref)
21
22
  end
22
23
  end
23
24
 
24
25
  def std_bibitem_entry(list, b, ordinal, biblio)
25
26
  list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
26
- prefix_bracketed_ref(ref, ordinal) if biblio
27
- id = bibitem_ref_code(b)
28
- identifier = render_identifier(id)
29
- ref << identifier
27
+ ids = bibitem_ref_code(b)
28
+ identifiers = render_identifier(ids)
29
+ prefix_bracketed_ref(ref, "[#{ordinal}]") if biblio
30
+ ref << "#{identifiers[0] || identifiers[1]}"
31
+ ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
30
32
  date_note_process(b, ref)
31
33
  ref << ", "
32
34
  reference_format(b, ref)
@@ -36,29 +38,43 @@ module IsoDoc::Function
36
38
  # if t is just a number, only use that ([1] Non-Standard)
37
39
  # else, use both ordinal, as prefix, and t
38
40
  def ref_entry_code(r, ordinal, t, id)
39
- if id["type"] == "metanorma"
40
- prefix_bracketed_ref(r, t)
41
- else
42
- prefix_bracketed_ref(r, ordinal)
43
- if !t.empty? && !%w(DOI ISSN ISBN).include?(id["type"])
44
- r << "#{t}, "
45
- end
41
+ prefix_bracketed_ref(r, t[0] || "[#{ordinal}]")
42
+ if t[1]
43
+ r << "#{t[1]}, "
46
44
  end
47
45
  end
48
46
 
47
+ def pref_ref_code(b)
48
+ b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
49
+ "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
50
+ end
51
+
52
+ # returns [metanorma, non-metanorma, DOI/ISSN/ISBN] identifiers
49
53
  def bibitem_ref_code(b)
50
54
  id = b.at(ns("./docidentifier[@type = 'metanorma']"))
51
- id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
52
- "or @type = 'ISSN' or @type = 'ISBN')]"))
53
- id ||= b.at(ns("./docidentifier"))
54
- return id if id
55
+ id1 = pref_ref_code(b)
56
+ id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN']"))
57
+ return [id, id1, id2] if id || id1 || id2
55
58
  id = Nokogiri::XML::Node.new("docidentifier", b.document)
56
59
  id << "(NO ID)"
57
- id
60
+ [nil, id, nil]
61
+ end
62
+
63
+ def bracket_if_num(x)
64
+ return nil if x.nil?
65
+ x = x.text.sub(/^\[/, "").sub(/\]$/, "")
66
+ return "[#{x}]" if /^\d+$/.match(x)
67
+ x
58
68
  end
59
69
 
60
70
  def render_identifier(id)
61
- docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
71
+ [
72
+ bracket_if_num(id[0]),
73
+ id[1].nil? ? nil :
74
+ docid_prefix(id[1]["type"], id[1].text.sub(/^\[/, "").sub(/\]$/, "")),
75
+ id[2].nil? ? nil :
76
+ docid_prefix(id[2]["type"], id[2].text.sub(/^\[/, "").sub(/\]$/, "")),
77
+ ]
62
78
  end
63
79
 
64
80
  def docid_prefix(prefix, docid)
@@ -98,7 +114,7 @@ module IsoDoc::Function
98
114
  end
99
115
 
100
116
  def prefix_bracketed_ref(ref, text)
101
- ref << "[#{text}]"
117
+ ref << text.to_s
102
118
  insert_tab(ref, 1)
103
119
  end
104
120
 
@@ -144,8 +160,7 @@ module IsoDoc::Function
144
160
  end
145
161
 
146
162
  def norm_ref(isoxml, out, num)
147
- q = "//bibliography/references[title = 'Normative References' or "\
148
- "title = 'Normative references']"
163
+ q = "//bibliography/references[@normative = 'true']"
149
164
  f = isoxml.at(ns(q)) or return num
150
165
  out.div do |div|
151
166
  num = num + 1
@@ -155,8 +170,8 @@ module IsoDoc::Function
155
170
  num
156
171
  end
157
172
 
158
- BIBLIOGRAPHY_XPATH = "//bibliography/clause[title = 'Bibliography'] | "\
159
- "//bibliography/references[title = 'Bibliography']".freeze
173
+ BIBLIOGRAPHY_XPATH = "//bibliography/clause[.//references[@normative = 'false']] | "\
174
+ "//bibliography/references[@normative = 'false']".freeze
160
175
 
161
176
  def bibliography(isoxml, out)
162
177
  f = isoxml.at(ns(BIBLIOGRAPHY_XPATH)) || return
@@ -186,12 +201,11 @@ module IsoDoc::Function
186
201
 
187
202
  def reference_names(ref)
188
203
  isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
189
- docid = bibitem_ref_code(ref)
190
- prefix = docid["type"]
204
+ ids = bibitem_ref_code(ref)
205
+ identifiers = render_identifier(ids)
191
206
  date = ref.at(ns("./date[@type = 'published']"))
192
207
  allparts = ref.at(ns("./extent[@type='part'][referenceFrom='all']"))
193
- reference = format_ref(docid_l10n(docid.text), prefix, isopub, date,
194
- allparts)
208
+ reference = docid_l10n(identifiers[0] || identifiers[1])
195
209
  @anchors[ref["id"]] = { xref: reference }
196
210
  end
197
211
 
@@ -20,17 +20,32 @@ module IsoDoc::Function
20
20
 
21
21
  def recommendation_attributes1(node)
22
22
  out = []
23
- oblig = node["obligation"] and out << "Obligation: #{oblig}"
24
- subj = node&.at(ns("./subject"))&.text and out << "Subject: #{subj}"
25
- node.xpath(ns("./inherit")).each { |i| out << "Inherit: #{i.text}" }
23
+ oblig = node["obligation"] and
24
+ out << l10n("#{@labels['obligation']}: #{oblig}")
25
+ subj = node&.at(ns("./subject"))&.text and
26
+ out << l10n("#{@labels['subject']}: #{subj}")
27
+ node.xpath(ns("./inherit")).each do |i|
28
+ out << recommendation_attr_parse(i, @labels["inherits"])
29
+ end
26
30
  node.xpath(ns("./classification")).each do |c|
27
- tag = c.at(ns("./tag")) or next
28
- value = c.at(ns("./value")) or next
29
- out << "#{tag.text.capitalize}: #{value.text}"
31
+ line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
30
32
  end
31
33
  out
32
34
  end
33
35
 
36
+ def recommendation_attr_parse(node, label)
37
+ noko do |xml|
38
+ xml << "#{label}: "
39
+ node.children.each { |n| parse(n, xml) }
40
+ end.join
41
+ end
42
+
43
+ def recommendation_attr_keyvalue(node, key, value)
44
+ tag = node.at(ns("./#{key}")) or return nil
45
+ value = node.at(ns("./#{value}")) or return nil
46
+ "#{tag.text.capitalize}: #{value.text}"
47
+ end
48
+
34
49
  def recommendation_attributes(node, out)
35
50
  ret = recommendation_attributes1(node)
36
51
  return if ret.empty?
@@ -109,20 +109,29 @@ module IsoDoc::Function
109
109
  num
110
110
  end
111
111
 
112
- def terms_defs_title(f)
113
- symbols = f.at(ns(".//definitions"))
114
- return @termsdefsymbols_lbl if symbols
115
- @termsdef_lbl
116
- end
117
-
118
112
  TERM_CLAUSE = "//sections/terms | "\
119
113
  "//sections/clause[descendant::terms]".freeze
120
114
 
115
+ def term_def_title(title)
116
+ case title&.text
117
+ when "Terms, definitions, symbols and abbreviated terms"
118
+ @labels["termsdefsymbolsabbrev"]
119
+ when "Terms, definitions and symbols"
120
+ @labels["termsdefsymbols"]
121
+ when "Terms, definitions and abbreviated terms"
122
+ @labels["termsdefabbrev"]
123
+ when "Terms and definitions"
124
+ @labels["termsdef"]
125
+ else
126
+ title
127
+ end
128
+ end
129
+
121
130
  def terms_defs(isoxml, out, num)
122
131
  f = isoxml.at(ns(TERM_CLAUSE)) or return num
123
132
  out.div **attr_code(id: f["id"]) do |div|
124
133
  num = num + 1
125
- clause_name(num, terms_defs_title(f), div, nil)
134
+ clause_name(num, term_def_title(f&.at(ns("./title"))), div, nil)
126
135
  f.elements.each do |e|
127
136
  parse(e, div) unless %w{title source}.include? e.name
128
137
  end
@@ -198,7 +207,8 @@ module IsoDoc::Function
198
207
 
199
208
  def preface(isoxml, out)
200
209
  title_attr = { class: "IntroTitle" }
201
- isoxml.xpath(ns("//preface/clause")).each do |f|
210
+ isoxml.xpath(ns("//preface/clause | //preface/terms | //preface/definitions | "\
211
+ "//preface/references")).each do |f|
202
212
  page_break(out)
203
213
  out.div **{ class: "Section3", id: f["id"] } do |div|
204
214
  clause_name(nil, f&.at(ns("./title")), div, title_attr)
@@ -91,7 +91,6 @@ module IsoDoc::Function
91
91
  style += <<~STYLE
92
92
  border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
93
93
  border-bottom:#{SW} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
94
- padding:0;
95
94
  STYLE
96
95
  header and scope = (td["colspan"] ? "colgroup" : "col")
97
96
  !header and td.name == "th" and scope =
@@ -21,7 +21,7 @@ module IsoDoc::Function
21
21
  filename = filepath.sub_ext('').to_s
22
22
  dir = "#{filename}_files"
23
23
  unless debug
24
- Dir.mkdir(dir) unless File.exists?(dir)
24
+ Dir.mkdir(dir, 0777) unless File.exists?(dir)
25
25
  FileUtils.rm_rf "#{dir}/*"
26
26
  end
27
27
  @filename = filename
@@ -157,7 +157,7 @@ module IsoDoc::Function
157
157
  when "clause" then clause_parse(node, out)
158
158
  when "xref" then xref_parse(node, out)
159
159
  when "eref" then eref_parse(node, out)
160
- when "origin" then eref_parse(node, out)
160
+ when "origin" then origin_parse(node, out)
161
161
  when "link" then link_parse(node, out)
162
162
  when "ul" then ul_parse(node, out)
163
163
  when "ol" then ol_parse(node, out)
@@ -210,6 +210,8 @@ module IsoDoc::Function
210
210
  when "license-statement" then license_parse(node, out)
211
211
  when "legal-statement" then legal_parse(node, out)
212
212
  when "feedback-statement" then feedback_parse(node, out)
213
+ when "passthrough" then passthrough_parse(node, out)
214
+ when "variant" then variant_parse(node, out)
213
215
  else
214
216
  error_parse(node, out)
215
217
  end
@@ -49,7 +49,12 @@ module IsoDoc::Function
49
49
  /^(\&[^ \t\r\n#;]+;)/.match(t) ?
50
50
  HTMLEntities.new.encode(HTMLEntities.new.decode(t), :hexadecimal) : t
51
51
  end.join("")
52
- Nokogiri::XML.parse(xml)
52
+ begin
53
+ Nokogiri::XML.parse(xml) { |config| config.strict }
54
+ rescue Nokogiri::XML::SyntaxError => e
55
+ File.open("#{@filename}.#{@format}.err", "w:UTF-8") { |f| f.write xml }
56
+ abort "Malformed Output XML for #{@format}: #{e} (see #{@filename}.#{@format}.err)"
57
+ end
53
58
  end
54
59
 
55
60
  def to_xhtml_fragment(xml)
@@ -64,7 +69,7 @@ module IsoDoc::Function
64
69
 
65
70
  CLAUSE_ANCESTOR =
66
71
  ".//ancestor::*[local-name() = 'annex' or "\
67
- "local-name() = 'acknowledgements' or "\
72
+ "local-name() = 'acknowledgements' or local-name() = 'term' or "\
68
73
  "local-name() = 'appendix' or local-name() = 'foreword' or "\
69
74
  "local-name() = 'introduction' or local-name() = 'terms' or "\
70
75
  "local-name() = 'clause' or local-name() = 'references']/@id".freeze
@@ -78,7 +83,7 @@ module IsoDoc::Function
78
83
  ".//ancestor::*[local-name() = 'annex' or "\
79
84
  "local-name() = 'foreword' or local-name() = 'appendix' or "\
80
85
  "local-name() = 'introduction' or local-name() = 'terms' or "\
81
- "local-name() = 'acknowledgements' or "\
86
+ "local-name() = 'acknowledgements' or local-name() = 'term' or "\
82
87
  "local-name() = 'clause' or local-name() = 'references' or "\
83
88
  "local-name() = 'figure' or local-name() = 'formula' or "\
84
89
  "local-name() = 'table' or local-name() = 'example']/@id".freeze
@@ -110,7 +115,8 @@ module IsoDoc::Function
110
115
  end
111
116
 
112
117
  def header_strip(h)
113
- h = h.to_s.gsub(%r{<br/>}, " ").sub(/<\/?h[123456][^>]*>/, "")
118
+ h = h.to_s.gsub(%r{<br\s*/>}, " ").gsub(/<\/?h[123456][^>]*>/, "").
119
+ gsub(/<\/?b[^>]*>/, "")
114
120
  h1 = to_xhtml_fragment(h.dup)
115
121
  h1.traverse do |x|
116
122
  x.replace(" ") if x.name == "span" && /mso-tab-count/.match(x["style"])
@@ -40,6 +40,7 @@ module IsoDoc::Function
40
40
 
41
41
  SECTIONS_XPATH =
42
42
  "//foreword | //introduction | //acknowledgements | //preface/clause | "\
43
+ "//preface/terms | preface/definitions | preface/references | "\
43
44
  "//sections/terms | //annex | "\
44
45
  "//sections/clause | //sections/definitions | "\
45
46
  "//bibliography/references | //bibliography/clause".freeze
@@ -68,7 +69,7 @@ module IsoDoc::Function
68
69
  "not(self::xmlns:terms) and not(self::xmlns:definitions)]//"\
69
70
  "xmlns:example | ./xmlns:example".freeze
70
71
 
71
- CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions"
72
+ CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | ./references"
72
73
 
73
74
  def example_anchor_names(sections)
74
75
  sections.each do |s|
@@ -5,10 +5,9 @@ module IsoDoc::Function
5
5
  annex_names(c, (65 + i).chr.to_s)
6
6
  end
7
7
  docxml.xpath(
8
- ns("//bibliography/clause[not(xmlns:title = 'Normative References' or "\
9
- "xmlns:title = 'Normative references')] |"\
10
- "//bibliography/references[not(xmlns:title = 'Normative References'"\
11
- " or xmlns:title = 'Normative references')]")).each do |b|
8
+ ns("//bibliography/clause[.//references[@normative = 'false']] | "\
9
+ "//bibliography/references[@normative = 'false']"
10
+ )).each do |b|
12
11
  preface_names(b)
13
12
  end
14
13
  docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
@@ -17,23 +16,13 @@ module IsoDoc::Function
17
16
  end
18
17
 
19
18
  def initial_anchor_names(d)
20
- preface_names(d.at(ns("//preface/abstract")))
21
- preface_names(d.at(ns("//foreword")))
22
- preface_names(d.at(ns("//introduction")))
23
- d.xpath(ns("//preface/clause")).each do |c|
24
- preface_names(c)
25
- end
26
- preface_names(d.at(ns("//acknowledgements")))
19
+ d.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
27
20
  # potentially overridden in middle_section_asset_names()
28
- sequential_asset_names(
29
- d.xpath(ns("//preface/abstract | //foreword | //introduction | "\
30
- "//preface/clause | //acknowledgements")))
21
+ sequential_asset_names(d.xpath(ns("//preface/*")))
31
22
  n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
32
23
  n = section_names(d.at(ns(
33
- "//bibliography/clause[title = 'Normative References' or "\
34
- "title = 'Normative references'] |"\
35
- "//bibliography/references[title = 'Normative References' or "\
36
- "title = 'Normative references']")), n, 1)
24
+ "//bibliography/clause[.//references[@normative = 'true']] | "\
25
+ "//bibliography/references[@normative = 'true']")), n, 1)
37
26
  n = section_names(d.at(ns("//sections/terms | "\
38
27
  "//sections/clause[descendant::terms]")), n, 1)
39
28
  n = section_names(d.at(ns("//sections/definitions")), n, 1)
@@ -76,10 +65,8 @@ module IsoDoc::Function
76
65
 
77
66
  def middle_section_asset_names(d)
78
67
  middle_sections = "//clause[title = 'Scope'] | "\
79
- "//references[title = 'Normative References' or title = "\
80
- "'Normative references'] | "\
81
- "//sections/terms | //preface/abstract | //foreword | "\
82
- "//introduction | //preface/clause | //acknowledgements "\
68
+ "//references[@normative = 'true'] | "\
69
+ "//sections/terms | //preface/* | "\
83
70
  "//sections/definitions | //clause[parent::sections]"
84
71
  sequential_asset_names(d.xpath(ns(middle_sections)))
85
72
  end
@@ -120,12 +107,25 @@ module IsoDoc::Function
120
107
  l10n("<b>#{@annex_lbl} #{num}</b><br/>#{obl}")
121
108
  end
122
109
 
110
+ def single_annex_special_section(clause)
111
+ a = clause.xpath(ns("./references | ./terms | ./definitions"))
112
+ a.size == 1 or return nil
113
+ clause.xpath(ns("./clause | ./p | ./table | ./ol | ./ul | ./dl | "\
114
+ "./note | ./admonition | ./figure")).size == 0 or
115
+ return nil
116
+ a[0]
117
+ end
118
+
123
119
  def annex_names(clause, num)
124
120
  @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
125
121
  type: "clause",
126
122
  xref: "#{@annex_lbl} #{num}", level: 1 }
127
- clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
128
- annex_names1(c, "#{num}.#{i + 1}", 2)
123
+ if a = single_annex_special_section(clause)
124
+ annex_names1(a, "#{num}", 1)
125
+ else
126
+ clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
127
+ annex_names1(c, "#{num}.#{i + 1}", 2)
128
+ end
129
129
  end
130
130
  hierarchical_asset_names(clause, num)
131
131
  end
@@ -14,6 +14,11 @@ module IsoDoc
14
14
  "_headlessimages"
15
15
  end
16
16
 
17
+ def initialize(options)
18
+ @format = :html
19
+ super
20
+ end
21
+
17
22
  def convert(filename, file = nil, debug = false)
18
23
  file = File.read(filename, encoding: "utf-8") if file.nil?
19
24
  @openmathdelim, @closemathdelim = extract_delims(file)
@@ -14,6 +14,11 @@ module IsoDoc
14
14
  "_htmlimages"
15
15
  end
16
16
 
17
+ def initialize(options)
18
+ @format = :html
19
+ super
20
+ end
21
+
17
22
  def convert(filename, file = nil, debug = false)
18
23
  ret = super
19
24
  Dir.exists?(tmpimagedir) and Dir["#{tmpimagedir}/*"].empty? and
@@ -48,7 +48,7 @@ module IsoDoc::HtmlFunction
48
48
  end
49
49
 
50
50
  def table_footnote_parse(node, out)
51
- fn = node["reference"]
51
+ fn = node["reference"] || UUIDTools::UUID.random_create.to_s
52
52
  tid = get_table_ancestor_id(node)
53
53
  make_table_footnote_link(out, tid + fn, fn)
54
54
  # do not output footnote text if we have already seen it for this table
@@ -64,7 +64,7 @@ module IsoDoc::HtmlFunction
64
64
  def footnote_parse(node, out)
65
65
  return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
66
66
  !node.ancestors.map {|m| m.name }.include?("name")
67
- fn = node["reference"]
67
+ fn = node["reference"] || UUIDTools::UUID.random_create.to_s
68
68
  attrs = { "epub:type": "footnote", rel: "footnote", href: "#fn:#{fn}" }
69
69
  out.a **attrs do |a|
70
70
  a.sup { |sup| sup << fn }
@@ -97,5 +97,8 @@ module IsoDoc::HtmlFunction
97
97
  end
98
98
  sourcecode_name_parse(node, out, name)
99
99
  end
100
+
101
+ def table_long_strings_cleanup(docxml)
102
+ end
100
103
  end
101
104
  end