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

globaltoc_maxdepth fails on its default value #221

Closed
humitos opened this issue Aug 27, 2023 · 6 comments
Closed

globaltoc_maxdepth fails on its default value #221

humitos opened this issue Aug 27, 2023 · 6 comments

Comments

@humitos
Copy link
Member

humitos commented Aug 27, 2023

FWI: in the theme.conf I had to set globaltoc_maxdepth to an integer ..

[options]
globaltoc_maxdepth = 5

it seems the default is an empty string ...

  File "site-packages/sphinx/themes/basic/../basic/layout.html", line 60, in template
    {%- include sidebartemplate %}
  File "site-packages/sphinx/themes/basic/globaltoc.html", line 11, in top-level template code
    {{ toctree(includehidden=theme_globaltoc_includehidden, collapse=theme_globaltoc_collapse, maxdepth=theme_globaltoc_maxdepth) }}
  File "site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "site-packages/notfound/extension.py", line 128, in toctree
    toc = global_toctree_for_doc(
  File "sphinx/environment/adapters/toctree.py", line 86, in global_toctree_for_doc
    maxdepth=int(maxdepth),
ValueError: invalid literal for int() with base 10: ''

There was a similar issue in the past:

I assume the issue has been back by:

Originally posted by @return42 in #219 (comment)

@humitos
Copy link
Member Author

humitos commented Aug 27, 2023

@return42 do you have a minimal reproducible example I can test? At first sight it doesn't seem a problem with the extension itself but on Sphinx or the theme, I'd say.

@humitos
Copy link
Member Author

humitos commented Aug 27, 2023

I reported a similar issue with includehidden= at sphinx-doc/sphinx#11607 and it seems the regression was introduced in the same commit.

@return42
Copy link

minimal reproducible example I can test?

Sorry, I don't have one at hand / we use the pallets-sphinx-themes

At first sight it doesn't seem a problem with the extension itself but on Sphinx or the theme, I'd say.

AFAIK its a sphinx error .. the default of globaltoc_maxdepth is an empty string if unset in the theme .. and then Sphinx raises an error:

File "sphinx/environment/adapters/toctree.py", line 86, in global_toctree_for_doc
    maxdepth=int(maxdepth),
ValueError: invalid literal for int() with base 10: ''

@humitos
Copy link
Member Author

humitos commented Aug 30, 2023

Thanks for you help debugging this. I'm closing this issue since it's an upstream issue.

@humitos humitos closed this as completed Aug 30, 2023
@AA-Turner
Copy link
Contributor

@return42 please test with Sphinx 7.2.5; if the issue persists please open a new Sphinx issue.

A

@return42
Copy link

@AA-Turner I can confirm issue does no longer exists in Sphinx 7.2.5 .. thanks a lot for having an eye on 👍

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

No branches or pull requests

3 participants