class Asciidoctor::Section

Attributes

mplevel[RW]

Allow the section type (:root, :branch, :leaf) to be saved for each section

Public Instance Methods

sectnum(delimiter = '.', append = nil) click to toggle source

Extend sectnum() to use the Document's saved sectnum. Document objects normally do not have sectnums, but here Documents are generated from Sections. The sectnum is saved in section() below.

# File lib/asciidoctor-multipage.rb, line 86
def sectnum(delimiter = '.', append = nil)
  append ||= (append == false ? '' : delimiter)
  if @level > 1 and @parent.class == Asciidoctor::Section ||
                    (@mplevel && @parent.class == Asciidoctor::Document)
      %(#{@parent.sectnum(delimiter)}#{@numeral}#{append})
  else
    %(#{@numeral}#{append})
  end
end