# docpro.icn -- documentation processor for Jcon
#
# usage: docpro section-list header-1 header-2
#
# The section-list file lists individual sections to be copied
# both into the combined document and into individual pages.
#
# The header files are boilerplate for the combined document,
# which is written to standard output.
#
#%#% TO DO: edit internal HTML refs
$define JHOME "http://www.cs.arizona.edu/icon/jcon/"
record section(
fbase, # file basename
ftag, # footer tag
stitle, # section title
wtitle # webpage title
)
global sectlist # list of section records
procedure main(args)
local sfile, h1file, h2file, line, fbase, ftag, stitle, wtitle, s
if *args ~= 3 then stop("usage: ", &progname, " sectlist head1 head2");
sfile := open(args[1]) | stop("cannot open ", args[1])
h1file := open(args[2]) | stop("cannot open ", args[2])
h2file := open(args[3]) | stop("cannot open ", args[3])
sectlist := []
while line := read(sfile) do line ? {
tab(many(' \t'))
if pos(0) | ="#" then next
fbase := trim(tab(upto('/') + 1), ' \t/') | stop("bad input: ", line)
tab(many(' \t'))
ftag := trim(tab(upto('/') + 1), ' \t/') | stop("bad input: ", line)
tab(many(' \t'))
stitle := trim(tab(upto('/') + 1), ' \t/') | stop("bad input: ", line)
tab(many(' \t'))
wtitle := trim(tab(0),' \t')
put(sectlist, section(fbase, ftag, stitle, wtitle))
}
dontedit(&output)
while write(read(h1file))
every s := !sectlist do {
write("", s.stitle, "
")
}
while write(read(h2file))
every s := !sectlist do {
wrsect(s.fbase, s.stitle)
wrpage(s.fbase, s.wtitle)
}
write("\n