blob: bfbc1712dba87968ac094e3a12a2a2c5b3d82e1b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
class PDFConverterChapterTOC < (Asciidoctor::Converter.for 'pdf')
register_for 'pdf'
def convert_section sect, opts = {}
result = super
if (toc_extent = sect.attr 'pdf-toc-extent')
levels = (sect.document.attr 'chapter-toclevels', 1).to_i + 1
page_numbering_offset = @index.start_page_number - 1
float do
ink_toc sect, levels, toc_extent.from.page, toc_extent.from.cursor, page_numbering_offset
end
end
result
end
def ink_chapter_title sect, title, opts
super
if ((doc = sect.document).attr? 'chapter-toc') && (levels = (doc.attr 'chapter-toclevels', 1).to_i + 1) > 1
theme_font :base do
sect.set_attr 'pdf-toc-extent', (allocate_toc sect, levels, cursor, false)
end
end
end
end
|