diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-03-04 15:32:20 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-03-04 15:32:20 -0300 |
commit | 13062a447a038fbe5c7cd8ea20887d96c1c37681 (patch) | |
tree | 5cc4bb40f212b70c8a0110756c77dc1b9dee37d9 /askbot/utils | |
parent | cec681f1b4551e3d8588cf2d22e4eae3a8c08b66 (diff) | |
download | askbot-13062a447a038fbe5c7cd8ea20887d96c1c37681.tar.gz askbot-13062a447a038fbe5c7cd8ea20887d96c1c37681.tar.bz2 askbot-13062a447a038fbe5c7cd8ea20887d96c1c37681.zip |
improved comment posting works for tinymce editor
Diffstat (limited to 'askbot/utils')
-rw-r--r-- | askbot/utils/html.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/askbot/utils/html.py b/askbot/utils/html.py index 1d76fdb7..549f22bf 100644 --- a/askbot/utils/html.py +++ b/askbot/utils/html.py @@ -94,7 +94,15 @@ def replace_links_with_text(html): link.replaceWith(format_url_replacement(url, text)) return unicode(soup.find('body').renderContents(), 'utf-8') - + +def strip_tags(html, tags=None): + """strips tags from given html output""" + assert(tags != None) + soup = BeautifulSoup(html) + for tag in tags: + tag_matches = soup.find_all(tag) + map(lambda v: v.replaceWith(''), tag_matches) + return unicode(soup.find('body').renderContents(), 'utf-8') def sanitize_html(html): """Sanitizes an HTML fragment.""" |