Problem/Motivation
There doesn't seem to be anything to prevent duplicate processing of a glossary term. This creates weird markup as glossify passes over the term twice, and embeds another glossary
Steps to reproduce
This came up for us when we had an embedded entity using entity_embed that had a rich text field with a glossary term in it. Glossify parsed it when rendering that rich text and added the tooltip. Then, when the rich text field that embedded the entity was processed, it found the glossary term again and processed it again.
Proposed resolution
When finding text to check against glossary terms, the base text filter has this code:
$text_nodes = $xpath->query('//text()[not(ancestor::a) and not(ancestor::span[@class="glossify-exclude"])]');
How about we add the glossify-exclude class to the default template for the tooltip, and then change the selector slightly to this:
$text_nodes = $xpath->query('//text()[not(ancestor::a) and not(ancestor::span[contains(@class, "glossify-exclude")])]');
This change uses a "contains" instead of exact match for class name. This allows flexibility in themers that override the tooltip template to add additional classes to a wrapping span.
Remaining tasks
User interface changes
API changes
Data model changes