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.

Comments

rajeevgole created an issue. See original summary.

rajeevgole’s picture

Status: Active » Needs work
rajeevgole’s picture

Issue summary: View changes
rajeevgole’s picture

Assigned: rajeevgole » Unassigned
Status: Needs work » Needs review
StatusFileSize
new529 bytes

Here is the patch.

rajeevgole’s picture

Title: Content editors can set individual occurrences of Glossary Items in the Guide to not appear as Glossary Items » Stop the automatic linking of Glossary Items so that user can fix instances where the system gets it wrong
rajeevgole’s picture

Issue summary: View changes

  • keesje committed 8a2e640 on 8.x-1.x
    Issue #3021490 by rajeevgole: Stop the automatic linking of Glossary...
keesje’s picture

Looks straightforward. Committed to dev, thanks!

keesje’s picture

Assigned: Unassigned » keesje
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

outermedia-dku’s picture

Nice feature!

Is there a plan when this is going to be released?