X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/3196000d8e29e14665f43ffd74460b2e6d592250..c53e82e40cef407de986aa329d31457915ad0dbe:/src/autodoc.sml diff --git a/src/autodoc.sml b/src/autodoc.sml index fae4495..231a13e 100644 --- a/src/autodoc.sml +++ b/src/autodoc.sml @@ -41,7 +41,7 @@ fun check' G fname = fun autodoc {outdir, infiles} = let - val (prov, infiles) = Order.order infiles + val (prov, infiles) = Order.order NONE infiles val _ = HtmlPrint.setProviders prov val G = foldl (fn (fname, G) => check' G fname) Env.empty infiles @@ -77,15 +77,20 @@ fun autodoc {outdir, infiles} = TextIO.output (outf, desc); TextIO.output (outf, "

\n"))) desc*) - val body = Hn {n = 1, - align = NONE, - content = PCDATA title} - val body = case desc of - NONE => body - | SOME desc => BlockList [body, - P {align = NONE, - content = PCDATA desc}] + NONE => BlockList [] + | SOME desc => P {align = NONE, + content = PCDATA desc} + + val body = BlockList [body, + TextBlock (BR {clear = SOME TextFlowCtl.all})] + + + val summaries = foldr (fn ((d, desc, _), summaries) => + HtmlPrint.output (p_decl_fref (annotate_decl d)) + :: BR {clear = NONE} + :: summaries) + [] decls val entries = map (fn (d, desc, _) => let @@ -100,46 +105,83 @@ fun autodoc {outdir, infiles} = dblock] end) decls - val body = BlockList (body :: entries) + val body = BlockList (body + :: HR {align = NONE, + noshade = false, + size = NONE, + width = NONE} + :: TextBlock (TT (TextList summaries)) + :: HR {align = NONE, + noshade = false, + size = NONE, + width = NONE} + :: entries) val html = HTML {version = NONE, - head = [Head_TITLE title], + head = [Head_TITLE title, + Head_LINK {id = NONE, + href = SOME Config.Autodoc.stylesheet, + rel = SOME "stylesheet", + rev = NONE, + title = NONE}], body = BODY {background = NONE, bgcolor = NONE, text = NONE, link = NONE, vlink = NONE, alink = NONE, - content = body}} + content = BlockList[TextBlock (PCDATA (Config.Autodoc.htmlHeader title)), + body, + TextBlock (PCDATA Config.Autodoc.htmlFooter)]}} in - (*TextIO.output (outf, Config.Autodoc.htmlHeader ("Domtool Module " ^ uppercase file')); - Option.app (fn desc => (TextIO.output (outf, desc); - TextIO.output (outf, "\n"))) desc; - - app doDecl decls; - - TextIO.output (outf, Config.Autodoc.htmlFooter);*) PrHTML.prHTML {putc = (fn ch => TextIO.output1 (outf, ch)), puts = (fn s => TextIO.output (outf, s))} html; TextIO.closeOut outf end + val title = "Domtool Module Index" + + val items = map (fn file => + let + val file' = modify file + val (desc, _, _) = Parse.parse file + in + LI {ty = NONE, + value = NONE, + content = BlockList + [TextBlock (A {name = NONE, + href = SOME (file' ^ ".html"), + rel = NONE, + rev = NONE, + title = NONE, + content = PCDATA (uppercase file')}), + TextBlock (PCDATA (Option.getOpt (desc, "")))]} + end) infiles + + val index = HTML {version = NONE, + head = [Head_TITLE title, + Head_LINK {id = NONE, + href = SOME Config.Autodoc.stylesheet, + rel = SOME "stylesheet", + rev = NONE, + title = NONE}], + body = BODY {background = NONE, + bgcolor = NONE, + text = NONE, + link = NONE, + vlink = NONE, + alink = NONE, + content = BlockList[TextBlock (PCDATA (Config.Autodoc.htmlHeader title)), + TextBlock (BR {clear = SOME TextFlowCtl.all}), + UL {ty = NONE, + compact = false, + content = items}, + TextBlock (PCDATA Config.Autodoc.htmlFooter)]}} + val outf = TextIO.openOut (outdir ^ "/index.html") in - TextIO.output (outf, Config.Autodoc.htmlHeader "Domtool Module Index"); - - app (fn file => - let - val file' = modify file - in - TextIO.output (outf, "
  • "); - TextIO.output (outf, uppercase file'); - TextIO.output (outf, "
  • \n") - end) infiles; - - TextIO.output (outf, Config.Autodoc.htmlFooter); + PrHTML.prHTML {putc = (fn ch => TextIO.output1 (outf, ch)), + puts = (fn s => TextIO.output (outf, s))} index; TextIO.closeOut outf; app doFile infiles