6
6
from sphinx_gallery .sorting import ExplicitOrder
7
7
8
8
# 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 ):]])
36
55
37
56
38
57
class MplExplicitOrder (ExplicitOrder ):
@@ -42,7 +61,7 @@ def __call__(self, item):
42
61
if item in self .ordered_list :
43
62
return f"{ self .ordered_list .index (item ):04d} "
44
63
else :
45
- return f"{ self .ordered_list .index (' UNSORTED' ):04d} { item } "
64
+ return f"{ self .ordered_list .index (UNSORTED ):04d} { item } "
46
65
47
66
# Subsection order:
48
67
# Subsections are ordered by filename, unless they appear in the following
0 commit comments