Method: IsoDoc::HtmlFunction::Html#heading_anchors

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

#heading_anchors(html) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/isodoc/html_function/postprocess.rb', line 34

def heading_anchors(html)
  html.xpath("//h1 | //h2 | //h3 | //h4 | //h5 | //h6 | //h7 | //h8 "\
             "//span[@class = 'inline-header']").each do |h|
    h.at("./ancestor::div[@id='toc']") and next
    div = h.xpath("./ancestor::div[@id]")
    div.empty? and next
    heading_anchor(h, div[-1]["id"])
  end
  html
end