Class: Slaw::Grammars::ZA::Act::Blocklist

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/slaw/grammars/za/act_nodes.rb

Instance Method Summary collapse

Instance Method Details

#to_xml(b, idprefix, i = 0, &block) ⇒ Object

Render a block list to xml. If a block is given, yield to it a builder to insert a listIntroduction node



317
318
319
320
321
322
323
324
325
326
327
# File 'lib/slaw/grammars/za/act_nodes.rb', line 317

def to_xml(b, idprefix, i=0, &block)
  cnt = Slaw::Grammars::Counters.counters[idprefix]['list'] += 1
  id = idprefix + "list#{cnt}"
  idprefix = id + '.'

  b.blockList(id: id, renest: true) { |b|
    b.listIntroduction { |b| yield b } if block_given?

    elements.each { |e| e.to_xml(b, idprefix) }
  }
end