Class: Slaw::Grammars::ZA::Act::Part
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Slaw::Grammars::ZA::Act::Part
- Defined in:
- lib/slaw/grammars/za/act_nodes.rb
Instance Method Summary collapse
Instance Method Details
#num ⇒ Object
107 108 109 |
# File 'lib/slaw/grammars/za/act_nodes.rb', line 107 def num heading.num end |
#to_xml(b, *args) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/slaw/grammars/za/act_nodes.rb', line 111 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 |