On Jan 11, 11:27 am, Brian Neal <[email protected]> wrote:
> I wrote a filter that searches for patterns in text and replaces them
> with <img> tags:
>
> {{ comment.text|smilify }}
>
> It does various silly things like replace :-) with an actual smiley
> face image. Seems to work great.
>
> When I combine it with the markdown filter, like this:
>
> {{ comment.text|markdown:"safe"|smilify }}
>
> It seems to escape the HTML that the markdown filter produces. In
> other words if my comment text is ":-)" then the output I get (when
> viewing the raw HTML source of the document) is &lt;p&gt;<img
> src="..." ... />&lt;/p&gt;
>
> Is it not possible to use the markdown filter like this? Or is the
> markdown filter supposed to mark its output as safe and my filter is
> incorrectly escaping it?
>
> The source for my filter is here:
>
> http://dpaste.com/107803/
>
> Thanks!

Okay I think I figured it out. I studied the existing filters a bit.
You can test the input value to your filter function with "isinstance
(value, SafeData)". If so, you don't need to escape it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to