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

latex builder fails in case no caption option is provided to toctree directive #2465

Closed
splendido opened this issue Apr 18, 2016 · 3 comments
Assignees
Milestone

Comments

@splendido
Copy link

[email protected]
[email protected]

this line is trying to check whether a caption option was provided to the toctree directive or not before trying to get the option value.
But at the moment if fails when no caption is provided making docutils throw the following error:

  File "/usr/local/lib/python2.7/dist-packages/sphinx/cmdline.py", line 244, in main
    app.build(opts.force_all, filenames)
  File "/usr/local/lib/python2.7/dist-packages/sphinx/application.py", line 287, in build
    self.builder.build_update()
  File "/usr/local/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line 246, in build_update
    self.build(['__all__'], to_build)
  File "/usr/local/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line 322, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/local/lib/python2.7/dist-packages/sphinx/builders/latex.py", line 130, in write
    doctree.settings.contentsname = self.get_contentsname(docname)
  File "/usr/local/lib/python2.7/dist-packages/sphinx/builders/latex.py", line 140, in get_contentsname
    if toctree['caption']:
  File "/usr/local/lib/python2.7/dist-packages/docutils/nodes.py", line 567, in __getitem__
    return self.attributes[key]
KeyError: 'caption'

The problem can be easily fixed by substituting the very same line with:

if 'caption' in toctree:

Please let me know if you'd like me to prepare a PR with the proposed fix.

@tk0miya tk0miya added this to the 1.4.2 milestone Apr 19, 2016
@tk0miya tk0miya self-assigned this Apr 19, 2016
@tk0miya
Copy link
Member

tk0miya commented Apr 19, 2016

I'll take a look.

tk0miya added a commit that referenced this issue Apr 22, 2016
@tk0miya
Copy link
Member

tk0miya commented Apr 22, 2016

Fixed at 88322af
Thank you for report!

@tk0miya tk0miya closed this as completed Apr 22, 2016
@splendido
Copy link
Author

👍

Tarrasch added a commit to Tarrasch/luigi that referenced this issue Jul 13, 2016
I saw that the build was failing, hence this is my attempt to fix it,
altough I don't know how to test this before merging it.
See https://readthedocs.org/projects/luigi/builds/4189801/

Unfortunately I couldn't find a way to connect a webhook between GitHub
PRs and readthedocs: readthedocs/readthedocs.org#1340

The reason I believe a version bump would fix it is because I see
exactly the same error as in sphinx-doc/sphinx#2465 and readthedocs
seem to use 1.3.5, causing the pdf docs to be outdated.
Tarrasch added a commit to spotify/luigi that referenced this issue Jul 13, 2016
I saw that the build was failing, hence this is my attempt to fix it,
altough I don't know how to test this before merging it.
See https://readthedocs.org/projects/luigi/builds/4189801/

Unfortunately I couldn't find a way to connect a webhook between GitHub
PRs and readthedocs: readthedocs/readthedocs.org#1340

The reason I believe a version bump would fix it is because I see
exactly the same error as in sphinx-doc/sphinx#2465 and readthedocs
seem to use 1.3.5, causing the pdf docs to be outdated.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants