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



286
287
288
# File 'lib/slaw/grammars/za/act_nodes.rb', line 286

def self.counters
  @@counters
end

Instance Method Details

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



290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/slaw/grammars/za/act_nodes.rb', line 290

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