Method: IsoDoc::HtmlFunction::Html#authority_cleanup1

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

#authority_cleanup1(docxml, klass) ⇒ Object



53
54
55
56
57
58
59
60
# File 'lib/isodoc/html_function/postprocess_cover.rb', line 53

def authority_cleanup1(docxml, klass)
  dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
  auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or " \
                   "@class = 'boilerplate-#{klass}']")
  auth&.xpath(".//h1[not(text())] | .//h2[not(text())]")&.each(&:remove)
  auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
  dest and auth and dest.replace(auth.remove)
end