class Slaw::Grammars::ZA::Act::BlockElementsWithInline

Public Instance Methods

to_xml(b, idprefix='') click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 296
def to_xml(b, idprefix='')
  b.content { |b|
    kids = [first_child] + children.elements
    kids = kids.select { |k| k and !k.text_value.strip.empty? }

    if kids.empty?
      # schema requires a non-empty content element
      b.p
    else
      kids.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
    end
  }
end