diff options
author | Georg Brandl <georg@python.org> | 2010-06-12 18:16:18 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-06-12 18:16:18 +0200 |
commit | 7c7d3f40102764a5ad0e46d35ff23bfd7f0340f8 (patch) | |
tree | 30b70e14813724ae13f522f30ae7532796805b06 /sphinx/ext/autodoc.py | |
parent | d30d286486562a51720e84e3528dfcfbef70ec26 (diff) | |
download | sphinx-git-7c7d3f40102764a5ad0e46d35ff23bfd7f0340f8.tar.gz |
Added ``exclude`` argument to :func:`.autodoc.between`. From http://bitbucket.org/mfperzel/sphinx-additions.
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r-- | sphinx/ext/autodoc.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 8e5c5ce94..adf08bcde 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -164,11 +164,12 @@ def cut_lines(pre, post=0, what=None): lines.append('') return process -def between(marker, what=None, keepempty=False): +def between(marker, what=None, keepempty=False, exclude=False): """ - Return a listener that only keeps lines between lines that match the - *marker* regular expression. If no line matches, the resulting docstring - would be empty, so no change will be made unless *keepempty* is true. + Return a listener that either keeps, or if *exclude* is True excludes, lines + between lines that match the *marker* regular expression. If no line + matches, the resulting docstring would be empty, so no change will be made + unless *keepempty* is true. If *what* is a sequence of strings, only docstrings of a type in *what* will be processed. @@ -178,7 +179,7 @@ def between(marker, what=None, keepempty=False): if what and what_ not in what: return deleted = 0 - delete = True + delete = not exclude orig_lines = lines[:] for i, line in enumerate(orig_lines): if delete: |