Skip to content

Commit

Permalink
Tweaked autodoc to skip :internal: methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Aug 7, 2011
1 parent 02a1317 commit ae00f6d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/conf.py
Expand Up @@ -17,6 +17,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('_themes'))
sys.path.append(os.path.abspath('.'))

# -- General configuration -----------------------------------------------------

Expand All @@ -25,7 +26,8 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
'flaskdocext']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
16 changes: 16 additions & 0 deletions docs/flaskdocext.py
@@ -0,0 +1,16 @@
import re
import inspect


_internal_mark_re = re.compile(r'^\s*:internal:\s*$(?m)')


def skip_member(app, what, name, obj, skip, options):
docstring = inspect.getdoc(obj)
if skip:
return True
return _internal_mark_re.search(docstring or '') is not None


def setup(app):
app.connect('autodoc-skip-member', skip_member)
4 changes: 2 additions & 2 deletions flask/app.py
Expand Up @@ -257,7 +257,7 @@ def __init__(self, import_name, static_path=None, static_url_path=None,
#: to load a config from files.
self.config = Config(self.root_path, self.default_config)

#: Prepare the deferred setup of the logger.
# Prepare the deferred setup of the logger.
self._logger = None
self.logger_name = self.import_name

Expand Down Expand Up @@ -1181,7 +1181,7 @@ def try_trigger_before_first_request_functions(self):
the :attr:`before_first_request_funcs` and only exactly once per
application instance (which means process usually).
.. versionadded:: 0.8
:internal:
"""
if self._got_first_request:
return
Expand Down

0 comments on commit ae00f6d

Please sign in to comment.