I couldn't find a way to remove all of the html tags without gathering them together.
html_tags = 'html head body base link meta object script style title p h1 h2 h3 h4 h5 h6 dl dt dd ol ul li address blockquote del div hr ins noscript pre script a abbr acronym dfn em strong code samp kbd var b i big small tt span br bdo cite del ins q sub sup area img map param form button fieldset input label legend option optgroup select textarea table tr th td colgroup col caption thead tbody tfoot frameset frame noframe iframe basefont isindex dir menu center strike u font applet'
html5_tags = 'article aside audio bb canvas command datagrid datalist details dialog embed eventsource figure footer header mark meter nav output progree ruby rp rt section source time video'
past_and_present_tags = '%s %s' % (html_tags, html5_tags)
from django.template.defaultfilters import removetags
def remove_all_tags(html_string):
return removetags(html_string, past_and_present_tags)
Surely there is some more elegant way to do this?