Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Conversation

@svrhovac
Copy link

Fixing an issue #36
The code fix addresses that search terms are highlighted by tag and class.
If search string contains several segments, each segment is enclosed with element to highlight it.
Issue is that if search segment matches any part of highlighting tag, it will be enclosed with highlight tag again.
for example:
Search string is "De las"
The highlighting would work like:
Pass 1: Match "De" in "De las" and replace. The result is "De las"
Pass 2: Match "les" in "<span class='simplesearch-highlight'>De
las" and replace. The result is:
<span c<span class='simplesearch-highlight'>las</span>s='simplesearch-highlight'>De</span> las

The fix is to highlight each segment of search string separately and then concatenate all segments back to string.

…in strings matching any part of ''<span class="simplesearch-highlight">...</span>'.
@bezumkin bezumkin changed the base branch from master to modx-3.x February 16, 2023 09:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant