From d6c2be651d0cc889b1dbc5b73c7659a8a2ff7704 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Mon, 10 Sep 2012 15:03:18 +0200 Subject: [PATCH] snippet format fixs --- apps/search/templatetags/search_tags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/search/templatetags/search_tags.py b/apps/search/templatetags/search_tags.py index 555edd2fe..a167f024d 100644 --- a/apps/search/templatetags/search_tags.py +++ b/apps/search/templatetags/search_tags.py @@ -34,7 +34,7 @@ def book_searched(context, result): hits = filter(lambda (idx, h): result.snippets[idx] is not None or 'fragment' in h, enumerate(result.hits)) - print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits)) + # print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits)) for (idx, hit) in hits: # currently we generate one snipper per hit though. @@ -43,7 +43,7 @@ def book_searched(context, result): snip = result.snippets[idx] # fix some formattting snip = re.subn(r"(^[ \t\n]+|[ \t\n]+$)", u"", - re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", snip)) + re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", snip)[0])[0] snip = snip.replace("\n", "
").replace('---', '—') hit['snippet'] = snip -- 2.20.1