mIRC Home    About    Download    Register    News    Help

Print Thread
#200086 27/05/08 11:09 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
mIRC's current URL-hotlinking feature is overzealous in how it ignores trailing parentheses. Consider the text http://en.wikipedia.org/wiki/A_(disambiguation) - mIRC will interpret this as the link http://en.wikipedia.org/wiki/A_(disambiguation (notice the missing parenthesis on the end).

I know this has been posted before but purely by chance this bug has bitten me three times in the last week and it's been a year since the last time it was posted, so maybe it's time for a refresher.

The linked post also includes a good summation of the possible URLs and the desired link for each compared to the current method.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
I don't think there's a practical solution to this since the context is a user message which can contain an unequal number of brackets and the url itself could contain an unequal number of brackets.

We could assume that all user messages and urls contain an equal number of opening and closing brackets - this would however break in any message that doesn't fit this assumption.

I'll see if I can tweak the behaviour a little bit.

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
how about assuming that N (>= 1) closing brackets at the end are only NOT part of the url if there are N more opening than closing brackets in the text BEFORE the url? to me it seems that this would cover most real-world cases..

text url
(text url)
text url)
(text) url)
text url()
(text url())
((text url()))
((text)) url()

red = not part of url, green = part of url

note that this is right-to-left and therefore does not require counting of the brackets within the url at all

Edit I guess that's what the guy in the other thread suggested as well

Last edited by Sat; 05/06/08 05:56 PM.

Saturn, QuakeNet staff
Joined: Jun 2008
Posts: 12
K
Pikka bird
Offline
Pikka bird
K
Joined: Jun 2008
Posts: 12

Khaled {
the url itself could contain an unequal number of brackets.
}

If killing they who do not equalize brackets in their urls is not an option, assuming they are in fact equalized must give the cleanest code. I could call the web developer of that one site with unequalized brackets and get him to rethink his thing for unequalized bracket.



Link Copied to Clipboard