Skip to content

Commit cb225f9

Browse files
committed
docs: Revise Examples Gallery and update navigation structure
- Integrated the Examples Gallery page into the Gallery Overview for streamlined access. - Updated the navigation links in the main index to point directly to the new gallery structure. - Enhanced the table of contents for the gallery to improve user navigation and visibility of categories.
1 parent fd22487 commit cb225f9

File tree

3 files changed

+55
-25
lines changed

3 files changed

+55
-25
lines changed

docs/conf.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,52 @@
8282
myst_heading_anchors = 3
8383

8484

85+
_GALLERY_TOC_OLD = """.. toctree::
86+
:hidden:
87+
:includehidden:
88+
89+
90+
/gallery/01_basic_plots/index.rst
91+
/gallery/02_statistical_plots/index.rst
92+
/gallery/03_bar_charts/index.rst
93+
/gallery/04_scientific_plots/index.rst
94+
/gallery/05_time_series/index.rst
95+
/gallery/06_specialized_plots/index.rst
96+
/gallery/07_layout_styling/index.rst
97+
/gallery/08_colors_images/index.rst
98+
"""
99+
100+
_GALLERY_TOC_NEW = """.. toctree::
101+
:maxdepth: 1
102+
:caption: Categories
103+
104+
Basic Plots <gallery/01_basic_plots/index>
105+
Statistical Plots <gallery/02_statistical_plots/index>
106+
Bar Charts <gallery/03_bar_charts/index>
107+
Scientific Plots <gallery/04_scientific_plots/index>
108+
Time Series <gallery/05_time_series/index>
109+
Specialized Plots <gallery/06_specialized_plots/index>
110+
Layout & Styling <gallery/07_layout_styling/index>
111+
Colors & Images <gallery/08_colors_images/index>
112+
"""
113+
114+
115+
def _patch_gallery_toc(_app, docname, source):
116+
"""Ensure sphinx-gallery output exposes the category toctree in nav."""
117+
if docname != "gallery/index":
118+
return
119+
120+
current = source[0]
121+
if _GALLERY_TOC_NEW in current:
122+
return
123+
124+
if _GALLERY_TOC_OLD in current:
125+
source[0] = current.replace(_GALLERY_TOC_OLD, _GALLERY_TOC_NEW)
126+
else:
127+
# Fall back to appending so nav still appears if template changes.
128+
source[0] = f"{current.strip()}\n\n{_GALLERY_TOC_NEW}"
129+
130+
85131
def _generate_gallery_assets(_app):
86132
"""Bake high-res color system images during the build."""
87133
from generate_gallery import build_gallery_assets
@@ -91,4 +137,5 @@ def _generate_gallery_assets(_app):
91137

92138
def setup(app):
93139
app.connect("builder-inited", _generate_gallery_assets)
140+
app.connect("source-read", _patch_gallery_toc)
94141
return {"parallel_read_safe": True}

docs/examples_gallery.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
# Examples Gallery
1+
---
2+
orphan: true
3+
---
24

3-
Browse every category’s thumbnails on a single page. Use the left sidebar to jump
4-
to a section; the page will scroll to that spot. To view all examples on a separate page,
5-
use the {doc}`gallery/index` link.
5+
# Examples Gallery
66

7-
```{eval-rst}
8-
.. include:: gallery/index.rst
9-
:start-line: 22
10-
:end-before: .. toctree::
11-
```
7+
이 페이지는 이제 `Gallery Overview <gallery/index>`_ 페이지로 통합되었습니다. 즐겨찾기나 링크를 업데이트해 주세요.
128

139
```{eval-rst}
1410
.. only:: html
1511
16-
.. container:: sphx-glr-footer sphx-glr-footer-gallery
17-
18-
.. container:: sphx-glr-download sphx-glr-download-python
19-
20-
:download:`Download all examples in Python source code: gallery_python.zip </gallery/gallery_python.zip>`
21-
22-
.. container:: sphx-glr-download sphx-glr-download-jupyter
23-
24-
:download:`Download all examples in Jupyter notebooks: gallery_jupyter.zip </gallery/gallery_jupyter.zip>`
25-
26-
27-
.. only:: html
28-
29-
.. rst-class:: sphx-glr-signature
12+
.. raw:: html
3013
31-
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
14+
<meta http-equiv="refresh" content="0; url=gallery/index.html">
3215
```

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ opinionated styles, curated color libraries, and layout utilities.
1616
Installation <installation>
1717
Usage Guide <DARTWORK_MPL_USAGE_GUIDE>
1818
Color System <COLOR_SYSTEM>
19-
Examples Gallery <examples_gallery>
19+
Examples Gallery <gallery/index>
2020
API Reference <api/index>
2121
```

0 commit comments

Comments
 (0)