From: David G. <go...@us...> - 2002-10-02 03:20:04
|
Update of /cvsroot/docutils/docutils/docutils In directory usw-pr-cvs1:/tmp/cvs-serv7538/docutils/docutils Modified Files: statemachine.py Log Message: Added ``strip_top`` parameter to ``StateMachineWS.get_first_known_indented``. Index: statemachine.py =================================================================== RCS file: /cvsroot/docutils/docutils/docutils/statemachine.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- statemachine.py 24 Sep 2002 02:14:49 -0000 1.9 +++ statemachine.py 2 Oct 2002 03:20:00 -0000 1.10 @@ -814,7 +814,8 @@ offset += 1 return indented, offset, blank_finish - def get_first_known_indented(self, indent, until_blank=0, strip_indent=1): + def get_first_known_indented(self, indent, until_blank=0, strip_indent=1, + strip_top=1): """ Return an indented block and info. @@ -827,6 +828,7 @@ (1). - `strip_indent`: Strip `indent` characters of indentation if true (1, default). + - `strip_top`: Strip blank lines from the beginning of the block. :Return: - the indented block, @@ -840,9 +842,10 @@ self.input_lines[self.line_offset + 1:], until_blank, strip_indent) self.next_line(len(indented) - 1) # advance to last indented line - while indented and not indented[0].strip(): - indented.pop(0) - offset += 1 + if strip_top: + while indented and not indented[0].strip(): + indented.pop(0) + offset += 1 return indented, indent, offset, blank_finish |