samizdat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automatic URLs for plain text format?


From: boud
Subject: Re: automatic URLs for plain text format?
Date: Mon, 4 Dec 2006 23:33:19 +0100 (CET)

hi

On Mon, 4 Dec 2006, Dmitry Borodaenko wrote:

On 12/4/06, Dmitry Borodaenko <address@hidden> wrote:
It is a bug in Samizdat::Sanitize. This fragment of xhtml.yaml is to blame:

&uri !ruby/regexp /\A(http:|https:|ftp:|mailto:)?[^:]+\z/i

This regexp seems to do the trick:

/\A((http|https|ftp|mailto):[^"\s]+|[^:\s]+)\z/i

Tests out OK to me.

Somewhere, i guess uri/https?.rb, there's something clever that removes redundant port numbers, i.e.

http://a.b:80/fix
http://a.b:81/fix
https://a.b:80/fix
https://a.b:443/fix

give link text which looks identical to this, but the underlying links
are:

http://a.b/fix     # :80 removed
http://a.b:81/fix
https://a.b:80/fix
https://a.b/fix     # :443 removed

The user doesn't notice anything has been changed until s/he clicks
on the link and gets to the linked page. And then since the link seems
to work, s/he will probably realise that it's in some sense equivalent
and will stop writing the 80 or 443 port. Or doesn't notice anything
at all, just that the URL is simpler than s/he thought before. Neat!
Definitely the sort of elegant touch i expect in samizdat. :)


cheers
boud




reply via email to

[Prev in Thread] Current Thread [Next in Thread]