Surely the rule should be: break at all the places that seem reasonable, and try to fetch the content of each of those URLs, and linkify whichever one returns an HTTP 200 OK response code. --Michael On Mon, Feb 15, 2016 at 6:29 AM, Adam P. Goucher <apgoucher@gmx.com> wrote:
Surely the rule should be: break before a ')' if and only if the number of '('s hitherto encountered in the URL is equal to the number of ')'s. That results in correct parsing even when you have a URL in parentheses (such as https://en.wikipedia.org/wiki/42_(number)).
And don't you dare utter the words 'regular expression' as an argument against this approach...
Best wishes,
Adam P. Goucher
Sent: Monday, February 15, 2016 at 12:31 AM From: "Mike Stay" <metaweta@gmail.com> To: "Hilarie Orman" <ho@alum.mit.edu>, math-fun < math-fun@mailman.xmission.com> Subject: Re: [math-fun] Linkification of A=f(bh)
If you break at parens, it will fail often for wikipedia links: https://en.wikipedia.org/wiki/42_(number)
On Sun, Feb 14, 2016 at 4:15 PM, Hilarie Orman <ho@alum.mit.edu> wrote:
It is easier to understand the theorem than the url encoding.
Email readers, when presented with odd urls, can be stumped when trying to make them clickable. Using "reserved" characters (per rfc3986) in urls is asking for trouble. The equals sign and the parens are in the "reserved as delimiters" set, and it is standard procedure to "percent encode" them if they are supposed to be interpreted as ordinary characters.
In my personal email code, I assume that parens are not part of a url. It is likely that the sender failed to terminate the url with whitespace and instead started a parenthetical comment after the url. This happens with "." and "," and ";" all the time.
Hilarie
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- Mike Stay - metaweta@gmail.com http://www.cs.auckland.ac.nz/~mike http://reperiendi.wordpress.com
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- Forewarned is worth an octopus in the bush.