Created
April 24, 2009 20:37
-
-
Save neilmock/101335 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def linebreaksul(value): | |
""" | |
Converts a series of newlines into list items enclosed in an unordered list. | |
""" | |
unordered_list = "<ul>" | |
# split value into individual elements separated by newline | |
list_items = value.split('\n') | |
for li in list_items: | |
unordered_list += "<li>%s</li>" % li | |
unordered_list += "</ul>" | |
return mark_safe(unordered_list) | |
register.filter(linebreaksul) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment