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

[REBOL] why this not work? Re:

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" ]