Class: Slaw::ZA::Act::Subsection
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Slaw::ZA::Act::Subsection
- Defined in:
- lib/slaw/za/act_nodes.rb
Instance Method Summary collapse
Instance Method Details
#num ⇒ Object
262 263 264 |
# File 'lib/slaw/za/act_nodes.rb', line 262 def num subsection_prefix.num.text_value end |
#to_xml(b, idprefix, i) ⇒ Object
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/slaw/za/act_nodes.rb', line 266 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 |