URL pattern does not support custom ports

0 views
Skip to first unread message

FND

unread,
Aug 9, 2009, 4:04:01 AM8/9/09
to WikklyText
The pattern for detecting URLs does not support custom ports - so
something like http://localhost:8080 results in the following output:
<a ... href="http://localhost" ...>http://localhost</a>:8080
... while it should be:
<a ... href="http://localhost:8080" ...>http://localhost:8080</a>

It appears this might be easy to fix by extending the following line
from wikklytext.wiki.render:
if re.match(r"((http|https|file|ftp|gopher|mms|news|nntp|telnet)://[a-
zA-Z0-9~\$\-_\.\#\+\!%/]+)|(mailto:[a-zA-Z\._@]+)",
Something like the following perhaps (not extensively tested):
if re.match(r"((http|https|file|ftp|gopher|mms|news|nntp|telnet)://[a-
zA-Z0-9~\$\-_\.\#\+\!%/]+(:[0-9]+)?)|(mailto:[a-zA-Z\._@]+)",


-- F.

Frank McIngvale

unread,
Aug 9, 2009, 6:28:08 PM8/9/09
to wikkl...@googlegroups.com

You're right ... I've noticed this and keep meaning to fix it ... I think it needs to be fixed here and in wikklytext.lexer as well. I'll add that to 1.6 ... which I know I need to release RSN :-)

thanks,
Frank

 



-- F.


Reply all
Reply to author
Forward
0 new messages