Control toc position with toc-start attribute #278

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
@hmflash

hmflash commented Jul 24, 2015

Allow toc placement to be controlled with 'toc-start' attribute.

This fixes #233

If attribute is omitted, toc is placed immediately following the cover page (the same as it is now).

Changing the value to 3 allows for the an abstract or introduction or copyright notice to be placed prior to the table of contents.

An example adoc that puts the toc after the abstract would look like:

= My document title
:doctype: book
:toc:
:toc-start: 3

[abstract]
The abstract goes here

== First document section

First document section content
@mojavelinux

This comment has been minimized.

Show comment
Hide comment
@mojavelinux

mojavelinux Jul 26, 2015

Member

Thanks for submitting this PR!

I'll need to review this very carefully (testing against a bunch of different edge cases) since placing the toc into the document is a very tricky ordeal atm and the logic around it is...a little fragile to say the least. However, it's a great opportunity to get it cleaned up.

Member

mojavelinux commented Jul 26, 2015

Thanks for submitting this PR!

I'll need to review this very carefully (testing against a bunch of different edge cases) since placing the toc into the document is a very tricky ordeal atm and the logic around it is...a little fragile to say the least. However, it's a great opportunity to get it cleaned up.

@hmflash

This comment has been minimized.

Show comment
Hide comment
@hmflash

hmflash Jul 27, 2015

I just found and fixed a bug during more of my own testing. If the toc attribute was omitted, we still need the number of toc levels for the outline.

hmflash commented Jul 27, 2015

I just found and fixed a bug during more of my own testing. If the toc attribute was omitted, we still need the number of toc levels for the outline.

@flaub

This comment has been minimized.

Show comment
Hide comment
@flaub

flaub Mar 14, 2017

Any way this can get merged?

flaub commented Mar 14, 2017

Any way this can get merged?

@mojavelinux

This comment has been minimized.

Show comment
Hide comment
@mojavelinux

mojavelinux Mar 14, 2017

Member

Until I can review this thoroughly, I can't be positive this doesn't break other use cases. The toc situation is very tricky because it has to work forwards and backwards.

Having said that, it is possible to use this code in your own project. You can see the InfoQ mini book as an example of how to override the code in Asciidoctor PDF to perform customizations similar to this one.

See:

Member

mojavelinux commented Mar 14, 2017

Until I can review this thoroughly, I can't be positive this doesn't break other use cases. The toc situation is very tricky because it has to work forwards and backwards.

Having said that, it is possible to use this code in your own project. You can see the InfoQ mini book as an example of how to override the code in Asciidoctor PDF to perform customizations similar to this one.

See:

@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Mar 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment