lib/ruby_docx/elements/paragraph.rb
##
# removes empty node (<p/>) and convert <p><r><cr/></r></p> to <p><r/></p> that excess break lines are exluded
removes empty node () and convert  to  that excess break lines are exluded
removes empty node () and convert to that excess break lines are exluded
def delete_empty_nodes(set)
    set.reject! { |node| node.name == 'p' && node.children.empty? }
    set.select do |node|
      node.name == 'p' &&
          node.children.size == 1 &&
          node.children.first.name == 'r' &&
          node.children.first.children.size == 1 &&
          node.children.first.children.first.name == 'cr'
    end.each do |node|
      node.children.first.children.remove
    end
  end
def delete_empty_nodes ( set ) set . reject! { | node | node . name == 'p' && node . children . empty? } set . select do | node | node . name == 'p' && node . children . size == 1 && node . children . first . name == 'r' && node . children . first . children . size == 1 && node . children . first . children . first . name == 'cr' end . each do | node | node . children . first . children . remove end end
removes empty node (<p/>) and convert <p><r><cr/></r></p> to <p><r/></p> that excess break lines are exluded
removes empty node ( <p / > ) and convert <p > <r > <cr / > < / r > < / p > to <p > <r / > < / p > that excess break lines are exluded
set
<not_specific>