Class: Slaw::Grammars::ZA::Act::BlockElements

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

Constant Summary collapse

@@counters =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.countersObject



264
265
266
# File 'lib/slaw/grammars/za/act_nodes.rb', line 264

def self.counters
  @@counters
end

Instance Method Details

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



268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/slaw/grammars/za/act_nodes.rb', line 268

def to_xml(b, idprefix='', i=0)
  @@counters[idprefix] ||= -1
  @@counters[idprefix] += 1
  id = "#{idprefix}paragraph#{@@counters[idprefix]}"
  idprefix = "#{id}."

  b.paragraph(id: id) { |b|
    b.content { |b|
      elements.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
    }
  }
end