class Asciidoctor::Lexer

def self.initialize_section(reader, parent, attributes = {})

attributes - a Hash of attributes to assign to this section (default: {})
parent - the parent Section or Document of this Section
reader - the source reader

current position of the reader.
The information for this section is retrieved by parsing the lines at the

Internal: Initialize a new Section object and assign any attributes provided
def self.initialize_section(reader, parent, attributes = {})
  section = Section.new parent
  section.id, section.title, section.level, _ = parse_section_title(reader)
  if section.id.nil? && attributes.has_key?('id')
    section.id = attributes['id']
  else
    # generate an id if one was not *embedded* in the heading line
    # or as an anchor above the section
    section.id ||= section.generate_id
  end
  if attributes[1]
    section.sectname = attributes[1]
    section.special = true
    if section.sectname == 'appendix'
      attributes['caption'] ||= "Appendix #{parent.document.counter('appendix-number', 'A')}: "
    end
  else
    section.sectname = "sect#{section.level}"
  end
  section.update_attributes(attributes)
  reader.skip_blank
  section
end