Method: IsoDoc::HtmlFunction::Html#update_footnote_filter

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

#update_footnote_filter(fn, x, i, seen) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/isodoc/html_function/postprocess_footnotes.rb', line 3

def update_footnote_filter(fn, x, i, seen)
  if seen[fn.text]
    x.at("./sup").content = seen[fn.text][:num].to_s
    fn.remove unless x["href"] == seen[fn.text][:href]
    x["href"] = seen[fn.text][:href]
  else
    seen[fn.text] = { num: i, href: x["href"] }
    x.at("./sup").content = i.to_s
    i += 1
  end
  [i, seen]
end