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

Nested include directives fail due to relative pathing issues #10971

Open
ttutko opened this issue Nov 14, 2022 · 0 comments
Open

Nested include directives fail due to relative pathing issues #10971

ttutko opened this issue Nov 14, 2022 · 0 comments

Comments

@ttutko
Copy link

ttutko commented Nov 14, 2022

Describe the bug

With the following project structure:

└── source  
        ├── _static  
        ├── _templates  
        ├── conf.py  
        ├── index.rst  
        └── parent  
            ├── child  
            │   ├── mychild.rst  
            │   └── mysibling.rst  
            └── myparent.rst

Where myparent.rst has the following include directive:
.. include:: ./child/mychild.rst

and mychild.rst has the following include directive:
..include:: ./mysibling.rst

The html build will fail with:

source/parent/child/mychild.rst:3: CRITICAL: Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: 'source/parent/mysibling.rst'.

Per issue #6805, this sort of makes sense as "mychild.rst" gets included in "myparent.rst" making everything then relative to "myparent.rst". However, if I change the include in "mychild.rst" to then be:
.. include:: ./child/mysibling.rst

The following error occurs where you will notice that the sub directory is repeated an extra time:

/docs/src/source/parent/child/mychild.rst:3: CRITICAL: Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: 'source/parent/child/child/mysibling.rst'.

This leads me with no clear path on how to do this and doesn't make sense to me.

How to Reproduce

I've placed a minimal sample on a Github repository: Sphinx Include Bug.

Environment Information

--bug-report doesn't appear to work anymore but this is with version 5.3.0

Sphinx extensions

No response

Additional context

No response

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

2 participants