local (folder = "internal:apps:webstar:colorSampler:", f) |
local (ctcolors = sizeof (system.verbs.colors)) «140 |
local (forecolorsperpage = 7) «must divide 140 evenly |
local (backcolorsperpage = 10) «ditto |
local (htmltext = "", indent = 0) |
| s = string.filledstring ('\t', indent) + s + "\r" |
on oneTable (f, startforecolor, endforecolor, startbackcolor, endbackcolor, cellwidth=75, cellheight=40, nextlink="") |
| local (fname = file.filefrompath (f)) |
| add ("<title>" + fname + "</title>") |
| add ("</head>\r"); indent-- |
| add ("<body bgcolor=\"#FFFFFF\">"); indent++ |
| add ("<h4>" + fname + "</h4>") |
| add ("<blockquote>"); indent++ |
| add ("<table border=1 cellspacing=0 cellpadding=3>"); indent++ |
| bundle «add row of foreground color labels |
| for fc = startforecolor to endforecolor |
| add ("<td><center><code><i>" + nameof (system.verbs.colors [fc]) + "</i></code></center></td>") |
| for bc = startbackcolor to endbackcolor |
| local (namebackcolor = nameof (system.verbs.colors [bc])) |
| add ("<td valign=top><code><i>" + nameof (system.verbs.colors [bc]) + "</i></code></center></td>") |
| for fc = startforecolor to endforecolor |
| local (nameforecolor = nameof (system.verbs.colors [fc])) |
| add ("<td width=" + cellwidth + " height=" + cellheight + " bgcolor=\"" + namebackcolor + "\">"); indent++ |
| add ("<font color=\"" + nameforecolor + "\">"); indent++ |
| add ("<center>" + nameforecolor + "</center>") |
| add ("</font>"); indent-- |
| add ("</td>\r"); indent-- |
| add ("</table>"); indent-- |
| add ("</blockquote>"); indent-- |
| add ("<p><a href=\"" + nextlink + "\">Next</a>") |
| add ("<p><code>" + clock.now () + "</code>") |
| add ("</body>"); indent-- |
| add ("</html>"); indent-- |
| toys.writeWholeFile (f, htmltext, 'TEXT', 'MSIE', clock.now ()) |
| return ("ColorTable" + toys.padwithzeros (num, 3) + ".html") |
local (fc = 1, bc = 1, fserialnum = 1) |
loop «build all the sub-pages |
| local (f = folder + getfname (fserialnum++)) |
| oneTable (f, fc, fc + forecolorsperpage - 1, bc, bc + backcolorsperpage - 1, nextlink:getfname (fserialnum)) |
| bc = bc + backcolorsperpage |
| fc = fc + forecolorsperpage |
bundle «build the home page |
| local (title = "Color Sampler Site", i) |
| add ("<title>" + title + "</title>") |
| add ("</head>\r"); indent-- |
| add ("<body bgcolor=\"#FFFFFF\">"); indent++ |
| add ("<h4>" + title + "</h4>") |
| add ("<blockquote><code>"); indent++ |
| for i = 1 to (ctcolors * ctcolors) / (forecolorsperpage * backcolorsperpage) |
| add ("<a href=\"" + getfname (i) + "\">" + toys.padwithzeros (i, 3) + "</a>") |
| add ("</code></blockquote>"); indent-- |
| add ("<p><code>" + clock.now () + "</code>") |
| add ("</body>"); indent-- |
| add ("</html>"); indent-- |
| toys.writeWholeFile (folder + "default.html", htmltext, 'TEXT', 'MSIE', clock.now ()) |