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

[REBOL] Re: Newbie script: A Rebol web browser - help please

From: carl:cybercraft at: 10-Jan-2002 20:01

On 10-Jan-02, Scott Rebol wrote:
> In View goto: > > Currently I have a hardcoded home page and a location > box that allow you to put in a url with an external > document that is basically a view layout. > The external layout loads into a pane of a fixed with > browser window. > > > > Are my "web" documents. > Note: I currently only have hyperlinks working as > buttons.
Anton showed you how to have text hyperlinks, but note there's currently no easy way in View to have a hyperlink within plain text. (Just to stop you wasting a lot of time looking for something that's not there.) Some on the list here have been developing ways to do this though, if my memory serves me right.
> And when you use them it doesn't update the > loction bar.
That's easy to do... view layout [ f: field "Initial text" button "Change Text" [clear f/text append f/text "New text" show f] button "Append Text" [append f/text " more" show f] button "Clear Text" [clear f/text show f] ]
> But still there is a lot of fuctionality > for 1.19 KB of code. > Next step is building a script that converts HTML to > rebolview layout,
Why would you want to do this? I can think of lots of answers, but if it's to try and convert any webpage to a View layout then you have your work cut out for you. There is a simple Web-browser written in View though - see it on the FX5 Rebsite (via Sites in the View Desktop.) If it's to convert your own HTML though, then that's a different matter - you're in control of everything, which makes things easier. Using REBOL's parsing ability would be the way to go - see the Core Guide chapter on parsing. (Don't expect to learn it in five minutes though - you may be trying to run before you can walk here.) One possible approach for you would be to first use 'to-block on your webpage. This will create a block where the html tags have been converted into REBOL's tag datatype and the rest of the stuff in the page into various other datatype forms - some will be words, others string, and so on. (You may get an error with this though, as 'to-block can't handle everything you throw at it.) You could then use 'parse (and the rules you've created for 'parse to use) to convert the block into your layout. Not as easy as it sounds, but there'd be many hours of fun for you trying to get it to work. (:
> Does anyone have open code that does > this. Or if not does anyone have an example of a file > format converter I can study. > Also if people could post rebol layout files on > otherservers could they send me url. So I can test > that this works across webservers.
The way you've done it would work across the Net. As long as you use a full URL and the file's there, a REBOL script can grab it and use it. -- Carl Read