class Asciidoctor::Section

def sectnum(delimiter = '.', append = nil)

Returns the section number as a String

# => 1,1,1
sect1_1_1.sectnum(',', false)

# => 1.1.1.
sect1_1_1.sectnum

# => 1.2.
sect1_2.sectnum

# => 1.1.
sect1_1.sectnum

# => 1.
sect1.sectnum

sect1_1 << sect1_1_1
sect1_1_1.level = 3
sect1_1_1 = Section.new(sect1_1)
sect1 << sect1_2
sect1 << sect1_1
sect1_2.level = 2
sect1_2 = Section.new(sect1)
sect1_1.level = 2
sect1_1 = Section.new(sect1)
sect1.level = 1
sect1 = Section.new(document)

Examples

(default: nil)
appended to the final level
or Boolean to indicate the delimiter should not be
append - the String to append at the end of the section number
delimiter - the delimiter to separate the number for each level

The method also assumes that the value of @parent is either a Document or Section.
This method assumes that both the @level and @parent instance variables have been assigned.

the 1-based outline number of the Section amongst its numbered sibling Sections.
Section in the document. Each entry represents a level of nesting. The value of each entry is
The section number is a dot-separated String that uniquely describes the position of this

Public: Get the section number for the current Section
def sectnum(delimiter = '.', append = nil)
  append ||= (append == false ? '' : delimiter)
  @level > 1 && Section === @parent ? %(#{@parent.sectnum(delimiter, delimiter)}#{@numeral}#{append}) : %(#{@numeral}#{append})
end