X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/154870f0416b6b387637d6035c96321410512e95..ddf2102eff7ea420a4ea5144c43409587fc1156e:/src/search/templatetags/search_tags.py diff --git a/src/search/templatetags/search_tags.py b/src/search/templatetags/search_tags.py index 05c504ce9..8d0b74be8 100644 --- a/src/search/templatetags/search_tags.py +++ b/src/search/templatetags/search_tags.py @@ -23,8 +23,8 @@ def book_searched(context, result): continue snip = result.snippets[idx] # fix some formattting - snip = re.sub(r"[ \t\n]*\n[ \t\n]*", u"\n", snip) - snip = re.sub(r"(^[ \t\n]+|[ \t\n]+$)", u"", snip) + snip = re.sub(r"[ \t\n]*\n[ \t\n]*", "\n", snip) + snip = re.sub(r"(^[ \t\n]+|[ \t\n]+$)", "", snip) snip = snip.replace("\n", "
").replace('---', '—') hit['snippet'] = snip