isodoc 3.1.0 → 3.1.2

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +3 -12
  3. data/lib/isodoc/common.rb +2 -0
  4. data/lib/isodoc/css.rb +36 -23
  5. data/lib/isodoc/function/blocks.rb +12 -0
  6. data/lib/isodoc/function/cleanup.rb +4 -12
  7. data/lib/isodoc/function/footnotes.rb +57 -0
  8. data/lib/isodoc/function/inline.rb +10 -6
  9. data/lib/isodoc/function/section.rb +7 -0
  10. data/lib/isodoc/function/setup.rb +64 -0
  11. data/lib/isodoc/function/table.rb +2 -0
  12. data/lib/isodoc/function/to_word_html.rb +5 -57
  13. data/lib/isodoc/function/utils.rb +4 -7
  14. data/lib/isodoc/gem_tasks.rb +16 -16
  15. data/lib/isodoc/headlesshtml_convert.rb +0 -2
  16. data/lib/isodoc/html_convert.rb +0 -2
  17. data/lib/isodoc/html_function/postprocess.rb +2 -1
  18. data/lib/isodoc/html_function/postprocess_footnotes.rb +2 -1
  19. data/lib/isodoc/pdf_convert.rb +0 -2
  20. data/lib/isodoc/presentation_function/block.rb +21 -25
  21. data/lib/isodoc/presentation_function/concepts.rb +7 -8
  22. data/lib/isodoc/presentation_function/erefs.rb +2 -3
  23. data/lib/isodoc/presentation_function/footnotes.rb +140 -0
  24. data/lib/isodoc/presentation_function/image.rb +0 -18
  25. data/lib/isodoc/presentation_function/inline.rb +11 -13
  26. data/lib/isodoc/presentation_function/refs.rb +9 -4
  27. data/lib/isodoc/presentation_function/sourcecode.rb +2 -19
  28. data/lib/isodoc/presentation_xml_convert.rb +3 -1
  29. data/lib/isodoc/version.rb +1 -1
  30. data/lib/isodoc/word_function/body.rb +5 -3
  31. data/lib/isodoc/word_function/footnotes.rb +57 -68
  32. data/lib/isodoc/word_function/postprocess.rb +6 -2
  33. data/lib/isodoc/xref/xref_gen.rb +1 -9
  34. data/lib/isodoc/xref/xref_gen_seq.rb +47 -92
  35. data/lib/isodoc/xref/xref_util.rb +49 -0
  36. metadata +36 -6
  37. data/lib/isodoc/html_function/footnotes.rb +0 -92
@@ -8,7 +8,8 @@ module IsoDoc
8
8
  def lower2cap(text)
9
9
  text.nil? and return text
10
10
  x = Nokogiri::XML("<a>#{text}</a>")
11
- firsttext = x.at(".//text()[string-length(normalize-space(.))>0]") or return text
11
+ firsttext = x.at(".//text()[string-length(normalize-space(.))>0]") or
12
+ return text
12
13
  /^[[:upper:]][[:upper:]]/.match?(firsttext.text) and return text
13
14
  firsttext.replace(firsttext.text.capitalize)
14
15
  to_xml(x.root.children)
@@ -80,7 +81,6 @@ module IsoDoc
80
81
  end
81
82
 
82
83
  def admonition_numbered1(elem)
83
- # elem["unnumbered"] && !elem.at(ns("./name")) and return
84
84
  label = admonition_label(elem, @xrefs.anchor(elem["id"], :label, false))
85
85
  prefix_name(elem, { caption: block_delim }, label, "name")
86
86
  end
@@ -88,8 +88,6 @@ module IsoDoc
88
88
  def admonition_label(elem, num)
89
89
  lbl = if elem["type"] == "box" then @i18n.box
90
90
  else @i18n.admonition[elem["type"]]&.upcase end
91
- #lbl &&= "<span class='fmt-element-name'>#{lbl}</span>"
92
- #num and lbl = l10n("#{lbl} #{autonum(elem['id'], num)}")
93
91
  labelled_autonum(lbl, elem["id"], num)
94
92
  end
95
93
 
@@ -107,8 +105,6 @@ module IsoDoc
107
105
  labelled_ancestor(elem) and return
108
106
  elem["unnumbered"] && !elem.at(ns("./name")) and return
109
107
  n = @xrefs.anchor(elem["id"], :label, false)
110
- #lbl = "<span class='fmt-element-name'>#{lower2cap @i18n.table}</span> "\
111
- #"#{autonum(elem['id'], n)}"
112
108
  lbl = labelled_autonum(lower2cap(@i18n.table), elem["id"], n)
113
109
  prefix_name(elem, { caption: table_delim }, l10n(lbl), "name")
114
110
  end
@@ -128,15 +124,6 @@ module IsoDoc
128
124
  end
129
125
  end
130
126
 
131
- def table_fn(elem)
132
- (elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn")))
133
- .each_with_index do |f, i|
134
- table_fn1(elem, f, i)
135
- end
136
- end
137
-
138
- def table_fn1(table, fnote, idx); end
139
-
140
127
  def amend(docxml)
141
128
  docxml.xpath(ns("//amend")).each { |f| amend1(f) }
142
129
  end
@@ -233,19 +220,28 @@ module IsoDoc
233
220
  author = elem.at(ns("./author"))
234
221
  source = elem.at(ns("./source"))
235
222
  author.nil? && source.nil? and return
223
+ p = quote_attribution(author, source, elem)
224
+ elem << "<attribution><p>#{l10n p}</p></attribution>"
225
+ end
226
+
227
+ # e["deleteme"]: duplicate of source, will be duplicated in fmt-eref,
228
+ # need to delete after
229
+ def quote_attribution(author, source, elem)
236
230
  p = "&#x2014; "
237
231
  p += to_xml(semx_fmt_dup(author)) if author
238
232
  p += ", " if author && source
239
- if source
240
- s = semx_fmt_dup(source)
241
- e = Nokogiri::XML::Node.new("eref", elem.document)
242
- e << s.children
243
- s << e
244
- source.attributes.each_key { |k| e[k] = source[k] }
245
- e["deleteme"] = "true" # duplicate of source, will be duplicated in fmt-eref, need to delete after
246
- p += to_xml(s)
247
- end
248
- elem << "<attribution><p>#{l10n p}</p></attribution>"
233
+ source or return p
234
+ p + to_xml(quote_source(source, elem))
235
+ end
236
+
237
+ def quote_source(source, elem)
238
+ s = semx_fmt_dup(source)
239
+ e = Nokogiri::XML::Node.new("eref", elem.document)
240
+ e << s.children
241
+ s << e
242
+ source.attributes.each_key { |k| e[k] = source[k] }
243
+ e["deleteme"] = "true"
244
+ s
249
245
  end
250
246
  end
251
247
  end
@@ -20,7 +20,6 @@ module IsoDoc
20
20
  end
21
21
 
22
22
  def concept_render(node, defaults)
23
- #require "debug"; binding.b
24
23
  opts, render, ref, ret = concept_render_init(node, defaults)
25
24
  ret&.at(ns("./refterm"))&.remove
26
25
  ref && opts[:ref] != "false" and render&.next = " "
@@ -31,7 +30,8 @@ module IsoDoc
31
30
  end
32
31
 
33
32
  def concept_dup(node, ret)
34
- node.xpath(".//xmlns:semx[xmlns:fmt-xref | xmlns:fmt-eref | xmlns:fmt-origin | xmlns:fmt-link]").each(&:remove)
33
+ node.xpath(".//xmlns:semx[xmlns:fmt-xref | xmlns:fmt-eref | " \
34
+ "xmlns:fmt-origin | xmlns:fmt-link]").each(&:remove)
35
35
  ret.xpath(ns(".//xref | .//eref | .//origin | .//link")).each(&:remove)
36
36
  ret.xpath(ns(".//semx")).each do |s|
37
37
  s.children.empty? and s.remove
@@ -66,10 +66,11 @@ module IsoDoc
66
66
  (opts[:linkmention] == "true" && !renderterm.nil? && !ref.nil?) or return
67
67
  ref2 = ref.clone
68
68
  r2 = renderterm.clone
69
- #renderterm.replace(ref2).children = r2
70
69
  ref2.children = r2
71
70
  if ref.parent.name == "semx"
72
- renderterm.replace("<semx element='#{ref.parent['element']}' source='#{ref.parent['source']}'>#{to_xml(ref2)}</semx>")
71
+ renderterm.replace(<<~SEMX)
72
+ <semx element='#{ref.parent['element']}' source='#{ref.parent['source']}'>#{to_xml(ref2)}</semx>
73
+ SEMX
73
74
  else
74
75
  renderterm.replace(ref2)
75
76
  end
@@ -103,7 +104,7 @@ module IsoDoc
103
104
  p, ref, orig = related1_prep(node)
104
105
  label = @i18n.relatedterms[orig["type"]].upcase
105
106
  if p && ref
106
- node.children =(l10n("<p><strong>#{label}:</strong> " \
107
+ node.children = (l10n("<p><strong>#{label}:</strong> " \
107
108
  "<em>#{to_xml(p)}</em> (#{Common::to_xml(ref)})</p>"))
108
109
  else
109
110
  node.children = (l10n("<p><strong>#{label}:</strong> " \
@@ -198,8 +199,6 @@ module IsoDoc
198
199
  def designation_annotate(desgn, name, orig)
199
200
  designation_boldface(desgn)
200
201
  designation_field(desgn, name, orig)
201
- #g = desgn.at(ns("./expression/grammar")) and
202
- #name << ", #{designation_grammar(g).join(', ')}"
203
202
  designation_grammar(desgn, name)
204
203
  designation_localization(desgn, name, orig)
205
204
  designation_pronunciation(desgn, name)
@@ -213,7 +212,7 @@ module IsoDoc
213
212
  name.children = "<strong>#{name.children}</strong>"
214
213
  end
215
214
 
216
- def designation_field(desgn, name, orig)
215
+ def designation_field(_desgn, name, orig)
217
216
  f = orig.xpath(ns("./field-of-application | ./usage-info"))
218
217
  &.map { |u| to_xml(semx_fmt_dup(u)) }&.join(", ")
219
218
  f&.empty? and return nil
@@ -5,7 +5,7 @@ module IsoDoc
5
5
  def citeas(xmldoc)
6
6
  xmldoc.xpath(ns("//fmt-eref | //fmt-origin | //fmt-link"))
7
7
  .each do |e|
8
- sem_xml_descendant?(e) and next
8
+ sem_xml_descendant?(e) and next
9
9
  e["bibitemid"] && e["citeas"] or next
10
10
  a = @xrefs.anchor(e["bibitemid"], :xref, false) or next
11
11
  e["citeas"] = citeas_cleanup(a)
@@ -35,7 +35,6 @@ module IsoDoc
35
35
  ret = resolve_eref_connectives(locs)
36
36
  elem["id"] ||= "_#{UUIDTools::UUID.random_create}"
37
37
  elem.next = "<semx element='erefstack' source='#{elem['id']}'>#{ret[1]}</semx>"
38
- #elem.replace(ret[1])
39
38
  end
40
39
 
41
40
  def eref_localities(refs, target, node)
@@ -198,7 +197,7 @@ module IsoDoc
198
197
  docxml.xpath(ns("//display-text")).each { |f| f.replace(f.children) }
199
198
  docxml.xpath(ns("//fmt-eref | //fmt-origin[not(.//termref)]"))
200
199
  .each do |e|
201
- sem_xml_descendant?(e) and next
200
+ sem_xml_descendant?(e) and next
202
201
  href = eref_target(e) or next
203
202
  e.xpath(ns("./locality | ./localityStack")).each(&:remove)
204
203
  if href[:type] == :anchor then eref2xref(e)
@@ -0,0 +1,140 @@
1
+ module IsoDoc
2
+ class PresentationXMLConvert < ::IsoDoc::Convert
3
+ def footnote_collect(fnotes)
4
+ seen = {}
5
+ fnotes.each_with_object([]) do |x, m|
6
+ x["id"] ||= "_#{UUIDTools::UUID.random_create}"
7
+ seen[x["reference"]] or m << fnbody(x, seen)
8
+ x["target"] = seen[x["reference"]]
9
+ ref = x["hiddenref"] == "true" ? "" : fn_ref_label(x)
10
+ x << "<fmt-fn-label>#{ref}</fmt-fn-label>"
11
+ end
12
+ end
13
+
14
+ def footnote_container(fnotes, fnbodies)
15
+ fnbodies.empty? and return
16
+ ctr = Nokogiri::XML::Node.new("fmt-footnote-container",
17
+ fnotes.first.document)
18
+ fnbodies.each { |x| ctr << x }
19
+ ctr
20
+ end
21
+
22
+ def fnbody(fnote, seen)
23
+ body = Nokogiri::XML::Node.new("fmt-fn-body", fnote.document)
24
+ body["id"] = "_#{UUIDTools::UUID.random_create}"
25
+ body["target"] = fnote["id"]
26
+ body["reference"] = fnote["reference"]
27
+ body << semx_fmt_dup(fnote)
28
+ insert_fn_body_ref(fnote, body)
29
+ seen[fnote["reference"]] = body["id"]
30
+ body
31
+ end
32
+
33
+ def insert_fn_body_ref(fnote, body)
34
+ ins = body.at(ns(".//p")) ||
35
+ body.at(ns("./semx")).children.first.before("<p> </p>").previous
36
+ lbl = fn_body_label(fnote)
37
+ ins.children.first.previous = <<~FNOTE.strip
38
+ <fmt-fn-label>#{lbl}<span class="fmt-caption-delim"><tab/></fmt-fn-label>
39
+ FNOTE
40
+ end
41
+
42
+ def fn_ref_label(fnote)
43
+ "<sup>#{fn_label(fnote)}</sup>"
44
+ end
45
+
46
+ def fn_body_label(fnote)
47
+ "<sup>#{fn_label(fnote)}</sup>"
48
+ end
49
+
50
+ def fn_label(fnote)
51
+ <<~FNOTE.strip
52
+ <semx element="autonum" source="#{fnote['id']}">#{fnote['reference']}</semx>
53
+ FNOTE
54
+ end
55
+
56
+ def table_fn(elem)
57
+ fnotes = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn"))
58
+ ret = footnote_collect(fnotes)
59
+ f = footnote_container(fnotes, ret) and elem << f
60
+ end
61
+
62
+ def document_footnotes(docxml)
63
+ sects = sort_footnote_sections(docxml)
64
+ excl = non_document_footnotes(docxml)
65
+ fns = filter_document_footnotes(sects, excl)
66
+ fns = renumber_document_footnotes(fns, 1)
67
+ ret = footnote_collect(fns)
68
+ f = footnote_container(fns, ret) and docxml.root << f
69
+ end
70
+
71
+ # bibdata, boilerplate, @displayorder sections
72
+ def sort_footnote_sections(docxml)
73
+ sects = docxml.xpath(".//*[@displayorder]")
74
+ .sort_by { |c| c["displayorder"].to_i }
75
+ b = docxml.at(ns("//boilerplate")) and sects.unshift b
76
+ b = docxml.at(ns("//bibdata")) and sects.unshift b
77
+ sects
78
+ end
79
+
80
+ def non_document_footnotes(docxml)
81
+ table_fns = docxml.xpath(ns("//table//fn")) -
82
+ docxml.xpath(ns("//table/name//fn"))
83
+ fig_fns = docxml.xpath(ns("//figure//fn")) -
84
+ docxml.xpath(ns("//figure/name//fn"))
85
+ table_fns + fig_fns
86
+ end
87
+
88
+ def filter_document_footnotes(sects, excl)
89
+ sects.each_with_object([]) do |s, m|
90
+ docfns = s.xpath(ns(".//fn")) - excl
91
+ m << docfns
92
+ end
93
+ end
94
+
95
+ # can instead restart at i=1 each section
96
+ def renumber_document_footnotes(fns_by_section, idx)
97
+ fns_by_section.reject(&:empty?).each_with_object({}) do |s, seen|
98
+ s.each do |f|
99
+ idx = renumber_document_footnote(f, idx, seen)
100
+ end
101
+ end
102
+ fns_by_section.flatten
103
+ end
104
+
105
+ def renumber_document_footnote(fnote, idx, seen)
106
+ fnote["original-reference"] = fnote["reference"]
107
+ if seen[fnote["reference"]]
108
+ fnote["reference"] = seen[fnote["reference"]]
109
+ else
110
+ seen[fnote["reference"]] = idx
111
+ fnote["reference"] = idx
112
+ idx += 1
113
+ end
114
+ idx
115
+ end
116
+
117
+ # move footnotes into key
118
+ def figure_fn(elem)
119
+ fn = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn"))
120
+ fn.empty? and return
121
+ dl = figure_key_insert_pt(elem)
122
+ footnote_collect(fn).each do |f|
123
+ label, fbody = figure_fn_to_dt_dd(f)
124
+ dl.previous = "<dt><p>#{to_xml(label)}</p></dt><dd>#{to_xml(fbody)}</dd>"
125
+ end
126
+ end
127
+
128
+ def figure_fn_to_dt_dd(f)
129
+ label = f.at(ns(".//fmt-fn-label")).remove
130
+ label.at(ns(".//span[@class = 'fmt-caption-delim']"))&.remove
131
+ [label, f]
132
+ end
133
+
134
+ def figure_key_insert_pt(elem)
135
+ elem.at(ns(".//dl/name"))&.next ||
136
+ elem.at(ns(".//dl"))&.children&.first ||
137
+ elem.add_child("<dl> </dl>").first.children.first
138
+ end
139
+ end
140
+ end
@@ -73,24 +73,6 @@ module IsoDoc
73
73
  prefix_name(elem, { caption: figure_delim(elem) }, l10n(s&.strip), "name")
74
74
  end
75
75
 
76
- # move footnotes into key, and get rid of footnote reference
77
- # since it is in diagram
78
- def figure_fn(elem)
79
- fn = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn"))
80
- fn.empty? and return
81
- dl = figure_key_insert_pt(elem)
82
- fn.each do |f|
83
- dl.previous = "<dt><p><sup>#{f['reference']}</sup></p></dt>" \
84
- "<dd>#{f.remove.children.to_xml}</dd>"
85
- end
86
- end
87
-
88
- def figure_key_insert_pt(elem)
89
- elem.at(ns("//dl/name"))&.next ||
90
- elem.at(ns("//dl"))&.children&.first ||
91
- elem.add_child("<dl> </dl>").first.children.first
92
- end
93
-
94
76
  def figure_label?(elem)
95
77
  elem.at(ns("./figure")) && !elem.at(ns("./name")) and return false
96
78
  true
@@ -39,16 +39,19 @@ module IsoDoc
39
39
  def anchor_id_postprocess(node); end
40
40
 
41
41
  def xref(docxml)
42
- #docxml.xpath(ns("//display-text")).each { |f| f.replace(f.children) }
43
42
  docxml.xpath(ns("//fmt-xref")).each { |f| xref1(f) }
44
- docxml.xpath(ns("//fmt-xref//fmt-xref")).each { |f| f.replace(f.children) }
43
+ docxml.xpath(ns("//fmt-xref//fmt-xref")).each do |f|
44
+ f.replace(f.children)
45
+ end
45
46
  docxml.xpath(ns("//fmt-xref//xref")).each { |f| f.replace(f.children) }
46
47
  end
47
48
 
48
49
  def eref(docxml)
49
50
  docxml.xpath(ns("//eref[@deleteme]")).each { |f| redundant_eref(f) }
50
51
  docxml.xpath(ns("//fmt-eref")).each { |f| xref1(f) }
51
- docxml.xpath(ns("//fmt-eref//fmt-xref")).each { |f| f.replace(f.children) }
52
+ docxml.xpath(ns("//fmt-eref//fmt-xref")).each do |f|
53
+ f.replace(f.children)
54
+ end
52
55
  docxml.xpath(ns("//erefstack")).each { |f| erefstack1(f) }
53
56
  end
54
57
 
@@ -65,19 +68,14 @@ module IsoDoc
65
68
  docxml.xpath(ns("//fmt-origin[not(.//termref)]")).each { |f| xref1(f) }
66
69
  end
67
70
 
68
- # KILL
69
- def quotesourcex(docxml)
70
- docxml.xpath(ns("//quote//source")).each { |f| xref1(f) }
71
- docxml.xpath(ns("//quote//source//xref")).each do |f|
72
- f.replace(f.children)
73
- end
74
- end
75
-
76
71
  # do not change to Presentation XML rendering
77
72
  def sem_xml_descendant?(node)
78
73
  !node.ancestors("preferred, admitted, deprecated, related, " \
79
74
  "definition, termsource").empty? and return true
80
75
  !node.ancestors("xref, eref, origin, link").empty? and return true
76
+ !node.ancestors("name, title").empty? and return true
77
+ node.ancestors("bibitem") &&
78
+ !node.ancestors("formattedref, biblio-tag") and return true
81
79
  !node.ancestors("requirement, recommendation, permission").empty? &&
82
80
  node.ancestors("fmt-provision").empty? and return true
83
81
  false
@@ -112,8 +110,8 @@ module IsoDoc
112
110
  docxml.xpath(ns("//identifier")).each do |n|
113
111
  %w(bibdata bibitem requirement recommendation permission)
114
112
  .include?(n.parent.name) and next
115
- s = semx_fmt_dup(n)
116
- n.next = "<fmt-identifier><tt>#{to_xml(s)}</tt></fmt-identifier>"
113
+ s = semx_fmt_dup(n)
114
+ n.next = "<fmt-identifier><tt>#{to_xml(s)}</tt></fmt-identifier>"
117
115
  end
118
116
  end
119
117
 
@@ -86,10 +86,15 @@ module IsoDoc
86
86
  def bibrender_formattedref(formattedref, xml); end
87
87
 
88
88
  def bibrender_relaton(xml, renderings)
89
- f = renderings[xml["id"]][:formattedref]
89
+ f = renderings[xml["id"]][:formattedref] or return
90
90
  f &&= "<formattedref>#{f}</formattedref>"
91
- x = xml.xpath(ns("./docidentifier | ./uri | ./note | ./biblio-tag"))
92
- xml.children = "#{f}#{x.to_xml}"
91
+ if x = xml.at(ns("./formattedref"))
92
+ x.replace(f)
93
+ elsif xml.children.empty?
94
+ xml << f
95
+ else
96
+ xml.children.first.previous = f
97
+ end
93
98
  end
94
99
 
95
100
  def citestyle
@@ -205,7 +210,7 @@ module IsoDoc
205
210
  ret = ident_fn(bib)
206
211
  date_note = bib.at(ns("./note[@type = 'Unpublished-Status']"))
207
212
  date_note.nil? and return ret
208
- id = UUIDTools::UUID.random_create.to_s
213
+ id = "_#{UUIDTools::UUID.random_create}"
209
214
  "#{ret}<fn reference='#{id}'><p>#{date_note.content}</p></fn>"
210
215
  end
211
216
 
@@ -42,7 +42,7 @@ module IsoDoc
42
42
  sourcehighlighter_css(docxml)
43
43
  @highlighter = sourcehighlighter
44
44
  @callouts = {}
45
- (docxml.xpath(ns("//sourcecode")) -
45
+ (docxml.xpath(ns("//sourcecode")) -
46
46
  docxml.xpath(ns("//metanorma-extension//sourcecode")))
47
47
  .each do |f|
48
48
  sourcecode1(f)
@@ -52,7 +52,6 @@ module IsoDoc
52
52
  def sourcecode1(elem)
53
53
  ret1 = semx_fmt_dup(elem)
54
54
  b = ret1.at(ns(".//body")) and b.replace(b.children)
55
- #sourcecode_annot_id(elem)
56
55
  source_label(elem)
57
56
  source_highlight(ret1, elem["linenums"] == "true", elem["lang"])
58
57
  callouts(elem)
@@ -68,25 +67,11 @@ module IsoDoc
68
67
  elem << ret
69
68
  end
70
69
 
71
- # KILL
72
- def sourcecode_annot_id(elem)
73
- elem.xpath(ns("./annotation")).each do |a|
74
- if a["original-id"]
75
- a["id"] = a["original-id"]
76
- a.delete("original-id")
77
- end
78
- a.xpath(".//*[@original-id]").each do |n|
79
- n["id"] = n["original-id"]
80
- n.delete("original-id")
81
- end
82
- end
83
- end
84
-
85
70
  def annotations(elem, fmt_elem)
86
71
  elem.at(ns("./annotation")) or return
87
72
  ret = ""
88
73
  elem.xpath(ns("./annotation")).each do |a|
89
- id = a['original-id']
74
+ id = a["original-id"]
90
75
  dd = semx_fmt_dup(a)
91
76
  dd["source"] = a["id"]
92
77
  ret += <<~OUT
@@ -183,8 +168,6 @@ module IsoDoc
183
168
  def source_label(elem)
184
169
  if !labelled_ancestor(elem) && # do not number if labelled_ancestor
185
170
  lbl = @xrefs.anchor(elem["id"], :label, false)
186
- #a = autonum(elem["id"], lbl)
187
- #s = "<span class='fmt-element-name'>#{lower2cap @i18n.figure}</span> #{a}"
188
171
  s = labelled_autonum(lower2cap(@i18n.figure), elem["id"], lbl)&.strip
189
172
  end
190
173
  prefix_name(elem, { caption: block_delim }, s, "name")
@@ -10,6 +10,7 @@ require_relative "presentation_function/section"
10
10
  require_relative "presentation_function/index"
11
11
  require_relative "presentation_function/bibdata"
12
12
  require_relative "presentation_function/metadata"
13
+ require_relative "presentation_function/footnotes"
13
14
 
14
15
  module IsoDoc
15
16
  class PresentationXMLConvert < ::IsoDoc::Convert
@@ -85,7 +86,8 @@ module IsoDoc
85
86
  floattitle docxml # feeds rearrange_clauses
86
87
  index docxml # fed by strip_duplicate_ids
87
88
  toc docxml
88
- display_order docxml
89
+ display_order docxml # feeds document_footnotes
90
+ document_footnotes docxml
89
91
  end
90
92
 
91
93
  def block(docxml)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.1.0".freeze
2
+ VERSION = "3.1.2".freeze
3
3
  end
@@ -51,7 +51,7 @@ module IsoDoc
51
51
  def make_body3(body, docxml)
52
52
  body.div class: "WordSection3" do |div3|
53
53
  content(div3, docxml, ns(self.class::MAIN_ELEMENTS))
54
- footnotes div3
54
+ footnotes docxml, div3
55
55
  comments div3
56
56
  end
57
57
  end
@@ -79,7 +79,8 @@ module IsoDoc
79
79
  node.xpath(ns("./note")).each { |n| parse(n, out) }
80
80
  end
81
81
 
82
- def figure_get_or_make_dl(node)
82
+ # KILL
83
+ def figure_get_or_make_dlx(node)
83
84
  dl = node.at(".//table[@class = 'dl']")
84
85
  if dl.nil?
85
86
  node.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
@@ -89,7 +90,8 @@ module IsoDoc
89
90
  end
90
91
 
91
92
  # get rid of footnote link, it is in diagram
92
- def figure_aside_process(fig, aside, key)
93
+ # KILL
94
+ def figure_aside_processx(fig, aside, key)
93
95
  fig.at("./a[@class='TableFootnoteRef']")&.remove
94
96
  fnref = fig.at(".//span[@class='TableFootnoteRef']/..")
95
97
  tr = key.add_child("<tr></tr>").first