On Tue, 28 Mar 2000, Jochen F. Rick wrote:

> > Is this the correct place to talk about Comanche and Four Strong Winds (Swiki)?
> 
> Yup. Thanks. I've included it for the next version.

It's incorrect to require the double slashes. This doesn't allow links to
the same server, or to news groups, etc. I attached a version that covers
all protocols mentioned in RFC1630, and guesses new URL schemes (like
https), too.

  -Bert-
'From Squeak2.7 of 5 January 2000 [latest update: #1762] on 29 March 2000 at 10:00:57 
am'!

!NuSwikiPage class methodsFor: 'testing' stamp: 'bf 3/29/2000 09:58'!
isTextAnHttp: text
   "Answer true if text is an URL that should become a verbatim 
href"
     | scheme |
     (text includes: $:) ifFalse: [^false].
 scheme _ text 
copyUpTo: $:.
    "Treat schemes defined in RFC1630 case-insensitive"
    (#('http' 
'ftp' 'gopher' 'mailto' 'mailto' 'news'
              'telnet' 'rlogin' 'tn3270' 
'wais' 'file') includes: scheme asLowercase)
                        ifTrue: [^true].
 
      "Unknown scheme. Check if it looks like a scheme (we require lower case so this 
should not conflict with page titles)"
 scheme first isLetter ifFalse: [^false].
      
 ^'abcdefghijklmnopqrstuvwxyz-0123456789' includesAllOf: scheme! !

Reply via email to