############################################################################ # # File: gif2html.icn # # Subject: Program to create Web pages for weaving GIFs # # Author: Ralph E. Griswold # # Date: February 15, 1999 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # This program produces Web pages with images in the cells of # tables. File names are given on the command line. The main Web # page contains links to the pages with the images. # # The following options are supported: # # -n s page name prefix; default "images" # -s i cell size -- typically the size of the GIFs; default 128 # -t s page title, default "Images" # -w i maximum width of page (for printing constraints); default 700 # # The main page is named .html; the image pages are named # ddd.html. # ############################################################################ # # Link: options # ############################################################################ link options procedure main(args) local td, size, n, opts, width, pages, output, count, title, mainout, file opts := options(args, "mn:s+t:w+") pages := opts["m"] name := \opts["n"] | "image" size := \opts["s"] | 128 title := \opts["t"] | "Images" width := \opts["w"] | 700 size +:= 1 n := width / size if n < 1 then stop("*** images too large") td := "", title, "") count := 0 repeat { until *args = 0 do { output := open(file := name || right(count +:= 1, 3, "0") || ".html", "w") | stop("*** cannot open image page") write(output, "") write(output, "", title, right(count, 3), "") write(output, "") write(output, "

", title, right(count, 3), "

") write(output, "") every 1 to 10 do { write(output, "") every 1 to n do { write(output, td, get(args), "\">") | break break } write(output, "") } write(output, "


") write(output, "") write(output, "") close(output) write(mainout, "", file, "
") } if *args = 0 then break } write(mainout, "") write(mainout, "") end