Closed (fixed)
Project:
Hashtags
Version:
6.x-2.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
8 Aug 2012 at 02:08 UTC
Updated:
8 May 2013 at 12:30 UTC
Currently, this module converts any word prefixed by an hash (#) to a link and add it as a tag.
This behaviour creates problems when you use links internal to the current page, since HTML uses # to identify anchors. Actually, we want to ignore words prefixed by hashes when they appear inside HTML tags.
For instance, if you have something like:
<a id="reference"></a>Foo bar
[CUT]
<a href="#reference">A link to go back to foo bar</a>
The hashtag module breaks last < a > tag and gives you something like:
<a href="<a href="/web/tag/reference" class="hashtag">#reference</a>">A link to go back to foo bar</a>
This shouldn't happen. The module should ignore hashes inside HTML tags.
Comments
Comment #1
Raul Cano commentedI subscribe to this. Isn't there any solution to that?
Unfortunately, it renders the module completely unuseful!
Comment #2
Leopold-2 commentedFully agree, prevents us from using it, which is a pity - how comes that this issue is still unassigned?
Comment #3
Raul Cano commentedI did some modifications to the module and now the issue here stated is partially solved:
The HTML tags are not consider anymore, so the body is not broken BUT some contents were having problems at being published. That is to say, they are displayed as empty contents when viewing them and if you try to edit them, then you see part of the content. Strange...
hashtags.module
Comment #4
letapjar commentedRe #3 you may want to use
preg_match_all($pattern, strip_tags(html_entity_decode($text,ENT_QUOTES)), $tags_list);instead.
I found that anytime I had body text with apostrophes the ' would get flagged as a hashtag. Very annoying.
Comment #5
Raul Cano commentedThank you very much! Works like charm. This is now the function in
hashtags.module
Comment #6
Leopold-2 commentedthanks a lot! works perfectly fine now
Comment #7
Raul Cano commentedAnother correction. I found with the previous code that the extraction of the hashtags was not done alright: the character immediately before the # sign was also retrieved, which was ok if the previous was a space, but not so ok if it was a colon or whatever else. I have the suspicion that this was also producing some duplicity of terms but I could not track the exact reason.
Here I add a correction that avoids both:
Comment #8
radamiel commentedsorry for late response - fixed in 6.x-1.0
Comment #9.0
(not verified) commentedcorrected a typo