Method: IsoDoc::HtmlFunction::Html#footnote_backlinks

Defined in:
lib/isodoc/html_function/postprocess_footnotes.rb


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/isodoc/html_function/postprocess_footnotes.rb', line 40

def footnote_backlinks(docxml)
  seen = {}
  docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
    (seen[x["href"]] and next) or seen[x["href"]] = true
    fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
    footnote_backlinks1(x, fn)
    x["id"] ||= "fnref:#{i + 1}"
    fn.add_child "<a href='##{x['id']}'>&#x21A9;</a>"
  end
  docxml
end