From: <go...@us...> - 2005-12-06 01:06:21
|
Author: goodger Date: 2005-12-06 02:05:17 +0100 (Tue, 06 Dec 2005) New Revision: 4146 Modified: trunk/docutils/docutils/statemachine.py Log: Added trailing whitespace stripping to ``string2lines()`` Modified: trunk/docutils/docutils/statemachine.py =================================================================== --- trunk/docutils/docutils/statemachine.py 2005-12-05 23:25:24 UTC (rev 4145) +++ trunk/docutils/docutils/statemachine.py 2005-12-06 01:05:17 UTC (rev 4146) @@ -1433,7 +1433,8 @@ def string2lines(astring, tab_width=8, convert_whitespace=0, whitespace=re.compile('[\v\f]')): """ - Return a list of one-line strings with tabs expanded and no newlines. + Return a list of one-line strings with tabs expanded, no newlines, and + trailing whitespace stripped. Each tab is expanded with between 1 and `tab_width` spaces, so that the next character's index becomes a multiple of `tab_width` (8 by default). @@ -1446,7 +1447,7 @@ """ if convert_whitespace: astring = whitespace.sub(' ', astring) - return [s.expandtabs(tab_width) for s in astring.splitlines()] + return [s.expandtabs(tab_width).rstrip() for s in astring.splitlines()] def _exception_data(): """ |