[REBOL] Re: looking for a function...
From: petr:krenzelok:trz:cz at: 7-Nov-2000 18:09
----- Original Message -----
From: Joel Neely <[joel--neely--fedex--com]>
To: <[rebol-list--rebol--com]>
Sent: Tuesday, November 07, 2000 4:59 PM
Subject: [REBOL] Re: looking for a function...
> Hi, Graham,
>
> [rebol-bounce--rebol--com] wrote:
> >
> > Has anyone got a function that strips out all the html from
> > a page leaving just the text behind?
> >
>
> Given the following:
>
> load-text-only: func [where [file! url!] /local text] [
> text: make string! 10000
> foreach item load/markup where [
> if string? item [
> append text item
> ]
> ]
> text
> ]
>
> and a %test.html file containing:
>
> <html>
> <head>
> <title>Test Page</title>
> </head>
> <body>
> <h1>Test Page</h1>
> <p>Here is a paragraph.</p>
> <p>Here is another one</p>
> <blockquote>Common sense is seldom both.</blockquote>
> </body>
> </html>
>
> you can say:
>
> >> load-text-only %test.html
> == {
>
> Test Page
>
> Test Page
> Here is a paragraph.
> Here is another one
> Common sense is seldom both.
>
> }
>
> Dealing with the surplus whitespace is "left as an exercise for
> the reader" ;-)
I will better show you way cooler aproach ;-))
text: copy ""
parse load/markup http://Www.rebol.com [some [tag! | set str string! (insert
tail text join trim/lines str either empty? str [""][newline])]]
-pekr- 'da rebolman ;-)