From: David G. <go...@us...> - 2002-06-29 00:42:28
|
Update of /cvsroot/docutils/docutils/docutils In directory usw-pr-cvs1:/tmp/cvs-serv11251/docutils/docutils Modified Files: statemachine.py Log Message: - In ``string2lines()``, changed whitespace normalizing translation table to regexp; restores Python 2.0 compatibility with Unicode. Index: statemachine.py =================================================================== RCS file: /cvsroot/docutils/docutils/docutils/statemachine.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** statemachine.py 28 Jun 2002 04:17:58 -0000 1.5 --- statemachine.py 29 Jun 2002 00:42:25 -0000 1.6 *************** *** 1013,1019 **** ! _whitespace_conversion_table = string.maketrans('\v\f', ' ') ! ! def string2lines(astring, tab_width=8, convert_whitespace=0): """ Return a list of one-line strings with tabs expanded and no newlines. --- 1013,1018 ---- ! 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. *************** *** 1029,1035 **** """ if convert_whitespace: ! encoded = astring.encode('utf-8') ! converted = encoded.translate(_whitespace_conversion_table) ! astring = converted.decode('utf-8') return [s.expandtabs(tab_width) for s in astring.splitlines()] --- 1028,1032 ---- """ if convert_whitespace: ! astring = whitespace.sub(' ', astring) return [s.expandtabs(tab_width) for s in astring.splitlines()] |