After upgrading to 5.x-2.6, I started noticing odd glossary links in my body text.

Upon further investigation, it appears that if you use a glossary term in the glossary description, the term (the one in the description) gets hyperlinked and causes all manor of havoc when it comes to hyperlinking the actual term in the body of a node.

The attached screen capture illustrates that the term TCP is used in the description and, as such, is linked in the description.

CommentFileSizeAuthor
#3 glossary-prob.jpg99.16 KBkmillecam

Comments

kmillecam’s picture

If the attachment doesn't show up, here's the text as copied from the glossary list page:
As rendered on glossary page:

TCP edit term | search for term

Transmission Control Protocol (Wikipedia.">TCP) is one of the core protocols of the Internet protocol suite. Using TCP, applications on networked hosts can create connections to one another, over which they can exchange data or packets. The protocol guarantees reliable and in-order delivery of sender to receiver data. TCP also distinguishes data for multiple, concurrent applications (e.g. Web server and email server) running on the same host. From Wikipedia.

+++++++++++++

Source of glossary page:

Transmission Control Protocol (Wikipedia.">TCP) is one of the core protocols of the Internet protocol suite. Using TCP, applications on networked hosts can create connections to one another, over which they can exchange data or packets. The protocol guarantees reliable and in-order delivery of sender to receiver data. TCP also distinguishes data for multiple, concurrent applications (e.g. Web server and email server) running on the same host. From Wikipedia.

nancydru’s picture

Assigned: Unassigned » nancydru
Status: Active » Postponed (maintainer needs more info)

My first suggestion is to go and re-save all your settings, especially the ones per filter, where the blocking tags are.

kmillecam’s picture

StatusFileSize
new99.16 KB

I re-saved all the settings, disabled, enabled, cleared cache and nothing helped.

Then I tried (and succeeded) to duplicate the problem on a fresh Drupal install (see attached).

In my example the term is: "TCP".

The description (which includes the term) is:

Transmission Control Protocol (TCP) is one of the core protocols of the Internet protocol suite. Using TCP, applications on networked hosts can create connections to one another, over which they can exchange data or packets. The protocol guarantees reliable and in-order delivery of sender to receiver data. TCP also distinguishes data for multiple, concurrent applications (e.g. Web server and email server) running on the same host. From Wikipedia.

nancydru’s picture

Let's see if we can narrow this down a bit. Is this only happening when the term contains a link? Is Wikipedia also a term in your glossary? In the settings for the input format, what does does the "Blocked elements" have in it? It looks like you're using superscript format, have you tried another (e.g. acronym)? Is this on a site that I can access and see the HTML output?

kmillecam’s picture

Good questions NancyDru.

1) It does appear to only happen when the description includes a link. (I moved the link from the end of the description to the middle to see if the behavior changed and it did not.)

2) It does not appear (as I first thought) to have anything to do with the Term being included in the description. I removed all references to the term (TCP) and the issue persisted.

3) Wikipedia is not a term in the glossary. The hyperlink to Wikipedia was added manually to cite the source of the description.

4) The blocked elements are just the default: abbr acronym.

5) I've tried the other formats and they all behave the same.

6) You can see an example on our live site here: http://juice.altiris.com/node/3711 (Search the page for "Wikipedia". It's showing up several times.)

Thanks for your help!
Kevin

nancydru’s picture

Well, let's try one real quick thing: Add "a" to the blocked elements list. It is supposed to be automatic, but let's try that while I'm doing more work on this.

nancydru’s picture

Hmm, I don't find "Wikipedia" on that page...

nancydru’s picture

Well, at least I can recreate this on both my 5.7 and 6.2 sites. That will make it a bit easier to fix.

kmillecam’s picture

Sorry Nancy,

I had someone on my team remove the Wikipedia links.

It was generating some snide user feedback ;)

nancydru’s picture

I finally figured out what's happening, but I'm having trouble figuring out what to do not mess up formatting and hurt performance. The problem is that the links (and potentially any tag) has double quotes in it. That breaks the double quotes that we use in the glossary links.

I like having links in the term descriptions, but I may have to disallow them except in hovertips.

nancydru’s picture

Title: Issue when glossary term is used in description » Glossary links wrong when description contains HTML

Let's make the title more descriptive of the real problem

nancydru’s picture

#308429: HTML tags in hoover text marked as duplicate of this issue.

zarooch’s picture

any updates on this? NancyDru would you like to share a little more information on what solution is in your mind? I'm also currently working on glossary module and would like to come up with a solution for this issue as soon as possible. Any help from you is much appreciated!

Regards,
zarooch.

nancydru’s picture

I'm sorry to admit that I haven't had time to work much on this lately - too many things going on. If you can come up with a patch, that would be great. When I was working on it, I was having trouble figuring anything out that would still allow HTML, yet not break. I would hate to have to use strip_tags() or filter_xss().

zarooch’s picture

ok, so I tried using strip_tags but I don't know for some reason it wasn't working on it. So I tried to make it work for 2 more hours but still it wasn't stripping the anchors. I made a separate php page, defined a string and strip_tags was working, so I don't know why it isn't working in the module. By the way you are already using filer_xss.

Then i turned my attention from looking into it from a developer point of view to a very basic user point of view and I looked at the configurations :), and yes I found a solution to it. Go to your input formats and make sure that URL filter runs BEFORE the glossary filter. That's it! It works perfectly fine. It doesn't breaks the formating and it shows the http links in the hover tips too :)

Make sure you also clear your cache. Sometimes the clear cache also doesn't works, so empty the filter_cache table.

When I installed this glossary module, I think it by default configured that it should run before the URL filter. So now I assigned a lighter weight to my URL filter just so that it runs before the Glossary filter and cleared the cache.

Well this works for me. If someone can verify, Nany may close this issue once and for all.

Regards,
zarooch.

kmillecam’s picture

@zarooch,

Thanks for the tip.

I can imagine it would be helpful if you're listing urls like http://www.example.com

But does it work if you're doing something like <a href="http://www.example.com">click here</a>.

nancydru’s picture

@zarooch: Yes, that change does seem to fix the 6.x problem, but not the 5.x problem.

nancydru’s picture

Version: 5.x-2.6 » 5.x-2.x-dev

What I have found so far: When the Glossary module is finished processing the text, it is correct. Somewhere after Glossary is finished, it is getting messed up (big time). I can make the problem go away by removing all anchor tags (<a ...>) from the term definitions, but I'm not happy about doing that.

nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

I'm not super happy with this, but it works. Your tool tips will now show any HTML, but at least they won't break.

Committed to both branches.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

ionuts71’s picture

Version: 5.x-2.x-dev » 6.x-1.6
Status: Closed (fixed) » Active

1. I tried to use <em> and <strong> tags without success... the hoovertip displays the text <em>Text</em> and/or <strong>Text</strong> instead of the italics Text and/or bold Text. (see attached images from http://drupal.org/node/308429). I also tried to use <a> tag but the same wrong behavior of the hoovertip. I also put URL filter to run before the glossary filter but without success.
2. If the Glossary definition starts with a " (quote) the hoovertip doesn't appear. Also, if a definition contain a " (quote) the hoovertip text ends to that starting quote sign (the text after " is not shown).
In the glossary term page the definitions looks OK. The hoovertip is the problem.
I use Drupal 6.6 and Glossary module 6.x-1.6.

nancydru’s picture

Status: Active » Closed (fixed)

Per #19: Your tool tips will now show any HTML