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

[REBOL] Antwort: Switch!

From: sharriff:aina:med-iq at: 20-Nov-2000 7:52

I´m almost there Brett. Michael, Andrew although I´ve solved the problem using some extensive code, I wonder if there is a cleaner or shorter way to do this (see code below) ; creates subindexes from the first characters foreach [title file] titles [ switch first title [ #"a" [clear sub-list ; temp-html: copy sub-toc-html-template append sub-list rejoin [{<a href="} file {" target ="touchscreencontent"><img src="./images/round-button.jpg" border="0" /> &nbsp;&nbsp;&nbsp;&nbsp;}title {</a>}] append temp-html newline append temp-html sub-list append temp-html sub-toc-html-stub write/append %aa.html temp-html] #"b" [clear sub-list ; temp-html: copy sub-toc-html-template append sub-list rejoin [{<a href="} file {" target ="touchscreencontent"><img src="./images/round-button.jpg" border="0" /> &nbsp;&nbsp;&nbsp;&nbsp;}title {</a>}] append temp-html newline append temp-html sub-list append temp-html sub-toc-html-stub write/append %bb.html temp-html] and so on and so forth.....to character Z the links to the files and buttons are added correctly, but the tags of the HTML template are added also too, so the files (%aa.html, %bb.html e.t.c) end up having multiple <head>, <body> <title> e.tc. tags. How do code a method to execute only once in this situation? The way I´ve solved it atthe moment is to define alphabet blocks at the moment with the top of the HTML template in them and upon an occuring switch, the links get added to the respective alphabet blocks. The alphabet blocks are then written one by one to disk. I´m not sure if the script is economical with memory,( i´ve defined more than 20 blocks!) I would like than one of you should look it over, but it so large and I think it might be impolite to post it here. Thanks in advance Sharriff Aina