Sha256: a3d4d6616a603569bba4a3c1f5a61cd3fa0cc1cabc90c418f4c154c22f53b81f

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

class Asciidoctor::Section
  def numbered_title opts = {}
    unless (@cached_numbered_title ||= nil)
      if (slevel = (@level == 0 && @special ? 1 : @level)) == 0
        @is_numbered = false
        @cached_numbered_title = @cached_formal_numbered_title = title
      elsif @numbered && !@caption && slevel <= (@document.attr 'sectnumlevels', 3).to_i
        @is_numbered = true
        @cached_numbered_title = %(#{sectnum} #{title})
        @cached_formal_numbered_title = if slevel == 1 && @document.doctype == 'book'
          %(#{@document.attr 'chapter-label', 'Chapter'} #{@cached_numbered_title}).lstrip
        else
          @cached_numbered_title
        end
      else
        @is_numbered = false
        @cached_numbered_title = @cached_formal_numbered_title = captioned_title
      end
    end
    opts[:formal] ? @cached_formal_numbered_title : @cached_numbered_title
  end unless respond_to? :numbered_title

  def chapter?
    @document.doctype == 'book' && @level == 1 || (@special && @level == 0)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.alpha.12 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.11 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.10 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.9 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.8 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.7 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.6 lib/asciidoctor-pdf/asciidoctor_ext/section.rb
asciidoctor-pdf-1.5.0.alpha.5 lib/asciidoctor-pdf/asciidoctor_ext/section.rb