isodoc 1.7.5 → 1.7.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b42d786cf8fa0f78ac01afba8de3e886b35eddd191551b6ce20ec680d7441d39
4
- data.tar.gz: 5db56071fb06162e738b7eff5c5726bf0eae2acc80dbcbfaf1c589ba04729a55
3
+ metadata.gz: bf6b7672b0923b4266fb04a8badd638b3838ede377e1b712f8d30e4c1aa6061f
4
+ data.tar.gz: 90c92ce493296887b9215384762a5a19bee7d5c2d275bab6f696b06593b60fa3
5
5
  SHA512:
6
- metadata.gz: 546f673176c4c6757567e43c3221c9e019d7f88f515636e9287e3e8016625a0741277b02d4b3de02cb09e301a76ac39dd8a7b7a62aa90a272c94b9f93529e84f
7
- data.tar.gz: 6f1db97d1acb6c413bc84265e6e9182b46a645509780457074584d4d37bf1f958e2220eac71958f0167438ed99da7ff12029a1beeda010f23229c47ec5976b50
6
+ metadata.gz: 1f102fb8d85bce4966bd70cac156c3f27c9308e00619993f79b0d9a32f168c03a25cc2c9860782e370654c70a9288760ddaaff60e75dad280ad992bf0bfbea24
7
+ data.tar.gz: 4d8f3b39550d2ff82a63a58ff9a549a7dc349fe2c294c2736ae5c88251db187ce8a8223ea47a939f1c4aa9e39a9109bc6aacca0b66629a69d3eeabf0613e13c9
data/isodoc.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["open.source@ribose.com"]
12
12
 
13
13
  spec.summary = "Convert documents in IsoDoc into Word and HTML "\
14
- "in AsciiDoc."
14
+ "in AsciiDoc."
15
15
  spec.description = <<~DESCRIPTION
16
16
  isodoc converts documents in the IsoDoc document model into
17
17
  Microsoft Word and HTML.
@@ -32,26 +32,27 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "html2doc", "~> 1.1.1"
33
33
  spec.add_dependency "htmlentities", "~> 4.3.4"
34
34
  spec.add_dependency "liquid", "~> 4"
35
- #spec.add_dependency "metanorma", ">= 1.2.0"
36
- spec.add_dependency "nokogiri", "~> 1.11.0"
35
+ # spec.add_dependency "metanorma", ">= 1.2.0"
36
+ spec.add_dependency "emf2svg", "~> 1"
37
+ spec.add_dependency "mathml2asciimath"
38
+ spec.add_dependency "metanorma-utils"
39
+ spec.add_dependency "nokogiri", "~> 1.12.0"
37
40
  spec.add_dependency "relaton-cli"
38
41
  spec.add_dependency "roman-numerals"
39
42
  spec.add_dependency "thread_safe"
40
43
  spec.add_dependency "twitter_cldr", ">= 6.6.0"
41
44
  spec.add_dependency "uuidtools"
42
- spec.add_dependency "mathml2asciimath"
43
- spec.add_dependency "metanorma-utils"
44
45
 
45
46
  spec.add_development_dependency "byebug", "~> 9.1"
46
47
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
47
48
  spec.add_development_dependency "guard", "~> 2.14"
48
49
  spec.add_development_dependency "guard-rspec", "~> 4.7"
50
+ spec.add_development_dependency "metanorma-iso"
49
51
  spec.add_development_dependency "rake", "~> 13.0"
50
52
  spec.add_development_dependency "rexml"
51
53
  spec.add_development_dependency "rspec", "~> 3.6"
52
54
  spec.add_development_dependency "rubocop", "~> 1.5.2"
53
55
  spec.add_development_dependency "sassc", "~> 2.4.0"
54
56
  spec.add_development_dependency "simplecov", "~> 0.15"
55
- spec.add_development_dependency "metanorma-iso"
56
57
  spec.add_development_dependency "timecop", "~> 0.9"
57
58
  end
@@ -23,8 +23,8 @@ module IsoDoc
23
23
  # unescape HTML escapes in doc
24
24
  doc = doc.split(%r<(\{%|%\})>).each_slice(4).map do |a|
25
25
  a[2] = a[2].gsub("&lt;", "<").gsub("&gt;", ">") if a.size > 2
26
- a.join("")
27
- end.join("")
26
+ a.join
27
+ end.join
28
28
  Liquid::Template.parse(doc)
29
29
  end
30
30
  end
@@ -101,6 +101,7 @@ module IsoDoc
101
101
  @htmlToClevels = 2 if @htmlToClevels.zero?
102
102
  @bookmarks_allocated = { "X" => true }
103
103
  @fn_bookmarks = {}
104
+ @baseassetpath = options[:baseassetpath]
104
105
  end
105
106
 
106
107
  def tmpimagedir_suffix
@@ -21,7 +21,8 @@ module IsoDoc
21
21
  filename = filepath.sub_ext("").sub(/\.presentation$/, "").to_s
22
22
  dir = init_dir(filename, debug)
23
23
  @filename = filename
24
- @localdir = "#{filepath.parent}/"
24
+ @localdir = @baseassetpath || filepath.parent.to_s
25
+ @localdir += "/"
25
26
  @sourcedir = @localdir
26
27
  @sourcefilename and
27
28
  @sourcedir = "#{Pathname.new(@sourcefilename).parent}/"
@@ -37,14 +37,14 @@ module IsoDoc
37
37
  end
38
38
 
39
39
  def attr_code(attributes)
40
- attributes = attributes.reject { |_, val| val.nil? }.map
40
+ attributes = attributes.compact.map
41
41
  attributes.map do |k, v|
42
42
  [k, v.is_a?(String) ? HTMLEntities.new.decode(v) : v]
43
43
  end.to_h
44
44
  end
45
45
 
46
46
  DOCTYPE_HDR = "<!DOCTYPE html SYSTEM "\
47
- '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
47
+ '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
48
48
 
49
49
  def to_xhtml(xml)
50
50
  xml = to_xhtml_prep(xml)
@@ -55,7 +55,7 @@ module IsoDoc
55
55
  f.write xml
56
56
  end
57
57
  abort "Malformed Output XML for #{@format}: #{e} "\
58
- "(see #{@filename}.#{@format}.err)"
58
+ "(see #{@filename}.#{@format}.err)"
59
59
  end
60
60
  end
61
61
 
@@ -67,7 +67,7 @@ module IsoDoc
67
67
  HTMLEntities.new.encode(HTMLEntities.new.decode(t), :hexadecimal)
68
68
  else t
69
69
  end
70
- end.join("")
70
+ end.join
71
71
  end
72
72
 
73
73
  def to_xhtml_fragment(xml)
@@ -148,18 +148,12 @@ module IsoDoc
148
148
  elem.name == "span" && /mso-bookmark/.match(elem["style"])
149
149
  end
150
150
 
151
- =begin
152
- def liquid(doc)
153
- self.class.liquid(doc)
154
- end
155
- =end
156
-
157
151
  def liquid(doc)
158
152
  # unescape HTML escapes in doc
159
153
  doc = doc.split(%r<(\{%|%\})>).each_slice(4).map do |a|
160
154
  a[2] = a[2].gsub(/&lt;/, "<").gsub(/&gt;/, ">") if a.size > 2
161
- a.join("")
162
- end.join("")
155
+ a.join
156
+ end.join
163
157
  Liquid::Template.parse(doc)
164
158
  end
165
159
 
@@ -181,8 +175,9 @@ module IsoDoc
181
175
  end
182
176
 
183
177
  def save_dataimage(uri, _relative_dir = true)
184
- %r{^data:(image|application)/(?<imgtype>[^;]+);base64,(?<imgdata>.+)$} =~ uri
185
- imgtype.sub!(/\+[a-z0-9]+$/, "") # svg+xml
178
+ %r{^data:(?<imgclass>image|application)/(?<imgtype>[^;]+);(charset=[^;]+;)?base64,(?<imgdata>.+)$} =~ uri
179
+ imgtype = "emf" if emf?("#{imgclass}/#{imgtype}")
180
+ imgtype = imgtype.sub(/\+[a-z0-9]+$/, "") # svg+xml
186
181
  imgtype = "png" unless /^[a-z0-9]+$/.match? imgtype
187
182
  Tempfile.open(["image", ".#{imgtype}"]) do |f|
188
183
  f.binmode
@@ -206,6 +201,31 @@ module IsoDoc
206
201
  !node.ancestors("example, requirement, recommendation, permission, "\
207
202
  "note, table, figure, sourcecode").empty?
208
203
  end
204
+
205
+ def emf?(type)
206
+ %w(application/emf application/x-emf image/x-emf image/x-mgx-emf
207
+ application/x-msmetafile image/x-xbitmap).include? type
208
+ end
209
+
210
+ def cleanup_entities(text)
211
+ c = HTMLEntities.new
212
+ text.split(/([<>])/).each_slice(4).map do |a|
213
+ a[0] = c.encode(c.decode(a[0]), :hexadecimal)
214
+ a[1] = c.encode(c.decode(a[1]), :hexadecimal)
215
+ a
216
+ end.join
217
+ end
218
+
219
+ def external_path(path)
220
+ win = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) ||
221
+ (RUBY_PLATFORM =~ /mswin|mingw/))
222
+ if win
223
+ path.gsub!(%{/}, "\\")
224
+ path[/\s/] ? "\"#{path}\"" : path
225
+ else
226
+ path
227
+ end
228
+ end
209
229
  end
210
230
  end
211
231
  end
@@ -1,146 +1,142 @@
1
- module IsoDoc::HtmlFunction
2
- module Comments
3
-
4
- def in_comment
5
- @in_comment
6
- end
1
+ module IsoDoc
2
+ module HtmlFunction
3
+ module Comments
4
+ def in_comment
5
+ @in_comment
6
+ end
7
7
 
8
- def comments(div)
9
- =begin
10
- return if @comments.empty?
11
- div.div **{ style: "mso-element:comment-list" } do |div1|
12
- @comments.each { |fn| div1.parent << fn }
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
13
  end
14
- =end
15
- end
16
14
 
17
- def review_note_parse(node, out)
18
- =begin
19
- fn = @comments.length + 1
20
- make_comment_link(out, fn, node)
21
- @in_comment = true
22
- @comments << make_comment_text(node, fn)
23
- @in_comment = false
24
- =end
25
- end
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
21
+ end
26
22
 
27
- def comment_link_attrs(fnote, node)
28
- { style: "MsoCommentReference", target: fnote,
29
- class: "commentLink", from: node["from"],
30
- to: node["to"] }
31
- end
23
+ def comment_link_attrs(fnote, node)
24
+ { style: "MsoCommentReference", target: fnote,
25
+ class: "commentLink", from: node["from"],
26
+ to: node["to"] }
27
+ end
32
28
 
33
- # add in from and to links to move the comment into place
34
- def make_comment_link(out, fnote, node)
35
- out.span(**comment_link_attrs(fnote, node)) do |s1|
29
+ # add in from and to links to move the comment into place
30
+ def make_comment_link(out, fnote, node)
31
+ out.span(**comment_link_attrs(fnote, node)) do |s1|
36
32
  s1.a **{ style: "mso-comment-reference:SMC_#{fnote};"\
37
- "mso-comment-date:#{node['date'].gsub(/[-:Z]/, '')}" }
33
+ "mso-comment-date:#{node['date'].gsub(/[-:Z]/,
34
+ '')}" }
38
35
  end
39
- end
36
+ end
40
37
 
41
- def make_comment_target(out)
42
- out.span **{ style: "MsoCommentReference" } do |s1|
38
+ def make_comment_target(out)
39
+ out.span **{ style: "MsoCommentReference" } do |s1|
43
40
  s1.span **{ style: "mso-special-character:comment" }
44
41
  end
45
- end
42
+ end
46
43
 
47
- def make_comment_text(node, fnote)
48
- noko do |xml|
49
- xml.div **{ style: "mso-element:comment", id: fnote } do |div|
50
- div.span **{ style: %{mso-comment-author:"#{node['reviewer']}"} }
51
- make_comment_target(div)
52
- node.children.each { |n| parse(n, div) }
53
- end
54
- end.join("\n")
55
- end
44
+ def make_comment_text(node, fnote)
45
+ noko do |xml|
46
+ xml.div **{ style: "mso-element:comment", id: fnote } do |div|
47
+ div.span **{ style: %{mso-comment-author:"#{node['reviewer']}"} }
48
+ make_comment_target(div)
49
+ node.children.each { |n| parse(n, div) }
50
+ end
51
+ end.join("\n")
52
+ end
56
53
 
57
- def comment_cleanup(docxml)
58
- =begin
59
- move_comment_link_to_from(docxml)
60
- reorder_comments_by_comment_link(docxml)
61
- embed_comment_in_comment_list(docxml)
62
- =end
63
- end
54
+ def comment_cleanup(docxml)
55
+ # move_comment_link_to_from(docxml)
56
+ # reorder_comments_by_comment_link(docxml)
57
+ # embed_comment_in_comment_list(docxml)
58
+ end
64
59
 
65
- COMMENT_IN_COMMENT_LIST =
66
- '//div[@style="mso-element:comment-list"]//'\
67
- 'span[@style="MsoCommentReference"]'.freeze
60
+ COMMENT_IN_COMMENT_LIST =
61
+ '//div[@style="mso-element:comment-list"]//'\
62
+ 'span[@style="MsoCommentReference"]'.freeze
68
63
 
69
- def embed_comment_in_comment_list(docxml)
70
- docxml.xpath(COMMENT_IN_COMMENT_LIST).each do |x|
71
- n = x.next_element
72
- n&.children&.first&.add_previous_sibling(x.remove)
64
+ def embed_comment_in_comment_list(docxml)
65
+ docxml.xpath(COMMENT_IN_COMMENT_LIST).each do |x|
66
+ n = x.next_element
67
+ n&.children&.first&.add_previous_sibling(x.remove)
68
+ end
69
+ docxml
73
70
  end
74
- docxml
75
- end
76
71
 
77
- def move_comment_link_to_from1(x, fromlink)
78
- x.remove
79
- link = x.at(".//a")
80
- fromlink.replace(x)
81
- link.children = fromlink
82
- end
72
+ def move_comment_link_to_from1(x, fromlink)
73
+ x.remove
74
+ link = x.at(".//a")
75
+ fromlink.replace(x)
76
+ link.children = fromlink
77
+ end
83
78
 
84
- def comment_attributes(docxml, x)
85
- fromlink = docxml.at("//*[@id='#{x['from']}']")
86
- return(nil) if fromlink.nil?
79
+ def comment_attributes(docxml, x)
80
+ fromlink = docxml.at("//*[@id='#{x['from']}']")
81
+ return(nil) if fromlink.nil?
87
82
 
88
- tolink = docxml.at("//*[@id='#{x['to']}']") || fromlink
89
- target = docxml.at("//*[@id='#{x['target']}']")
90
- { from: fromlink, to: tolink, target: target }
91
- end
83
+ tolink = docxml.at("//*[@id='#{x['to']}']") || fromlink
84
+ target = docxml.at("//*[@id='#{x['target']}']")
85
+ { from: fromlink, to: tolink, target: target }
86
+ end
92
87
 
93
- def wrap_comment_cont(from, target)
94
- s = from.replace("<span style='mso-comment-continuation:#{target}'>")
95
- s.first.children = from
96
- end
88
+ def wrap_comment_cont(from, target)
89
+ s = from.replace("<span style='mso-comment-continuation:#{target}'>")
90
+ s.first.children = from
91
+ end
97
92
 
98
- def skip_comment_wrap(from)
99
- from["style"] != "mso-special-character:comment"
100
- end
93
+ def skip_comment_wrap(from)
94
+ from["style"] != "mso-special-character:comment"
95
+ end
101
96
 
102
- def insert_comment_cont(from, upto, target)
103
- # includes_to = from.at(".//*[@id='#{upto}']")
104
- while !from.nil? && from["id"] != upto
105
- following = from.xpath("./following::*")
106
- (from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
107
- while !incl_to.nil? && !from.nil? && skip_comment_wrap(from)
97
+ def insert_comment_cont(from, upto, target)
98
+ # includes_to = from.at(".//*[@id='#{upto}']")
99
+ while !from.nil? && from["id"] != upto
100
+ following = from.xpath("./following::*")
108
101
  (from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
102
+ while !incl_to.nil? && !from.nil? && skip_comment_wrap(from)
103
+ (from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
104
+ end
105
+ wrap_comment_cont(from, target) if !from.nil?
109
106
  end
110
- wrap_comment_cont(from, target) if !from.nil?
111
107
  end
112
- end
113
108
 
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"])
109
+ def move_comment_link_to_from(docxml)
110
+ docxml.xpath('//span[@style="MsoCommentReference"][@from]').each do |x|
111
+ attrs = comment_attributes(docxml, x) || next
112
+ move_comment_link_to_from1(x, attrs[:from])
113
+ insert_comment_cont(attrs[:from], x["to"], x["target"])
114
+ end
119
115
  end
120
- end
121
116
 
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?
117
+ def get_comments_from_text(docxml, link_order)
118
+ comments = []
119
+ docxml.xpath("//div[@style='mso-element:comment']").each do |c|
120
+ next unless c["id"] && !link_order[c["id"]].nil?
126
121
 
127
- comments << { text: c.remove.to_s, id: c["id"] }
122
+ comments << { text: c.remove.to_s, id: c["id"] }
123
+ end
124
+ comments.sort! { |a, b| link_order[a[:id]] <=> link_order[b[:id]] }
125
+ # comments
128
126
  end
129
- comments.sort! { |a, b| link_order[a[:id]] <=> link_order[b[:id]] }
130
- # comments
131
- end
132
127
 
133
- COMMENT_TARGET_XREFS =
134
- "//span[@style='mso-special-character:comment']/@target".freeze
128
+ COMMENT_TARGET_XREFS =
129
+ "//span[@style='mso-special-character:comment']/@target".freeze
135
130
 
136
- def reorder_comments_by_comment_link(docxml)
137
- link_order = {}
138
- docxml.xpath(COMMENT_TARGET_XREFS).each_with_index do |target, i|
139
- link_order[target.value] = i
131
+ def reorder_comments_by_comment_link(docxml)
132
+ link_order = {}
133
+ docxml.xpath(COMMENT_TARGET_XREFS).each_with_index do |target, i|
134
+ link_order[target.value] = i
135
+ end
136
+ comments = get_comments_from_text(docxml, link_order)
137
+ list = docxml.at("//*[@style='mso-element:comment-list']") || return
138
+ list.children = comments.map { |c| c[:text] }.join("\n")
140
139
  end
141
- comments = get_comments_from_text(docxml, link_order)
142
- list = docxml.at("//*[@style='mso-element:comment-list']") || return
143
- list.children = comments.map { |c| c[:text] }.join("\n")
144
140
  end
145
141
  end
146
142
  end
@@ -1,90 +1,91 @@
1
- module IsoDoc::HtmlFunction
2
- module Footnotes
1
+ module IsoDoc
2
+ module HtmlFunction
3
+ module Footnotes
4
+ def footnotes(div)
5
+ return if @footnotes.empty?
3
6
 
4
- def footnotes(div)
5
- return if @footnotes.empty?
6
-
7
- @footnotes.each { |fn| div.parent << fn }
8
- end
9
-
10
- def make_table_footnote_link(out, fnid, fnref)
11
- attrs = { href: "##{fnid}", class: "TableFootnoteRef" }
12
- out.a **attrs do |a|
13
- a << fnref
7
+ @footnotes.each { |fn| div.parent << fn }
14
8
  end
15
- end
16
9
 
17
- def make_table_footnote_target(out, fnid, fnref)
18
- attrs = { id: fnid, class: "TableFootnoteRef" }
19
- out.span do |s|
20
- out.span **attrs do |a|
10
+ def make_table_footnote_link(out, fnid, fnref)
11
+ attrs = { href: "##{fnid}", class: "TableFootnoteRef" }
12
+ out.a **attrs do |a|
21
13
  a << fnref
22
14
  end
23
- insert_tab(s, 1)
24
15
  end
25
- end
26
16
 
27
- def make_table_footnote_text(node, fnid, fnref)
28
- attrs = { id: "fn:#{fnid}" }
29
- noko do |xml|
30
- xml.div **attr_code(attrs) do |div|
31
- make_table_footnote_target(div, fnid, fnref)
32
- node.children.each { |n| parse(n, div) }
17
+ def make_table_footnote_target(out, fnid, fnref)
18
+ attrs = { id: fnid, class: "TableFootnoteRef" }
19
+ out.span do |s|
20
+ out.span **attrs do |a|
21
+ a << fnref
22
+ end
23
+ insert_tab(s, 1)
33
24
  end
34
- end.join("\n")
35
- end
25
+ end
36
26
 
37
- def make_generic_footnote_text(node, fnid)
38
- noko do |xml|
39
- xml.aside **{ id: "fn:#{fnid}", class: "footnote" } do |div|
40
- node.children.each { |n| parse(n, div) }
41
- end
42
- end.join("\n")
43
- end
27
+ def make_table_footnote_text(node, fnid, fnref)
28
+ attrs = { id: "fn:#{fnid}" }
29
+ noko do |xml|
30
+ xml.div **attr_code(attrs) do |div|
31
+ make_table_footnote_target(div, fnid, fnref)
32
+ node.children.each { |n| parse(n, div) }
33
+ end
34
+ end.join("\n")
35
+ end
44
36
 
45
- def get_table_ancestor_id(node)
46
- table = node.ancestors("table") || node.ancestors("figure")
47
- return UUIDTools::UUID.random_create.to_s if table.empty?
37
+ def make_generic_footnote_text(node, fnid)
38
+ noko do |xml|
39
+ xml.aside **{ id: "fn:#{fnid}", class: "footnote" } do |div|
40
+ node.children.each { |n| parse(n, div) }
41
+ end
42
+ end.join("\n")
43
+ end
48
44
 
49
- table.last["id"]
50
- end
45
+ def get_table_ancestor_id(node)
46
+ table = node.ancestors("table") || node.ancestors("figure")
47
+ return UUIDTools::UUID.random_create.to_s if table.empty?
51
48
 
52
- # @seen_footnote:
53
- # do not output footnote text if we have already seen it for this table
49
+ table.last["id"]
50
+ end
54
51
 
55
- def table_footnote_parse(node, out)
56
- fn = node["reference"] || UUIDTools::UUID.random_create.to_s
57
- tid = get_table_ancestor_id(node)
58
- make_table_footnote_link(out, tid + fn, fn)
59
- return if @seen_footnote.include?(tid + fn)
52
+ # @seen_footnote:
53
+ # do not output footnote text if we have already seen it for this table
60
54
 
61
- @in_footnote = true
62
- out.aside **{ class: "footnote" } do |a|
63
- a << make_table_footnote_text(node, tid + fn, fn)
55
+ def table_footnote_parse(node, out)
56
+ fn = node["reference"] || UUIDTools::UUID.random_create.to_s
57
+ tid = get_table_ancestor_id(node)
58
+ make_table_footnote_link(out, tid + fn, fn)
59
+ return if @seen_footnote.include?(tid + fn)
60
+
61
+ @in_footnote = true
62
+ out.aside **{ class: "footnote" } do |a|
63
+ a << make_table_footnote_text(node, tid + fn, fn)
64
+ end
65
+ @in_footnote = false
66
+ @seen_footnote << (tid + fn)
64
67
  end
65
- @in_footnote = false
66
- @seen_footnote << (tid + fn)
67
- end
68
68
 
69
- def footnote_parse(node, out)
70
- return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
71
- !node.ancestors.map(&:name).include?("name")
69
+ def footnote_parse(node, out)
70
+ return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
71
+ !node.ancestors.map(&:name).include?("name")
72
72
 
73
- fn = node["reference"] || UUIDTools::UUID.random_create.to_s
74
- attrs = { class: "FootnoteRef", href: "#fn:#{fn}" }
75
- out.a **attrs do |a|
76
- a.sup { |sup| sup << fn }
73
+ fn = node["reference"] || UUIDTools::UUID.random_create.to_s
74
+ attrs = { class: "FootnoteRef", href: "#fn:#{fn}" }
75
+ out.a **attrs do |a|
76
+ a.sup { |sup| sup << fn }
77
+ end
78
+ make_footnote(node, fn)
77
79
  end
78
- make_footnote(node, fn)
79
- end
80
80
 
81
- def make_footnote(node, fnote)
82
- return if @seen_footnote.include?(fnote)
81
+ def make_footnote(node, fnote)
82
+ return if @seen_footnote.include?(fnote)
83
83
 
84
- @in_footnote = true
85
- @footnotes << make_generic_footnote_text(node, fnote)
86
- @in_footnote = false
87
- @seen_footnote << fnote
84
+ @in_footnote = true
85
+ @footnotes << make_generic_footnote_text(node, fnote)
86
+ @in_footnote = false
87
+ @seen_footnote << fnote
88
+ end
88
89
  end
89
90
  end
90
91
  end