Fix indexst variable does not exist when own index gallery is first#1383
Fix indexst variable does not exist when own index gallery is first#1383lucyleeow merged 11 commits intosphinx-gallery:masterfrom
indexst variable does not exist when own index gallery is first#1383Conversation
for more information, see https://pre-commit.ci
|
A When a gallery folder has it's own The test thus fails as the @larsoner I've amended the code such that we do not collect any folders that called |
I think just avoiding |
larsoner
left a comment
There was a problem hiding this comment.
Just one question about a comment otherwise LGTM!
sphinx_gallery/gen_gallery.py
Outdated
| subfolders = [ | ||
| subfolder | ||
| for subfolder in subfolders | ||
| # Returns `None` if `index.rst` or gallery header found |
There was a problem hiding this comment.
Right?
| # Returns `None` if `index.rst` or gallery header found | |
| # Returns `None` if neither `index.rst` nor gallery header found |
There was a problem hiding this comment.
Turns out we are both wrong, this whole thing is pretty confusing.
sphinx-gallery/sphinx_gallery/gen_rst.py
Lines 433 to 458 in 7ddaf92
If there is an index.rst -> return None
If there is a gallery header -> return file path
If there is no index.rst, no gallery header and raise is false -> None
So we want a subsection dir to contain a gallery header, so we check that the return is not None, which only happens when there is a gallery header. Let me amend the comment to be what happens when return is not None, as this is what we are checking for anyway.
There was a problem hiding this comment.
Actually the check_for_index parameter name is pretty confusing here, what about we change it to check_for_header or check_for_gallery_header but thats a bit verbose.
There was a problem hiding this comment.
changed to check_for_header
|
I think those are both close enough we could wait for them! |
|
Happy to wait. Should it be a minor release then, or patch still? |
|
Might as well make it a minor release |
closes #1382
Bug introduced by refactor in #1332
When the first gallery in the example gallery loop, in
generate_gallery_rst, is one with its ownindex.rstfile, theindexstvariable does not exist which is a problem because we pass it to_finish_index_rst. This variable is not used in_finish_index_rstwhen the gallery has its own index.rst file but_finish_index_rstdoes various other things so needs to be run always, even when the gallery has its ownindex.rst.Adds test.
Will do a patch release once this is merged