Skip to content

Commit

Permalink
Update conf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Seraf committed Aug 2, 2014
1 parent 7e618ba commit 4f6c45e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# serve to show the default.

import sys, os
from sphinx.directives import TocTree

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -250,6 +251,19 @@
locale_dirs = ['locale'] # path is example but recommended.
gettext_compact = False # optional.

def skip_mod_init_member(app, what, name, obj, skip, options):
if name.startswith('_'):
return True
if isinstance(obj, types.FunctionType) and obj.__name__ == 'mod_init':
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)

Expand All @@ -259,3 +273,8 @@ def run(self):
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)

0 comments on commit 4f6c45e

Please sign in to comment.