1 2 3 4 5 6 7 8 9 10 | import os
from django.template.defaultfilters import escape
@register.filter(name="tojavascript")
def tojavascript (value) :
if len(value.split(os.linesep)) > 1 :
__s = ["\"%s\"" % escape(i) for i in value.split(os.linesep)]
return "%s\n%s" % (__s[0], "\n".join([" + %s" % i for i in __s[1:]]), )
else :
return "\"%s\"" % escape(value)
|
More like this
- Q marshaller by Spike^ekipS 5 years, 3 months ago
- Simple views method binding by Spike^ekipS 5 years ago
- Dynamical formsets by I159 1 year, 7 months ago
- Safe template decorator by eternicode 1 year, 1 month ago
- Filter for adding quote marks by olau 5 years, 6 months ago
Comments
doesn't seem to work.
the code is also exceedingly unclear, perhaps you'd care to explain it a bit?
#