Class: Slaw::ZA::Act::Chapter

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

Instance Method Summary collapse

Instance Method Details

#numObject



157
158
159
# File 'lib/slaw/za/act_nodes.rb', line 157

def num
  heading.num
end

#to_xml(b, *args) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/slaw/za/act_nodes.rb', line 161

def to_xml(b, *args)
  id = "chapter-#{num}"

  # include a part number in the id if our parent has one
  if parent and parent.parent.is_a?(Part) and parent.parent.num
    id = "part-#{parent.parent.num}.#{id}"
  end

  b.chapter(id: id) { |b|
    heading.to_xml(b)
    children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
  }
end