Skip to content

Commit b86435a

Browse files
committed
control irradiance-transposition gallery order via custom sort key
1 parent c983d0a commit b86435a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/sphinx/source/conf.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,32 @@ def setup(app):
384384
# https://github.com/pvlib/pvlib-python/issues/837
385385
suppress_warnings = ['ref.footnote']
386386

387+
388+
def irradiance_transposition_sort_key(filename):
389+
order = [
390+
"plot_ghi_transposition.py",
391+
"plot_transposition_gain.py",
392+
"plot_interval_transposition_error.py",
393+
"use_perez_modelchain.py",
394+
"plot_mixed_orientation.py",
395+
"plot_seasonal_tilt.py",
396+
"plot_rtranpose_year.py",
397+
"plot_rtranpose_limitations.py",
398+
]
399+
400+
subsection = os.path.basename(os.path.dirname(filename))
401+
402+
if subsection == "irradiance-transposition":
403+
name = os.path.basename(filename)
404+
if name in order:
405+
return (0, order.index(name))
406+
else:
407+
return (0, len(order))
408+
409+
# For everything else, fall back to filename sorting
410+
return (1, filename)
411+
412+
387413
# settings for sphinx-gallery
388414
sphinx_gallery_conf = {
389415
'examples_dirs': ['../../examples'], # location of gallery scripts
@@ -400,6 +426,9 @@ def setup(app):
400426

401427
# https://sphinx-gallery.github.io/dev/configuration.html#removing-config-comments # noqa: E501
402428
'remove_config_comments': True,
429+
430+
# Explicit ordering for irradiance-transposition subsection
431+
'within_subsection_order': irradiance_transposition_sort_key,
403432
}
404433
# supress warnings in gallery output
405434
# https://sphinx-gallery.github.io/stable/configuration.html

0 commit comments

Comments
 (0)