mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed bug in 212b982
-- Removed duplicate code in removetags
This commit is contained in:
parent
afc1bd7ab8
commit
e4984812cd
@ -468,13 +468,8 @@ def safeseq(value):
|
||||
@stringfilter
|
||||
def removetags(value, tags):
|
||||
"""Removes a space separated list of [X]HTML tags from the output."""
|
||||
tags = [re.escape(tag) for tag in tags.split()]
|
||||
tags_re = '(%s)' % '|'.join(tags)
|
||||
starttag_re = re.compile(r'<%s(/?>|(\s+[^>]*>))' % tags_re, re.U)
|
||||
endtag_re = re.compile('</%s>' % tags_re)
|
||||
value = starttag_re.sub('', value)
|
||||
value = endtag_re.sub('', value)
|
||||
return value
|
||||
from django.utils.html import remove_tags
|
||||
return remove_tags(value, tags)
|
||||
|
||||
@register.filter(is_safe=True)
|
||||
@stringfilter
|
||||
|
Loading…
Reference in New Issue
Block a user