Class: Slaw::ZA::Act::Part

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

Instance Method Summary collapse

Instance Method Details

#numObject



120
121
122
# File 'lib/slaw/za/act_nodes.rb', line 120

def num
  heading.num
end

#to_xml(b, *args) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/slaw/za/act_nodes.rb', line 124

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

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

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