why this not work?
[1/2] from: etcha::gsat::net::au at: 3-Feb-2000 0:54
This is a multi-part message in MIME format.
------=_NextPart_000_0060_01BF6DE1.2EC38D20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
i just cant keep figuring out when you use this with two different files and go say:
function <file here>
function <second file here>
function <file here>
btw: these are html files with one body having BGCOLOR="white" and one simply having
<BODY>
----- start of function -----
make_generic_html_locator: func [
a [file!] "Filename to add location reference for"
]
[
page_content: "sd"
clear page_content
if not exists? a [print reform ["File not found:" a] halt]
in_file: read a
in_file: make string! in_file
if not find in_file "<HTML>" [print "File is not HTML Compliant"
halt]
if find in_file "<TITLE>" [
parse in_file [thru {<TITLE>} copy page_title to {</TITLE>}]
print page_title
]
parse in_file [thru {<BODY} copy body_attrib to {>}]
body_tobe: rejoin [{<BODY} body_attrib {>}]
if find in_file "<BODY>" [body_tobe: {<BODY>}]
parse in_file [thru body_tobe copy page_content to {</HTML>}]
print body_tobe
print page_content
clear page_content
clear body_tobe
print "Generic Page Locator Finished"
]
------=_NextPart_000_0060_01BF6DE1.2EC38D20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3612.1706"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000000 size=2>i just cant keep figuring out when you use this
with two different files and go say:</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT> </DIV>
<DIV><FONT color=#000000 size=2>function <file here></FONT></DIV>
<DIV><FONT color=#000000 size=2>function <second file here></FONT></DIV>
<DIV><FONT color=#000000 size=2>
<DIV><FONT color=#000000 size=2>function <file here></FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT> </DIV>
<DIV><FONT color=#000000 size=2>btw: these are html files with one body having
BGCOLOR="white" and one simply having <BODY></FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT> </DIV>
<DIV>----- start of function -----</DIV>
<DIV> </DIV>
<DIV><FONT color=#000000 size=2>
<DIV>make_generic_html_locator: func [<BR> a [file!] "Filename to add
location reference for"<BR>
]<BR> [<BR> page_content: "sd"<BR> clear
page_content<BR> if not exists? a [print reform ["File not
found:" a] halt]<BR> in_file: read a<BR> in_file: make string!
in_file<BR> if not find in_file "<HTML>" [print "File
is not HTML Compliant"<BR> halt]</DIV>
<DIV> </DIV>
<DIV> if find in_file "<TITLE>" [<BR> parse in_file
[thru {<TITLE>} copy page_title to {</TITLE>}]<BR> print
page_title<BR> ]<BR> parse in_file [thru {<BODY}
copy body_attrib to {>}]<BR> body_tobe: rejoin [{<BODY} body_attrib
{>}]<BR> if find in_file "<BODY>" [body_tobe:
{<BODY>}]<BR> parse in_file [thru body_tobe copy page_content to
{</HTML>}]<BR> print body_tobe<BR> print
page_content<BR> clear page_content<BR> clear body_tobe<BR>
print "Generic Page Locator
Finished"<BR> ]<BR></DIV></FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0060_01BF6DE1.2EC38D20--
[2/2] from: bhandley::zip::com::au at: 3-Aug-2000 1:09
First, your message format.
Could you please sent your emails to this list in plain text? The HTML of
outlook will probably annoy all the plain text readers of the list.
To do this in Outlook Express you can either:
1) Send all your email in plain text by Tools -> Options -> Send tab and
select Mail Sending Format = Plain Text.
Or
2) For plain text only to this list. Add [list--rebol--com] as an address to
your address book. Select the properies of the this address and choose the
name tag. Check the "Send e-mail using plain text only" checkbox.
Thanks.
Secondly your program.
Your program is self-modifying (though you would not have intended that).
The problem line is
if find in_file "<BODY>" [body_tobe: {<BODY>}]
On this line the word body_tobe is referring to a string that is actually
part of your function definition. I know this sound strange but have a look
at this web page for a simpler explanation.
http://www.zipworld.com.au/~bhandley/rebol/rebol-techniques.html#Wordsarenot
variables1
Change the line to read like this
if find in_file "<BODY>" [body_tobe: copy {<BODY>}]
There are other lines which are affected by this. Use
source make_generic_html_locator
to see the other changes.
On a side note, the line
in_file: make string! in_file
is completely redundant since the result of the read is a string.
Hope it helps.
Brett.
----- Original Message -----
From: [etcha--gsat--net--au]
To: [list--rebol--com]
Sent: Wednesday, February 02, 2000 11:54 PM
Subject: [REBOL] why this not work?
i just cant keep figuring out when you use this with two different files and
go say:
function <file here>
function <second file here>
function <file here>
btw: these are html files with one body having BGCOLOR="white" and one
simply having <BODY>
----- start of function -----
make_generic_html_locator: func [
a [file!] "Filename to add location reference for"
]
[
page_content: "sd"
clear page_content
if not exists? a [print reform ["File not found:" a] halt]
in_file: read a
in_file: make string! in_file
if not find in_file "<HTML>" [print "File is not HTML Compliant"
halt]
if find in_file "<TITLE>" [
parse in_file [thru {<TITLE>} copy page_title to {</TITLE>}]
print page_title
]
parse in_file [thru {<BODY} copy body_attrib to {>}]
body_tobe: rejoin [{<BODY} body_attrib {>}]
if find in_file "<BODY>" [body_tobe: {<BODY>}]
parse in_file [thru body_tobe copy page_content to {</HTML>}]
print body_tobe
print page_content
clear page_content
clear body_tobe
print "Generic Page Locator Finished"
]