Skip to content

Commit 2efb4f7

Browse files
added dedent()ation to Keyword.__doc__ property for better formatting results in further doc string usage
1 parent a74fb30 commit 2efb4f7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

robottools/library/keywords/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
'InvalidKeywordOption', 'KeywordNotDefined']
3333

3434
from itertools import chain
35+
from textwrap import dedent
3536

3637
from moretools import dictitems, dictvalues
3738

@@ -63,7 +64,12 @@ def __doc__(self):
6364
"""The Keyword's documentation string,
6465
taken from ``self.func.__doc__``.
6566
"""
66-
return self.func.__doc__
67+
doc = self.func.__doc__
68+
if doc is None:
69+
return None
70+
if '\n' in doc:
71+
first_line, rest = doc.split('\n', 1)
72+
return "%s\n%s" % (first_line, dedent(rest))
6773

6874
@property
6975
def libname(self):

0 commit comments

Comments
 (0)