From 7a4752e6ed6a3b0c3698473a6dd3a71ff9ba2acb Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Wed, 29 Sep 2021 12:43:25 +0200 Subject: [PATCH] Fix gallery without sections --- nbsite/gallery/gen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nbsite/gallery/gen.py b/nbsite/gallery/gen.py index dab867a4..7f8e6f8b 100644 --- a/nbsite/gallery/gen.py +++ b/nbsite/gallery/gen.py @@ -420,14 +420,17 @@ def generate_gallery(app, page): deployment_urls = [] if not heading: - gallery_rst += f'\n\n.. raw:: html\n\n

\n\n' + gallery_rst += f'\n\n.. raw:: html\n\n

\n\n' elif inline: gallery_rst += f'\n\n.. toctree::\n :glob:\n :hidden:\n :maxdepth: 2\n\n {section}/*' else: underline = '-'*len(heading) gallery_rst += f'\n\n{heading}\n{underline}\n\n' - gallery_rst += f'\n\n.. toctree::\n :glob:\n :hidden:\n\n {heading}\n {section}/*\n\n' + if section: + gallery_rst += f'\n\n.. toctree::\n :glob:\n :hidden:\n\n {heading}\n {section}/*\n\n' + else: + gallery_rst += f'\n\n.. toctree::\n :glob:\n :hidden:\n\n {heading}\n *\n\n' if labels: gallery_rst += '\n\n.. raw:: html\n\n'