Class: Slaw::Grammars::ZA::Act::Subsection
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Slaw::Grammars::ZA::Act::Subsection
- Defined in:
- lib/slaw/grammars/za/act_nodes.rb
Instance Method Summary collapse
Instance Method Details
#num ⇒ Object
283 284 285 |
# File 'lib/slaw/grammars/za/act_nodes.rb', line 283 def num subsection_prefix.num.text_value end |
#to_xml(b, idprefix, i) ⇒ Object
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/slaw/grammars/za/act_nodes.rb', line 287 def to_xml(b, idprefix, i) id = idprefix + num.gsub(/[()]/, '') idprefix = id + "." kids = children.elements kids = [first_child] + kids if first_child and !first_child.empty? b.subsection(id: id) { |b| b.num(num) b.content { |b| if kids.empty? # schema requires a non-empty content element b.p else kids.each_with_index { |e, i| e.to_xml(b, idprefix, i) } end } } end |