[REBOL] Antwort: Re: Antwort: Switch!
From: sharriff:aina:med-iq at: 20-Nov-2000 9:22
Thanks Andrew
I īll take a look at the Wiki in a short while. Excuse me for being slow,
but I donīt understand why I have to pass a file as an argument, and I dont
know how to cater for the case of multiple links? Iīve coded something like
this to break out of this problem
--------------------------------------------------
these lines at the beginning
; ----------- containers for the final sub HTML files
a: copy sub-toc-html-template
;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" />
}title {</a>}]
append a newline
append a sub-list]
and so on till #"z"
then these lines follow:
; ----------- code lines that creates the individual sub-TOC pages
append a sub-toc-html-stub
write %aa.html a
and so on for every letter
Iīve done it this way so that I can iterate for every occurence of a title
with with the same character. This is appended to a block (a: [] for
example) containing the the top of the template, the links are added to the
middle and the end of the template is appended and the file is then
written.
step 1: sub-toc-html-template
step 2: add all found tiltes and links
step 3: append sub-toc-html-stub
step 4: write to disk
could you show me how to implement your function to piece together the
links and HTML template together?
Much thanks
Sharriff Aina
"Andrew
Martin" An: <[rebol-list--rebol--com]>
<[Al--Bri--xtra]. Kopie:
co.nz> Thema: [REBOL] Re: Antwort: Switch!
Gesendet von:
rebol-bounce@
rebol.com
20.11.00
22:02
Bitte
antworten an
rebol-list
This should be a function:
> ; temp-html: copy sub-toc-html-template
> append sub-list rejoin [{<a href="} file {" target
> ="touchscreencontent"><img src="./images/round-button.jpg" border="0" />
> }title {</a>}]
> append temp-html newline
> append temp-html sub-list
> append temp-html sub-toc-html-stub
> write/append %aa.html temp-html]
Repeat 26 times after me, "Write everything once and only once".
Letter: function [Text [string!] File [file!]] [Page][
Page: copy sub-toc-html-template
; your code here...
]
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/