require "fileutils"

module IsoDoc
  module M3AAWG
    module BaseRender
      def cleanup(docxml)
        super
        term_cleanup(docxml)
      end

      def term_cleanup(docxml)
        docxml.xpath("//p[@class = 'Terms']").each do |d|
          h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
          h2.add_child(" ")
          h2.add_child(d.remove)
        end
        docxml
      end
    end
  end
end