Method: IsoDoc::WordFunction::Postprocess#split_at_section_break

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

#split_at_section_break(docxml, sect, brk, idx) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
# File 'lib/isodoc/word_function/postprocess_cover.rb', line 140

def split_at_section_break(docxml, sect, brk, idx)
  move = brk.parent.xpath("following::node()") &
    brk.document.xpath("//div[@class = '#{sect}']//*")
  ins = docxml.at("//div[@class = '#{sect}']")
    .after("<div class='#{sect}_#{idx}'/>").next_element
  move.each do |m|
    next if m.at("./ancestor::div[@class = '#{sect}_#{idx}']")

    ins << m.remove
  end
end