Closed (fixed)
Project:
Freelinking
Version:
master
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Aug 2005 at 16:37 UTC
Updated:
23 Oct 2005 at 12:00 UTC
Jump to comment: Most recent file
The freelinking filter seems to choke on embedded URLs that have CamelCase text. For example, if I try to create a link to the CamelCase Wikipedia article by entering the text below:
For more information on WikiWords and CamelCase refer to the Wikipedia article
It tries to filter the word CamelCase in the URL and screws up the link in the output.
How do I prevent this?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | freelinking.module.fixnestedhref_0.patch | 1.42 KB | moggy |
| #3 | freelinking.module.fixnestedhref.patch | 1.42 KB | moggy |
Comments
Comment #1
eafarris commentedThis is fixed (well, kinda) in HEAD: You can disable CamelCase linking. Still looking for the perfect way to leave URLs alone.
Comment #2
Roland Tanglao@bryght.com commentedisn't it just a "simple matter" :-) of disabling CamelCase detection and auto-generation of links within HTML code i.e. link tags?
Comment #3
moggy commentedOk, this patch should help
I opted for fixing the damage caused rather than trying to prevent it, so after all the wikiwords are linked in, it then removes nested instances of [code]
Seems to work, could someone check it out, and perhaps look at the regex? I'm not too hot with it :-s
side effect is that links are stored in the database, then removed, so appear to never have existed.
Comment #4
eafarris commentedThat patch doesn't appear to work in my testing.
Comment #5
moggy commentedooops. told you I wasn't that good with regex :D
try this one.
Comment #6
eafarris commentedCommitted an alternative fix to HEAD.
PHP.net's on-line documentation for the PCRE syntax has an example of matching inside and outside of HTML tags. With a slight modification, this seems to do the trick.
Please give this a good test and update the status here as necessary. Many thanks, moggy, for all your work on this issue.
Comment #7
moggy commentedvery neat.
It seems to work fine, but you do end up with it recognising wikiwords in urls, not replacing them but still storing them in the database. I fixed that by adding:
after $pattern = '/(?![^<]a.*?>)\b' . $wikiword . '\b/';
the patch I've just submitted for #26412 includes this.
Comment #8
moggy commentedI'm having problems with the following links, do they work properly for you?
Comment #9
eafarris commentedUmm. No. Very strange indeed. What's going on here?
Comment #10
moggy commentedCould the problem be this line with the arrays the wrong way round?
BTW: Found another link that's not right:
Comment #11
moggy commentedthink I've got it.
Pattern should be
$pattern = '/\b' . $wikiword . '\b(?![^<]*>)/';not
$pattern = '/(?![^<]a.*?>)\b' . $wikiword . '\b/';I think this is why
Comment #12
eafarris commentedYep, that works perfectly in my testing. Committed to HEAD and 4.6. Many thanks for the assistance and testing!
Comment #13
(not verified) commented