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

FIX - Crash in translator when using a non HTML builder #2142

Closed

Conversation

s-weigand
Copy link

This change skips the transpator setup if the builder is not targeting html as the format.

In our readthedocs config, we use formats: all which besides HTML also builds PDF using the latex builder, causing the following error:

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/pyglotaran-extras/conda/latest/lib/python3.10/site-packages/pydata_sphinx_theme/translator.py", line 44, in visit_table
    self._table_row_indices.append(0)
AttributeError: 'BootstrapHTML5Translator' object has no attribute '_table_row_indices'

This builder has the default_translator_class defined, but it is not compatible with the BootstrapHTML5TranslatorMixin and thus causes the AttributeError above.

This can be prevented by first checking if the builder uses the html format, which is true for the html and singlehtml builders.

Since the builder format does not change and is independent of the translator, it makes sense to lift it out of the loop over translators.

@s-weigand
Copy link
Author

Sorry I didn't look at the other open PRs and it turns out this is duplicate of #2076

@s-weigand s-weigand closed this Mar 1, 2025
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

Successfully merging this pull request may close these issues.

1 participant