def footnote_content
ol = Element.new(:ol)
ol.attr['start'] = @footnote_start if @footnote_start != 1
@footnotes.each do |name, data|
li = Element.new(:li, nil, {'id' => "fn:#{name}"})
li.children = Marshal.load(Marshal.dump(data.children))
ol.children << li
ref = Element.new(:raw, "<a href=\"#fnref:#{name}\" rel=\"reference\">↩</a>")
if li.children.last.type == :p
para = li.children.last
else
li.children << (para = Element.new(:p))
end
para.children << ref
end
(ol.children.empty? ? '' : "<div class=\"footnotes\">\n#{convert(ol, 2)}</div>\n")
end