diff options
author | Adam Tauber <asciimoo@gmail.com> | 2014-05-09 02:04:20 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2014-05-09 02:04:20 +0200 |
commit | 5d9d04a16e0becad65b55351503b8a015551847b (patch) | |
tree | 316e4b586ba34f3d344b92397d73f5643ef0e486 /searx/utils.py | |
parent | 58de2801ce83c0ec7d6f52405254c776c4b68fb3 (diff) | |
download | searxng-5d9d04a16e0becad65b55351503b8a015551847b.tar.gz searxng-5d9d04a16e0becad65b55351503b8a015551847b.zip |
[enh] better highlighting
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/utils.py b/searx/utils.py index 1e48e37ee..e881a8b14 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -28,7 +28,7 @@ def highlight_content(content, query): query = query.decode('utf-8') if content.lower().find(query.lower()) > -1: query_regex = u'({0})'.format(re.escape(query)) - content = re.sub(query_regex, '<b>\\1</b>', content, flags=re.I | re.U) + content = re.sub(query_regex, '<span class="highlight">\\1</span>', content, flags=re.I | re.U) else: regex_parts = [] for chunk in query.split(): @@ -37,7 +37,7 @@ def highlight_content(content, query): else: regex_parts.append(u'{0}'.format(re.escape(chunk))) query_regex = u'({0})'.format('|'.join(regex_parts)) - content = re.sub(query_regex, '<b>\\1</b>', content, flags=re.I | re.U) + content = re.sub(query_regex, '<span class="highlight">\\1</span>', content, flags=re.I | re.U) return content |