Problem/Motivation
There should be the ability to stop the automatic linking of Glossary Items so that user can fix instances where the system gets it wrong.
In some scenarios, the automatic linking of Glossary Items may not work properly. For example, if a sentence begins with a word that matches a term but is not being used in the way that Glossary Item would typically be used.
... All buildings, structures, Improvements, and alterations, including the multifamily housing dwellings, now constructed or hereafter constructed or placed on the land upon which the Property is located, together with all fixtures. Improvements in the guide ...
The second "Improvements" here is incorrectly linked to the Glossary Item "Improvements". There needs to be a way to stop this.
Requests
- A user can prevent individual instances of Glossary Item linking from occurring.
- A user can accomplish this from the specific entity they are editing.
- A user can easily undo this exclusion.
Proposed resolution
- Update the filter to allow span tags
- Add a new button to the available WYSIWYG buttons
- When a user highlights text and clicks this button it should wrap the text in a span tag with the class "glossify-exclude"
- Patch the Glossify module to exclude words/phrases wrapped with this markup
// Process HTML.
$text_nodes = $xpath->query('//text()[not(ancestor::a) and not(ancestor::span[@class="glossify-exclude"])]');
Example:
Before:
... All buildings, structures, Improvements, and alterations, including the multifamily housing dwellings, now constructed or hereafter constructed or placed on the land upon which the Property is located, together with all fixtures. Improvements in the guide ...
After:
... All buildings, structures, Improvements, and alterations, including the multifamily housing dwellings, now constructed or hereafter constructed or placed on the land upon which the Property is located, together with all fixtures. <span class="glossify-exclude">Improvements</span> in the guide ...
Remaining tasks
Provide a CKEditor plugin to wrap/remove the highlighted text in a span tag with the class "glossify-exclude". However, this can be achieved using CKEditor custom styles in Drupal.
Related Issues
https://www.drupal.org/project/glossify/issues/2857950
Easy fix. Will supply patch shortly.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | glossify-stop-the-automatic-linking-of-specific-glossary-items-3021490-4.patch | 529 bytes | rajeevgole |
Comments
Comment #2
rajeevgoleComment #3
rajeevgoleComment #4
rajeevgoleHere is the patch.
Comment #5
rajeevgoleComment #6
rajeevgoleComment #8
keesje commentedLooks straightforward. Committed to dev, thanks!
Comment #9
keesje commentedComment #11
outermedia-dku commentedNice feature!
Is there a plan when this is going to be released?