TOC levels in asciidoc-pdf generated docs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

TOC levels in asciidoc-pdf generated docs

jnilo
Hello all
I have installed the alpha version of asciidoc-pdf. Great program !
$ asciidoctor-pdf -v
Asciidoctor PDF 1.5.0.alpha.8 using Asciidoctor 1.5.2 [http://asciidoctor.org]
Runtime Environment (ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-cygwin]) (lc:UTF-8 fs:Windows-1252 in:- ex:UTF-8)
The only problem I have discovered so far while converting my 200+ pages document is that TOC levels above 2 do not show up in the TOC of the generated pdf, i.e. if you run the following sample program, sub-section 1 won't show up in the pdf TOC.
= Test

== Chapter 1

=== Section 1

==== Sub-section 1
Is there a way to fix that ?
Jacques
Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

mojavelinux
Administrator
To customize this behavior, you need to set the toclevels attribute in your document header.


Cheers,

-Dan

On Wed, Jul 1, 2015 at 11:08 PM, jnilo [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello all
I have installed the alpha version of asciidoc-pdf. Great program !
$ asciidoctor-pdf -v
Asciidoctor PDF 1.5.0.alpha.8 using Asciidoctor 1.5.2 [http://asciidoctor.org]
Runtime Environment (ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-cygwin]) (lc:UTF-8 fs:Windows-1252 in:- ex:UTF-8)
The only problem I have discovered so far while converting my 200+ pages document is that TOC levels above 2 do not show up in the TOC of the generated pdf, i.e. if you run the following sample program, sub-section 1 won't show up in the pdf TOC.
= Test

== Chapter 1

=== Section 1

==== Sub-section 1
Is there a way to fix that ?
Jacques


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/TOC-levels-in-asciidoc-pdf-generated-docs-tp3461.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

jnilo
Thanks Dan this is working great !
Another related questions:
1/ Is there a way to force skip page at section level while generating pdf  ?
2/ Is there a way to force only sub-section page display on html file generated by
asciidoctor  -b html5 -a theme=flask test.adoc
Cheers
Jacques
Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

mojavelinux
Administrator

On Thu, Jul 2, 2015 at 2:32 AM, jnilo [via Asciidoctor :: Discussion] <[hidden email]> wrote:
1/ Is there a way to force skip page at section level while generating pdf  ?

I'm not sure what you mean by "force skip page". Could you clarify?
 
2/ Is there a way to force only sub-section page display on html file generated by

Do you mean you want to only render a section of the document? If so, see this issue: https://github.com/asciidoctor/asciidoctor/issues/626

Cheers,

-Dan

--
Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

jnilo
mojavelinux wrote
I'm not sure what you mean by "force skip page". Could you clarify?
I would like all  chapters (toc level 2 in my previous example) to be printed at the beginning of a new page

mojavelinux wrote
Do you mean you want to only render a section of the document? If so, see
this issue: https://github.com/asciidoctor/asciidoctor/issues/626
In fact I would like to render, in html output, only the lowest level content. For example if my code is:
= Test
John Dow
:toc:
:toclevels: 4

== Chapter 1

=== Section 1

==== Sub-section 1

==== Sub-section 2

==== Sub-section 3
I would like only Sub-section 1 being displayed while accessing it through TOC which probably implies some form of "chunking"
Cheers
Jacques

Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

mojavelinux
Administrator

On Thu, Jul 2, 2015 at 2:46 AM, jnilo [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I would like all  chapters (toc level 2 in my previous example) to be printed at the beginning of a new page

Thanks for clarifying the question. One way to accomplish this is by setting the doctype to book instead of the default, article.

-d book

or

:doctype: book

Another option is to add a conditional page break above each section you want to have start on a new page:

ifdef::backend-pdf[<<<]

Cheers,

-Dan

--
Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

mojavelinux
Administrator
In reply to this post by jnilo

On Thu, Jul 2, 2015 at 2:46 AM, jnilo [via Asciidoctor :: Discussion] <[hidden email]> wrote:
In fact I would like to render, in html output, only the lowest level content.

This is not yet supported out of the box. However, if you are willing to write an extension or use the Asciidoctor API directly, you can manipulate the document tree (AST) and then render on the parts you want.

For instance, a TreeProcessor can return a new document tree, which could be just a section of the document. If you are using the API, you can call render on any node in the tree.

Cheers,

Reply | Threaded
Open this post in threaded view
|

Re: TOC levels in asciidoc-pdf generated docs

wolandscat
In reply to this post by jnilo
Is this related to the typical 'keep-with' operator that most DTP tools support in para style definitions? Normally section styles have keep-with-next set to True meaning that if the next para (typically some kind of Body text) is sucked on to the next page, the header will be pulled through with it.

This effect can be chained, causing a number of paras to be pulled onto a new page.