Method: IsoDoc::WordFunction::Postprocess#word_remove_empty_sections

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

#word_remove_empty_sections(docxml) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/isodoc/word_function/postprocess_cover.rb', line 11

def word_remove_empty_sections(docxml)
  %w(WordSection1 WordSection2).each do |x|
    ins = docxml.at("//div[@class='#{x}']") or next
    @c.decode(ins.text).gsub(/\p{Z}|\p{C}/, "").strip.empty? or next
    ins.next_element.remove
    ins.remove
  end
end