From 7d5aaf7b68b781459a7cd9d0abf493b5bcab30e6 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Mon, 4 Sep 2006 01:05:13 +0000 Subject: [PATCH] Add nice header/footer for autodoc --- configDefault/autodoc.cfg | 10 +++++----- configDefault/autodoc.csg | 1 + src/autodoc.sml | 42 ++++++++++++++++++++++++++------------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/configDefault/autodoc.cfg b/configDefault/autodoc.cfg index b80bf5d..85af4c3 100644 --- a/configDefault/autodoc.cfg +++ b/configDefault/autodoc.cfg @@ -1,12 +1,12 @@ structure Autodoc :> AUTODOC_CONFIG = struct val htmlHeader = fn title => - String.concat ["", + String.concat ["<div class=\"main\">\n<div class=\"title\">\n<img class=\"globe\" src=\"http://hcoop.net/globe.gif\" />\n<h1>", title, - "

", - title, - "

\n"] + "\n"] + +val htmlFooter = "" -val htmlFooter = "" +val stylesheet = "http://hcoop.net/hcoop.css" end diff --git a/configDefault/autodoc.csg b/configDefault/autodoc.csg index 023a749..f640f6e 100644 --- a/configDefault/autodoc.csg +++ b/configDefault/autodoc.csg @@ -2,5 +2,6 @@ signature AUTODOC_CONFIG = sig val htmlHeader : string -> string val htmlFooter : string +val stylesheet : string end diff --git a/src/autodoc.sml b/src/autodoc.sml index 71ff33d..87134e4 100644 --- a/src/autodoc.sml +++ b/src/autodoc.sml @@ -77,15 +77,14 @@ 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)) @@ -119,14 +118,21 @@ fun autodoc {outdir, infiles} = :: 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 PrHTML.prHTML {putc = (fn ch => TextIO.output1 (outf, ch)), puts = (fn s => TextIO.output (outf, s))} html; @@ -150,16 +156,24 @@ fun autodoc {outdir, infiles} = end) infiles val index = 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 = UL {ty = NONE, - compact = false, - content = items}}} + 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 -- 2.20.1