Re: Help with Filters
hey thanks for the website...it helped in solving the problem was with marking the content safe as HTML tags were getting inserted.. the working code is as below: *CODE*: def wikify(value, autoescape=None): result=wikilink.sub(r"\1", value) return mark_safe(result) wikify.needs_autoescape = True On Sun, May 2, 2010 at 5:48 PM, rebus_wrote: > On 3 May 2010 00:46, rebus_ wrote: > > On 3 May 2010 00:34, Magal, Ganesh wrote: > >> I have created a filter which wikifies (i.e. input text of the form > >> HelloWorld to an output with rendered font like say - HelloWorld ). The > >> problem is that when I apply the filter, it is not getting rendered. > Below > >> is the code for the filter and the output text in HTML > >> > >> CODE: > >> from django import template > >> import re > >> wikilink=re.compile("\\b([A-z][a-z]+[A-Z][a-z]+)\\b") > >> register= template.Library() > >> @register.filter > >> def wikify(value): > >> return wikilink.sub(r"\1", value) > >> > >> > >> OUTPUT: > >> HelloWorld > >> > >> Without any style. Can you please help in finding where I am making a > >> mistake. > >> > >> Thanks > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Django users" group. > >> To post to this group, send email to django-us...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> django-users+unsubscr...@googlegroups.com > . > >> For more options, visit this group at > >> http://groups.google.com/group/django-users?hl=en. > >> > > > > {% wikify|safe %} ? > > > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe > > > > Or more accurately > > > http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#filters-and-auto-escaping > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Best Regards, GM ganeshma...@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with Filters
On 3 May 2010 00:46, rebus_wrote: > On 3 May 2010 00:34, Magal, Ganesh wrote: >> I have created a filter which wikifies (i.e. input text of the form >> HelloWorld to an output with rendered font like say - HelloWorld ). The >> problem is that when I apply the filter, it is not getting rendered. Below >> is the code for the filter and the output text in HTML >> >> CODE: >> from django import template >> import re >> wikilink=re.compile("\\b([A-z][a-z]+[A-Z][a-z]+)\\b") >> register= template.Library() >> @register.filter >> def wikify(value): >> return wikilink.sub(r"\1", value) >> >> >> OUTPUT: >> HelloWorld >> >> Without any style. Can you please help in finding where I am making a >> mistake. >> >> Thanks >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > {% wikify|safe %} ? > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe > Or more accurately http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#filters-and-auto-escaping -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with Filters
On 3 May 2010 00:34, Magal, Ganeshwrote: > I have created a filter which wikifies (i.e. input text of the form > HelloWorld to an output with rendered font like say - HelloWorld ). The > problem is that when I apply the filter, it is not getting rendered. Below > is the code for the filter and the output text in HTML > > CODE: > from django import template > import re > wikilink=re.compile("\\b([A-z][a-z]+[A-Z][a-z]+)\\b") > register= template.Library() > @register.filter > def wikify(value): > return wikilink.sub(r"\1", value) > > > OUTPUT: > HelloWorld > > Without any style. Can you please help in finding where I am making a > mistake. > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > {% wikify|safe %} ? http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Help with Filters
I have created a filter which wikifies (i.e. input text of the form *H*ello *W*orld to an output with rendered font like say - *HelloWorld* ). The problem is that when I apply the filter, it is not getting rendered. Below is the code for the filter and the output text in HTML *CODE:* from django import template import re wikilink=re.compile("\\b([A-z][a-z]+[A-Z][a-z]+)\\b") register= template.Library() @register.filter def wikify(value): return wikilink.sub(r"\1", value) *OUTPUT*: HelloWorld Without any style. Can you please help in finding where I am making a mistake. Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.