#10126: Add sanitize and tidy options to textile filter.
--------------------------+-------------------------------------------------
 Reporter:  anonymous     |       Owner:  nobody    
   Status:  new           |   Milestone:  post-1.0  
Component:  Contrib apps  |     Version:  1.0       
 Keywords:  textile       |       Stage:  Unreviewed
Has_patch:  1             |  
--------------------------+-------------------------------------------------
 The current textile filter is really basic, you can't set any options,
 like validating the HTML, or sanitizing the HTML.

 I made a simple workaround for this problem:
 django/contrib/markup/templatetags/markup.py
 {{{
 def textile(value, arg=''):
     try:
         import textile
     except ImportError:
         if settings.DEBUG:
             raise template.TemplateSyntaxError, "Error in {% textile %}
 filter: The Python textile library isn't installed."
         return force_unicode(value)
     else:
         args = arg.split(',')

         sanitize = 'sanitize' in args
         tidy = 'tidy' in args

         return mark_safe(force_unicode(textile.textile(smart_str(value),
 sanitize=sanitize, validate=tidy, encoding='utf-8', output='utf-8')))
 textile.is_safe = True
 }}}

 Now you can add a comma seperated list of args to the textile filter, to
 validate the output, or sanitizing it.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10126>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to