Skip to content

Conversation

fournier-p
Copy link

Hello,

We are trying to build several pdf files from one project and to do so we launch sphinx for each pdf with a specific root_doc value.

Here is an example of the structure:

docs/
 |
 |--index.rst (used for the website creation)
 |--DocA/
 |   \--index.rst (root_doc of DocA)
 \--DocB/
     \--index.rst (root_doc of DocB)

When changing root_doc to DocA/index.rst to build DocA (instead of index.rst for the website), we get this structure:

docs/_build/dist
 |
 |--_static/
 |   \-- css files, images, etc..
 |--DocA/
 |   \--index.html
 ⋮

The problem here is that the generated index.html file references the _static folder as if it were at the same directory level, which is not the case. It completely breaks the generation of the pdf with weasyprint as no css is found.

The goal of this pull request is to fix this issue by preventing the generation of the index.html in a subfolder and instead generating it directly in dist.

This approach seems simpler to me instead of trying to generate the html file with the correct path to the _static folder. (as there may also be many other folders needed that are added by some extensions)

@fournier-p fournier-p changed the title Bugfix: Error when root_doc points to a file in a subdirectory of src_dir Bugfix: Error when root_doc points to a file in a subdirectory of src_dir Apr 30, 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