Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.. only:: does not seem to affect inclusion of pages in toctree_only LaTeX builds #2132

Open
rryan opened this issue Nov 25, 2015 · 1 comment

Comments

@rryan
Copy link

rryan commented Nov 25, 2015

For a LaTeX build with toctree_only set to True and a custom content only included based on a tag in the root document:

Contents of index.rst, the root document:

Welcome to the manual!

.. toctree::
   :maxdepth: 2
   :glob:
   :numbered:

   chapters/introduction

.. etc

.. only:: not release

   .. include:: index_developer.rst

Contents of index_developer.rst:

**For documentation writers**

.. toctree::
   :numbered:

   /todolist
   /manual_guidelines

The TOC-tree in index_developer.rst is included in the final LaTeX document (and in the Table of Contents) regardless of the value of the 'release' tag. Works fine for the HTML builder (the pages 'todolist' and 'manual_guidelines' are generated but not linked from the table of contents in index.html).

Let me know if I didn't explain this clearly enough :).

@rryan rryan changed the title .. only:: does not seem to inclusion of pages in toctree_only LaTeX builds .. only:: does not seem to affect inclusion of pages in toctree_only LaTeX builds Nov 25, 2015
@shimizukawa
Copy link
Member

I think only and ifconfig directive was not designed to control section and toctree. Such usage causes unexpected behaviors (refs: #1488, #1717).
I guess this issue you mentioned is one of them.

memo for dev:
In my short investigation, sphinx.builders.latex doesn't treat 'only' node on resolving time of toctree.
sphinx.builders.Builder.write treat 'only' directive by calling self.env.get_and_resolve_doctree. However, sphinx.builders.latex.LaTeXBuilder.write doesn't call Builder.write method and doesn't call get_and_resolve_doctree because LaTeX writer need to concat all toctrees by using LaTeXBuilder.assemble_doctree method instead of get_and_resolve_doctree.
I guess LaTeXBuilder.assemble_doctree should have a treating code for 'only' directive to resolve this issue.

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

No branches or pull requests

3 participants