1 2 3 4 5 6 7 8 | import re, string
def linebreaksli(value):
"Converts strings with newlines into <li></li>s"
value = re.sub(r'\r\n|\r|\n', '\n', value) # normalize newlines
lines = re.split('\n', value)
lines = ['<li>%s</li>' % line for line in lines]
return '\n'.join(lines)
|
More like this
- make an unordered html list by techiegurl 5 years ago
- Convert newlines into <p> and </p> tags by jheasly 6 years, 1 month ago
- Auto HTML Linebreak filter by punteney 5 years, 1 month ago
- filter for extracting a number of paragraphs from any HTML code by rafadev 1 year, 11 months ago
- Template filter that divides a list into exact columns by davmuz 1 year, 4 months ago
Comments