Add nice header/footer for autodoc
[hcoop/domtool2.git] / src / autodoc.sml
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