class Slaw::Grammars::ZA::Act::Section

Public Instance Methods

num() click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 233
def num
  section_title.num
end
to_xml(b, idprefix='', *args) click to toggle source
# File lib/slaw/grammars/za/act_nodes.rb, line 237
def to_xml(b, idprefix='', *args)
  id = "sec_#{Slaw::Grammars::Counters.clean(num)}"
  # For historical reasons, we normally ignore the idprefix for sections, assuming
  # them to be unique. However, in an attachment (eg. a schedule), ensure they
  # are correctly prefixed
  # TODO: always include the idprefix
  id = idprefix + id if idprefix.start_with? 'att_'

  b.section(eId: id) { |b|
    section_title.to_xml(b)

    idprefix = "#{id}__"
    children.elements.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
  }
end