Method: IsoDoc::HtmlFunction::Html#html_toc_entry

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

#html_toc_entry(level, header) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/isodoc/html_function/postprocess_cover.rb', line 100

def html_toc_entry(level, header)
  content = header.at("./following-sibling::p" \
                      "[@class = 'variant-title-toc']") || header
  id = header.at(".//a[@class = 'anchor']/@href")&.text&.sub(/^#/, "") ||
    header["id"]
  %(<li class="#{level}"><a href="##{id}">\
#{header_strip(content)}</a></li>)
end