Attention, hyperlinkers: inference of active text
jepler at unpythonic.net
Sat Jun 19 15:30:27 CEST 2004
I'm pretty sure that this isn't a valid url:
file:\I never\used anything\besides windows.txt
It's something, but it's not a URL.
For actual HTTP URLs, I would suggest that you have a step in the
highlighting that considers whether the last part of the URL seems to
contain plausible characters. Letters from this set are pretty
For these file: faux-URLs, you could again start by parsing the maximum
number of characters as the URL, then repeatedly check whether the
current fragment exists on disk. If it doesn't, chop off part of it
(probably at whitespace) and try again until you get something that
exists or your string is empty.
If that doesn't work (for instance, you're not in a position to check
what exists on the user's disk) then you could try a rule where the
hyperlink portion extends from file: at least to the last \, and if the
part beyond that is of the form "word word word.ext" then it's included
Best of luck. This'll probably require a lot of experimentation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
More information about the Python-list