Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be7ea76

Browse filesBrowse files
authored
Merge pull request #25028 from story645/gallery_order
seperate out folders in gallery ordering
2 parents ba7a45a + 95dab27 commit be7ea76
Copy full SHA for be7ea76

File tree

1 file changed

+47
-28
lines changed
Filter options

1 file changed

+47
-28
lines changed

‎doc/sphinxext/gallery_order.py

Copy file name to clipboardExpand all lines: doc/sphinxext/gallery_order.py
+47-28Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,52 @@
66
from sphinx_gallery.sorting import ExplicitOrder
77

88
# Gallery sections shall be displayed in the following order.
9-
# Non-matching sections are inserted at UNSORTED
10-
explicit_order_folders = [
11-
'../examples/lines_bars_and_markers',
12-
'../examples/images_contours_and_fields',
13-
'../examples/subplots_axes_and_figures',
14-
'../examples/statistics',
15-
'../examples/pie_and_polar_charts',
16-
'../examples/text_labels_and_annotations',
17-
'../examples/pyplots',
18-
'../examples/color',
19-
'../examples/shapes_and_collections',
20-
'../examples/style_sheets',
21-
'../examples/axes_grid1',
22-
'../examples/axisartist',
23-
'../examples/showcase',
24-
'../tutorials/introductory',
25-
'../tutorials/intermediate',
26-
'../tutorials/advanced',
27-
'../plot_types/basic',
28-
'../plot_types/arrays',
29-
'../plot_types/stats',
30-
'../plot_types/unstructured',
31-
'../plot_types/3D',
32-
'UNSORTED',
33-
'../examples/userdemo',
34-
'../tutorials/provisional',
35-
]
9+
# Non-matching sections are inserted at the unsorted position
10+
11+
UNSORTED = "unsorted"
12+
13+
examples_order = [
14+
'../examples/lines_bars_and_markers',
15+
'../examples/images_contours_and_fields',
16+
'../examples/subplots_axes_and_figures',
17+
'../examples/statistics',
18+
'../examples/pie_and_polar_charts',
19+
'../examples/text_labels_and_annotations',
20+
'../examples/pyplots',
21+
'../examples/color',
22+
'../examples/shapes_and_collections',
23+
'../examples/style_sheets',
24+
'../examples/axes_grid1',
25+
'../examples/axisartist',
26+
'../examples/showcase',
27+
UNSORTED,
28+
'../examples/userdemo',
29+
]
30+
31+
tutorials_order = [
32+
'../tutorials/introductory',
33+
'../tutorials/intermediate',
34+
'../tutorials/advanced',
35+
UNSORTED,
36+
'../tutorials/provisional'
37+
]
38+
39+
plot_types_order = [
40+
'../plot_types/basic',
41+
'../plot_types/arrays',
42+
'../plot_types/stats',
43+
'../plot_types/unstructured',
44+
'../plot_types/3D',
45+
UNSORTED
46+
]
47+
48+
folder_lists = [examples_order, tutorials_order, plot_types_order]
49+
50+
explicit_order_folders = [fd for folders in folder_lists
51+
for fd in folders[:folders.index(UNSORTED)]]
52+
explicit_order_folders.append(UNSORTED)
53+
explicit_order_folders.extend([fd for folders in folder_lists
54+
for fd in folders[folders.index(UNSORTED):]])
3655

3756

3857
class MplExplicitOrder(ExplicitOrder):
@@ -42,7 +61,7 @@ def __call__(self, item):
4261
if item in self.ordered_list:
4362
return f"{self.ordered_list.index(item):04d}"
4463
else:
45-
return f"{self.ordered_list.index('UNSORTED'):04d}{item}"
64+
return f"{self.ordered_list.index(UNSORTED):04d}{item}"
4665

4766
# Subsection order:
4867
# Subsections are ordered by filename, unless they appear in the following

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.