Replacement applies to URLs and breaks links

Created on 1 August 2023, over 1 year ago
Updated 11 January 2024, 12 months ago

Problem/Motivation

I tried using this module but it broke links and text rendering when the glossary term appeared in link URLs. I presume there would be similar issues with any html attributes or values within tags.

Steps to reproduce

Paste <a href="https://www.google.com/search?q=romeo+and+juliet">Romeo and Juliet (test)</a> into the source of a body field of a new page (assuming that the body field does not have 'taxonomy glossary' enabled yet)

Add "and" as a glossary term.

Save, and view the page, the result should be this:
Romeo and Juliet (test)

Enable taxonomy glossary on the body field of the relevant content type. And view the page again.

This time you will see this:
and+juliet">Romeo and Juliet (test).

The module has broken the link, and everthing after the 'and' in the URL is now plain text.

Proposed resolution

Do not apply the replacements within html tags.
Maybe do not apply the replacements within link text, as this clashes with what should happen when you click a link.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇬🇧United Kingdom jacobupal Leeds

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024