Add nice header/footer for autodoc
authorAdam Chlipala <adamc@hcoop.net>
Mon, 4 Sep 2006 01:05:13 +0000 (01:05 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Mon, 4 Sep 2006 01:05:13 +0000 (01:05 +0000)
configDefault/autodoc.cfg
configDefault/autodoc.csg
src/autodoc.sml

index b80bf5d..85af4c3 100644 (file)
@@ -1,12 +1,12 @@
 structure Autodoc :> AUTODOC_CONFIG = struct
 
 val htmlHeader = fn title =>
 structure Autodoc :> AUTODOC_CONFIG = struct
 
 val htmlHeader = fn title =>
-                   String.concat ["<html><head><title>",
+                   String.concat ["<div class=\"main\">\n<div class=\"title\">\n<img class=\"globe\" src=\"http://hcoop.net/globe.gif\" />\n<h1>",
                                   title,
                                   title,
-                                  "</title><body><h1>",
-                                  title,
-                                  "</h1>\n"]
+                                  "</h1>\n</div>"]
+
+val htmlFooter = "</div>"
 
 
-val htmlFooter = "</body></html>"
+val stylesheet = "http://hcoop.net/hcoop.css"
 
 end
 
 end
index 023a749..f640f6e 100644 (file)
@@ -2,5 +2,6 @@ signature AUTODOC_CONFIG = sig
 
 val htmlHeader : string -> string
 val htmlFooter : string
 
 val htmlHeader : string -> string
 val htmlFooter : string
+val stylesheet : string
 
 end
 
 end
index 71ff33d..87134e4 100644 (file)
@@ -77,15 +77,14 @@ fun autodoc {outdir, infiles} =
                                            TextIO.output (outf, desc);
                                            TextIO.output (outf, "</p>\n"))) desc*)
 
                                            TextIO.output (outf, desc);
                                            TextIO.output (outf, "</p>\n"))) desc*)
 
-               val body = Hn {n = 1,
-                              align = NONE,
-                              content = PCDATA title}
-
                val body = case desc of
                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))
 
                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,
                                      :: 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,
                                 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;
            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,
                            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,
                          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
 
        val outf = TextIO.openOut (outdir ^ "/index.html")
     in