summaryrefslogtreecommitdiff
path: root/sphinx/util/docstrings.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2009-02-05 13:28:46 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2009-02-05 13:28:46 +0100
commitbf943483c032dc26009e377c112734864d71a633 (patch)
tree1bc4a48220c091bb60f8927334771bfb66e574be /sphinx/util/docstrings.py
parent4f21cce12e4153eafa41ca36411c24be8ee25da7 (diff)
downloadsphinx-git-bf943483c032dc26009e377c112734864d71a633.tar.gz
attribute documentation now overrides non attribute documentation.
This makes it possible to document aliased methods and other things:: def foo(self): pass #: an alias for foo() foo_alias = foo Also attribute documentation can contain paragraphs now.
Diffstat (limited to 'sphinx/util/docstrings.py')
-rw-r--r--sphinx/util/docstrings.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/util/docstrings.py b/sphinx/util/docstrings.py
index 1b0a599a6..ea03340a0 100644
--- a/sphinx/util/docstrings.py
+++ b/sphinx/util/docstrings.py
@@ -49,8 +49,12 @@ def prepare_commentdoc(s):
result = []
lines = [line.strip() for line in s.expandtabs().splitlines()]
for line in lines:
- if line.startswith('#: '):
- result.append(line[3:])
+ if line.startswith('#:'):
+ line = line[2:]
+ # the first space after the comment is ignored
+ if line and line[0] == ' ':
+ line = line[1:]
+ result.append(line)
if result and result[-1]:
result.append('')
return result