Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/templater.py @ 3636:bf3dec184c78
templater: remove cStringIO for fill
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 13 Nov 2006 13:26:57 -0600 |
parents | 231393b7316f |
children | 6a46c9ccc2ed |
comparison
equal
deleted
inserted
replaced
3635:231393b7316f | 3636:bf3dec184c78 |
---|---|
202 yield text[start:w], text[w:] | 202 yield text[start:w], text[w:] |
203 break | 203 break |
204 yield text[start:m.start(0)], m.group(1) | 204 yield text[start:m.start(0)], m.group(1) |
205 start = m.end(1) | 205 start = m.end(1) |
206 | 206 |
207 fp = cStringIO.StringIO() | 207 return "".join([space_re.sub(' ', textwrap.fill(para, width)) + rest |
208 for para, rest in findparas(): | 208 for para, rest in findparas()]) |
209 fp.write(space_re.sub(' ', textwrap.fill(para, width))) | |
210 fp.write(rest) | |
211 return fp.getvalue() | |
212 | 209 |
213 def firstline(text): | 210 def firstline(text): |
214 '''return the first line of text''' | 211 '''return the first line of text''' |
215 try: | 212 try: |
216 return text.splitlines(1)[0].rstrip('\r\n') | 213 return text.splitlines(1)[0].rstrip('\r\n') |