Method: IsoDoc::PresentationXMLConvert#termcleanup

Defined in:
lib/isodoc/presentation_function/terms.rb

#termcleanup(docxml) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/isodoc/presentation_function/terms.rb', line 15

def termcleanup(docxml)
  docxml.xpath(ns("//term")).each do |t|
    %w(preferred admitted deprecates related definition termsource)
      .each do |w|
      t.xpath(ns("./#{w}//fmt-name | ./#{w}//fmt-xref-label")).each(&:remove)
      f = t.at(ns(".//fmt-#{w}"))
      f&.children&.empty? and f.remove
    end
  end
end