|
Revision 167, 408 bytes
(checked in by akaihola, 10 months ago)
|
|
[html] Oops, missing a colon.
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | |
|---|
| 3 | """HTML utilities suitable for global use.""" |
|---|
| 4 | |
|---|
| 5 | import re |
|---|
| 6 | |
|---|
| 7 | from django.utils.functional import allow_lazy |
|---|
| 8 | from django.utils.encoding import force_unicode |
|---|
| 9 | |
|---|
| 10 | def strip_empty_lines(value): |
|---|
| 11 | """Return the given HTML with empty and all-whitespace lines removed.""" |
|---|
| 12 | return re.sub(r'\n[ \t]*(?=\n)', '', force_unicode(value)) |
|---|
| 13 | strip_empty_lines = allow_lazy(strip_empty_lines, unicode) |
|---|