Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: make-doc-pro: Version 1.0.3 beta update

From: nitsch-lists:netcologne at: 10-Jun-2002 14:22

Hi Robert, Sunanda, Am Montag, 10. Juni 2002 11:11 schrieb [SunandaDH--aol--com]:
> Here's a copy of my email that doesn't seem to have arrived after three > days. Apologies if you got it while me and the archive didn't. > > I'm backing up Robert in his recent comment that: "Adding minimal > user-friendly syntax can help a lot" > Sunanda > > <<===>> > > Volker: > > instead of =url > > iam thinking about > > here you get all the nice stuff: http://rebol.com > > what do you think? > > Part of the problem with all these "pick the url from the data stream" > suggestions is that it is not trivial to do. All of the following _could_ > be URLs: > > http://www.rebol.com > www.rebol.com > ftp://rebol.com/a-script.r > /a-folder/a-subfolder/a-document.txt > /a-folder/a-doc.htm#a-fragment > /x > > And, for any of them in a document, they may be meant to be quoted or meant > to be a clickable link. > > Basically the only 100% accurate rule is: "it's a clickable URL if I mark > it up as such". > > Robert's =url may not be perfect as it requires the URL to be on a line by > itself, and it needs embedded spaces to be coded as , but it does the > job. >
===a little parser-part url-line: func [line /local text-end text url-start url rest] [ either parse line [ some [to ": " text-end: skip] url-start: ( text: copy/part line text-end either all [ not error? try [set [val rest] load/next url-start] find reduce [url! file!] type? val ] [ url: val ] [ rest: head line ] ) :rest ] [ rejoin [""build-tag compose [a href (url)] text </a>] ] [ line ] ] ;--samples foreach line reduce [ "some text pointing to: http://somewhere.dom garbage" "no url at all" "no real url: nowhere" "nothing behind: " "multiple colons: this and: that" "multiple colons: this and: that and url: http://somewhere.dom" "some text pointing to: http://somewhere.dom" {some text pointing to: %"http://somewhere/ with space.dom"} {a file-link demo: %index.html} ] [ print[">>" line newline "==" url-line line ] ] ;--no real urls inside
>> some text pointing to: http://somewhere.dom garbage
== some text pointing to: http://somewhere.dom garbage
>> no url at all
== no url at all
>> no real url: nowhere
== no real url: nowhere
>> nothing behind:
== nothing behind:
>> multiple colons: this and: that
== multiple colons: this and: that ;--with urls
>> multiple colons: this and: that and url: http://somewhere.dom
== <a href="http://somewhere.dom">multiple colons: this and: that and url</a>
>> some text pointing to: http://somewhere.dom
== <a href="http://somewhere.dom">some text pointing to</a>
>> some text pointing to: %"http://somewhere/ with space.dom"
== <a href="http://somewhere/ with space.dom">some text pointing to</a>
>> a file-link demo: %index.html
== <a href="index.html">a file-link demo</a>
> Sunanda.
grretings Volker