mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix the order of release notes listing
This commit is contained in:
parent
3f4fc455a3
commit
8223969b0f
2 changed files with 23 additions and 1 deletions
22
doc/conf.py
22
doc/conf.py
|
@ -4,6 +4,9 @@ import sys
|
|||
import os
|
||||
import types
|
||||
|
||||
from sphinx.directives import TocTree
|
||||
|
||||
|
||||
class Mock(object):
|
||||
'''
|
||||
Mock out specified imports
|
||||
|
@ -189,6 +192,7 @@ epub_identifier = 'http://saltstack.org/'
|
|||
|
||||
#epub_tocdepth = 3
|
||||
|
||||
|
||||
def skip_mod_init_member(app, what, name, obj, skip, options):
|
||||
if name.startswith('_'):
|
||||
return True
|
||||
|
@ -196,5 +200,23 @@ def skip_mod_init_member(app, what, name, obj, skip, options):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _normalize_version(args):
|
||||
_, path = args
|
||||
return '.'.join([x.zfill(4) for x in (path.split('/')[-1].split('.'))])
|
||||
|
||||
|
||||
class ReleasesTree(TocTree):
|
||||
option_spec = dict(TocTree.option_spec)
|
||||
|
||||
def run(self):
|
||||
rst = super(ReleasesTree, self).run()
|
||||
entries = rst[0][0]['entries'][:]
|
||||
entries.sort(key=_normalize_version, reverse=True)
|
||||
rst[0][0]['entries'][:] = entries
|
||||
return rst
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_directive('releasestree', ReleasesTree)
|
||||
app.connect('autodoc-skip-member', skip_mod_init_member)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Release notes and upgrade instructions
|
||||
======================================
|
||||
|
||||
.. toctree::
|
||||
.. releasestree::
|
||||
:maxdepth: 1
|
||||
:glob:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue