Skip to content

Commit 807bfe1

Browse files
authored
Merge pull request #1776 from UlrichB22/highlight
Highlight search results: treat each word separately and ignore case
2 parents e4e67a5 + 15cc52c commit 807bfe1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/moin/converters/highlight.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright: 2008 MoinMoin:BastianBlank
2+
# Copyright: 2024 MoinMoin:UlrichB
23
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
34

45
"""
@@ -52,7 +53,8 @@ def recurse(self, elem):
5253
elem[:] = new_childs
5354

5455
def __init__(self, regex):
55-
self.pattern = re.compile(regex)
56+
"""treat each word separately and ignore case sensitivity"""
57+
self.pattern = re.compile(regex.replace(" ", "|"), re.IGNORECASE)
5658

5759
def __call__(self, tree):
5860
self.recurse(tree)

0 commit comments

Comments
 (0)