• Resolved davidnde

    (@davidnde)


    First of all thank you for your great work on this wonderful plugin!

    I got a little problem with the search term highlighting. In some cases the markup of the page gets destroyed. To reproduce visit http://www.owc.de/?s=dena and open the second result ChinaContact 05/2012 – dena-Special: Energieeffizienz in China. As you can see there are Span-Tags within the image’s attributes (src, title, …).

    <a href="http://www.owc.de/cms/wp-content/uploads/epaper/2012-05-cc-<span style='background-color: #ffff00'>dena</span>-special/index.html?keyword=<span style='background-color: #ffff00'>dena</span>&pn=0" .../>

    It seems like there is a simple search and replace on the entire post content.

    Is this a known issue? Are there any workarounds?

    Cheers!
    David

    http://wordpress.org/extend/plugins/relevanssi/

Viewing 6 replies - 1 through 6 (of 6 total)
  • owcv

    (@owcv)

    Maybe it happened with one of the updates? I hadn’t this bug before.

    Plugin Author Mikko Saari

    (@msaari)

    Which version are you running? The latest version modified the highlighting code a bit. However, it should not highlight inside HTML tags. It is not a simple search-and-replace, but a bit of regex.

    Looks like the regex doesn’t work as expected, though… It worked before, but looks like recent changes to prevent highlights in HTML entities and inside script and style tags have broken the basic functionality of not highlighting inside HTML tags.

    As the regex has become more complex than I can actually understand myself, looks like I have to change this somehow in the next version. If anybody can help me fix this regex, I’d be more than pleased:

    /(\b$pr_term|$pr_term\b)(?!([^[&|<]]+)?(;|>|<\/script>|<\/style>))/iu

    It should not match anything inside a HTML tag, inside a HTML entity (ie. between & and 😉 or inside script or style tags.

    owcv

    (@owcv)

    I use the latest version of Relevanssi (Version 3.1.5).

    Plugin Author Mikko Saari

    (@msaari)

    Ok, this is a bug in the latest version and will be fixed in the next version.

    Thread Starter davidnde

    (@davidnde)

    Thank you!

    Plugin Author Mikko Saari

    (@msaari)

    The new version (3.1.6) is out now, and should fix this.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Highlight search terms destroys markup’ is closed to new replies.