class Asciidoctor::Section
def sectnum(delimiter = '.', append = nil)
# => 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 Section amongst its sibling Sections
the value of each entry is the 1-based index of
where each entry represents one level of nesting and
The section number is a unique, dot separated String
Public: Get the section number for the current Section
def sectnum(delimiter = '.', append = nil) append ||= (append == false ? '' : delimiter) if !@level.nil? && @level > 1 && @parent.is_a?(::Asciidoctor::Section) "#{@parent.sectnum(delimiter)}#{@index + 1}#{append}" else "#{@index + 1}#{append}" end end