Show More
@@ -256,16 +256,17 b' def shortdate(date):' | |||
|
256 | 256 | |
|
257 | 257 | def indent(text, prefix): |
|
258 | 258 | '''indent each non-empty line of text after first with prefix.''' |
|
259 | fp = cStringIO.StringIO() | |
|
260 | 259 | lines = text.splitlines() |
|
261 | 260 | num_lines = len(lines) |
|
261 | def indenter(): | |
|
262 | 262 | for i in xrange(num_lines): |
|
263 | 263 | l = lines[i] |
|
264 |
if i and l.strip(): |
|
|
265 | fp.write(l) | |
|
264 | if i and l.strip(): | |
|
265 | yield prefix | |
|
266 | yield l | |
|
266 | 267 | if i < num_lines - 1 or text.endswith('\n'): |
|
267 |
|
|
|
268 |
return |
|
|
268 | yield '\n' | |
|
269 | return "".join(indenter()) | |
|
269 | 270 | |
|
270 | 271 | common_filters = { |
|
271 | 272 | "addbreaks": nl2br, |
General Comments 0
You need to be logged in to leave comments.
Login now