Closed mathiasertl closed 2 years ago
Hum, I agree that your proposal is a saner default. probably at the time I wrote this, src_dir was not available..
However merging this means probably breaking everyone else's doc.
I would prefer a solution one would have to configure in conf.py. So a maybe documentation patch as you suggests
Hmm.
However merging this means probably breaking everyone else's doc.
This only changes behavior if you have a separate source dir (it works as before if you do not, which is the default and by far the most common variant, AFAICT). In this case the documentation for :file:
doesn't cover you anyway as the source/
dir is never included in any other directive and this projects doesn't use it all.
I only found out how to use the templates really debugging the code. I would guess that most users with split dirs just couldn't get it to work and tried something else. So IMHO this would only cover few users that probably already recognized this as a bug already.
Also, configuring jinja_base
manually to a dir that Sphinx already knows about is quite redundant.
Naturally it's up to you the maintainer to decide what you think is best. Just let me know, I'd also update the docs for you if you prefer.
So I just verified this indeed does not brake buildbot's doc, so for what that test is worth I'll merge it..
Use
app.srcdir
as jinja_base. Without this, sphinx-jinja behaves inconsistently when selecting "separate source and build directories" (-> Makefile is one level above index.rst/conf.py!) on startup like this:If you then enable sphinx-jinja (obviously), create
docs/source/test.rst
and try to use it with bothinclude
andjinja
directives:With
index.rst
being (what you would expect, I would say):... and finally generate documentation the usual way:
Without the patch, you'll get a "jinja2.exceptions.TemplateNotFound: test.rst", because
jinja_base
is (falsly, I would argue)docs/
and notdocs/source/
. As a workaround without the patch, you can specify:file: source/test.rst
, which then works (or manually compute the undocumentedjinja_base
option.