Bug 1044848

Summary: RFE: Expose functionality to set TOC depth in PDF output
Product: [Community] Publican Reporter: David O'Brien <daobrien>
Component: publicanAssignee: Jeff Fearn 🐞 <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: Ruediger Landmann <rlandman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: futureCC: aigao, daobrien, rlandman
Target Milestone: 4.1   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.1.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-05 06:03:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description David O'Brien 2013-12-19 05:46:20 UTC
Description of problem:

Would like to be able to specify TOC depth in PDF files. Current behaviour seems to be to display all chapter and section heading levels used in the document.

Version-Release number of selected component (if applicable):
4.0

How reproducible:
Always

Steps to Reproduce:
1. Build any book with extended section depth (3 or 4)
2. Compare PDF and HTML outputs
3. HTML honors toc_section_depth parameter in publican.cfg but PDF does not

Actual results:

If book contains chapter and section headings down to level 4, 5, or beyond, they all appear in the TOC.


Expected results:

Would like ability to set TOC_DEPTH=<num> to limit depth to (e.g.) 1.2.3. This improves the usability of the TOC itself and if desired can be set to match that used by html output.

Additional info:

Comments from IRC exchange:

rudi: what problem are you trying to solve?
davido:  just wondering if we can match up TOC depth between the two outputs
davido: 3.1.4.7.1. Using Templates
davido: gets a bit scary

rudi: I don't think "The ToC depths is different in html and pdf" is something we'd try to solve, given that pdf is not html
rudi: But if the ToC depth is unreasonable in PDF per se, then yeah, that's a bug
rudi: FWIW, it looks like it's configurable, but maybe not on a book-by-book basis: http://code.google.com/p/wkhtmltopdf/issues/detail?id=772

rudi: I'm pretty sure it's configurable in DocBook, which would mean just exposing that control
rudi: Yeah, it is: http://docbook.sourceforge.net/release/xsl/1.77.0/doc/html/toc.section.depth.html

Comment 1 Jeff Fearn 🐞 2014-03-04 23:50:26 UTC
This should be available via the wkhtmltopdf_opts cfg parameter.

e.g. add this to publican.cfg

wkhtmltopdf_opts: "--outline-depth 3"

Can you try this please?

Comment 2 David O'Brien 2014-03-05 04:15:08 UTC
Tried a few variations of wkhtmltopdf_opts: "--outline-depth 3" but it only impacts the outline depth in the nav bar on the side pane (in Evince). It doesn't impact the TOC depth at all.

Comment 3 Jeff Fearn 🐞 2014-03-17 06:31:14 UTC
Pass chunk_section_depth to wkhtmltopdf.

To ssh://git.fedorahosted.org/git/publican.git
   376ae38..58bf708  devel -> devel

Comment 4 Jeff Fearn 🐞 2014-05-05 06:03:24 UTC
A fix for this shipped in Publican 4.1.0.