Skip to content

Commit

Permalink
Merge pull request #1776 from UlrichB22/highlight
Browse files Browse the repository at this point in the history
Highlight search results: treat each word separately and ignore case
  • Loading branch information
RogerHaase authored Oct 9, 2024
2 parents e4e67a5 + 15cc52c commit 807bfe1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/moin/converters/highlight.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright: 2008 MoinMoin:BastianBlank
# Copyright: 2024 MoinMoin:UlrichB
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
Expand Down Expand Up @@ -52,7 +53,8 @@ def recurse(self, elem):
elem[:] = new_childs

def __init__(self, regex):
self.pattern = re.compile(regex)
"""treat each word separately and ignore case sensitivity"""
self.pattern = re.compile(regex.replace(" ", "|"), re.IGNORECASE)

def __call__(self, tree):
self.recurse(tree)
Expand Down

0 comments on commit 807bfe1

Please sign in to comment.