summaryrefslogtreecommitdiff
path: root/docs/modules/extend/examples/pdf-converter-additional-toc-entries.rb
blob: dc5a60d9a62f7ea5c99faca32f3d1cef5e58aad0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
class PDFConverterAdditionalTOCEntries < (Asciidoctor::Converter.for 'pdf')
  register_for 'pdf'

  def get_entries_for_toc node
    return super if node.context == :document
    node.blocks.select do |candidate|
      candidate.context == :section ||
        (candidate.id && (candidate.title? || candidate.reftext?))
    end
  end
end