diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-04-20 19:08:12 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-04-20 19:08:12 -0300 |
commit | 17c6b1899c7134d323f2585def8efab8ca86e3e8 (patch) | |
tree | 435a45478a05ebf54b0094f085b074adf2007981 | |
parent | f177e505a9c1d6ceb984f52d256ec6c653aab7f5 (diff) | |
download | askbot-17c6b1899c7134d323f2585def8efab8ca86e3e8.tar.gz askbot-17c6b1899c7134d323f2585def8efab8ca86e3e8.tar.bz2 askbot-17c6b1899c7134d323f2585def8efab8ca86e3e8.zip |
modified the generate_post_snippets to re-parse full html of posts as well
-rw-r--r-- | askbot/management/commands/generate_post_snippets.py | 1 | ||||
-rw-r--r-- | askbot/utils/html.py | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/askbot/management/commands/generate_post_snippets.py b/askbot/management/commands/generate_post_snippets.py index 688450bf..b058862b 100644 --- a/askbot/management/commands/generate_post_snippets.py +++ b/askbot/management/commands/generate_post_snippets.py @@ -13,6 +13,7 @@ class Command(NoArgsCommand): for post in ProgressBar(posts.iterator(), count, message): if hasattr(post, 'summary'): post.summary = post.get_snippet() + post.html = post.parse_post_text()['html'] post.save() transaction.commit() transaction.commit() diff --git a/askbot/utils/html.py b/askbot/utils/html.py index a9b489f4..3aa793f4 100644 --- a/askbot/utils/html.py +++ b/askbot/utils/html.py @@ -75,7 +75,7 @@ def format_url_replacement(url, text): return '%s (%s)' % (url, text) return url or text or '' -def urlize_html(html): +def urlize_html(html, trim_url_limit=40): """will urlize html, while ignoring link patterns inside anchors, <pre> and <code> tags """ @@ -89,7 +89,7 @@ def urlize_html(html): #bs4 is weird, so we work around to replace nodes #maybe there is a better way though - urlized_text = urlize(node, trim_url_limit=40) + urlized_text = urlize(node, trim_url_limit=trim_url_limit) if unicode(node) == urlized_text: continue |