Method: IsoDoc::HtmlFunction::Html#term_header

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

#term_header(docxml) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
# File 'lib/isodoc/html_function/postprocess.rb', line 126

def term_header(docxml)
  %w(h1 h2 h3 h4 h5 h6 h7 h8).each do |h|
    docxml.xpath("//p[@class = 'TermNum'][../#{h}]").each do |p|
      p.name = "h#{h[1].to_i + 1}"
      id = p["id"]
      p["id"] = "_#{UUIDTools::UUID.random_create}"
      p.wrap("<div id='#{id}'></div>")
    end
  end
  docxml
end