Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #24940 on branch v3.7.x ([MNT] specify which gallery sections come last) #24945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions doc/sphinxext/gallery_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sphinx_gallery.sorting import ExplicitOrder

# Gallery sections shall be displayed in the following order.
# Non-matching sections are appended.
# Non-matching sections are inserted at UNSORTED
explicit_order_folders = [
'../examples/lines_bars_and_markers',
'../examples/images_contours_and_fields',
Expand All @@ -29,6 +29,9 @@
'../plot_types/stats',
'../plot_types/unstructured',
'../plot_types/3D',
'UNSORTED',
'../examples/userdemo',
'../tutorials/provisional',
]


Expand All @@ -37,11 +40,9 @@ class MplExplicitOrder(ExplicitOrder):
def __call__(self, item):
"""Return a string determining the sort order."""
if item in self.ordered_list:
return "{:04d}".format(self.ordered_list.index(item))
return f"{self.ordered_list.index(item):04d}"
else:
# ensure not explicitly listed items come last.
return "zzz" + item

return f"{self.ordered_list.index('UNSORTED'):04d}{item}"

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