Method: IsoDoc::HtmlFunction::Html#update_footnote_filter

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

#update_footnote_filter(fnote, xref, idx, seen) ⇒ Object



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

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