diff options
| author | notin | 2008-04-08 07:18:13 +0000 |
|---|---|---|
| committer | notin | 2008-04-08 07:18:13 +0000 |
| commit | 98f930742ca58742a9bc0a575e2d362ee2fa061e (patch) | |
| tree | f58efb4683f29b725477a0b468c044875478a70f | |
| parent | d44af32d0946b62fe2db9efa47fb8b7063d0024d (diff) | |
Ajout d'options a coqdoc pour l'entete html
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10764 85f007b7-540e-0410-9357-904b9bb8a0f7
| -rw-r--r-- | tools/coqdoc/cdglobals.ml | 4 | ||||
| -rw-r--r-- | tools/coqdoc/main.ml | 72 | ||||
| -rw-r--r-- | tools/coqdoc/output.ml | 50 |
3 files changed, 80 insertions, 46 deletions
diff --git a/tools/coqdoc/cdglobals.ml b/tools/coqdoc/cdglobals.ml index eef598fdd5..44b9bd3ce0 100644 --- a/tools/coqdoc/cdglobals.ml +++ b/tools/coqdoc/cdglobals.ml @@ -33,6 +33,10 @@ let close_out_file () = close_out !out_channel let header_trailer = ref true +let header_file = ref "" +let header_file_spec = ref false +let footer_file = ref "" +let footer_file_spec = ref false let quiet = ref true let light = ref false let gallina = ref false diff --git a/tools/coqdoc/main.ml b/tools/coqdoc/main.ml index b00bcfcf96..b2d1eb9196 100644 --- a/tools/coqdoc/main.ml +++ b/tools/coqdoc/main.ml @@ -26,37 +26,39 @@ open Printf let usage () = prerr_endline ""; prerr_endline "Usage: coqdoc <options and files>"; - prerr_endline " --html produce a HTML document (default)"; - prerr_endline " --latex produce a LaTeX document"; - prerr_endline " --texmacs produce a TeXmacs document"; - prerr_endline " --dvi output the DVI"; - prerr_endline " --ps output the PostScript"; - prerr_endline " --stdout write output to stdout"; - prerr_endline " -o <file> write output in file <file>"; - prerr_endline " -d <dir> output files into directory <dir>"; - prerr_endline " -g (gallina) skip proofs"; - prerr_endline " -s (short) no titles for files"; - prerr_endline " -l light mode (only defs and statements)"; - prerr_endline " -t <string> give a title to the document"; - prerr_endline " --body-only suppress LaTeX/HTML header and trailer"; - prerr_endline " --no-index do not output the index"; - prerr_endline " --multi-index index split in multiple files"; - prerr_endline " --toc output a table of contents"; - prerr_endline " --vernac <file> consider <file> as a .v file"; - prerr_endline " --tex <file> consider <file> as a .tex file"; - prerr_endline " -p <string> insert <string> in LaTeX preamble"; - prerr_endline " --files-from <file> read file names to process in <file>"; - prerr_endline " --quiet quiet mode (default)"; - prerr_endline " --verbose verbose mode"; - prerr_endline " --no-externals no links to Coq standard library"; - prerr_endline " --coqlib <url> set URL for Coq standard library"; - prerr_endline " (default is http://coq.inria.fr/library/)"; - prerr_endline " --coqlib_path <dir> set the path where Coq files are installed"; - prerr_endline " -R <dir> <coqdir> map physical dir to Coq dir"; - prerr_endline " --latin1 set ISO-8859-1 input language"; - prerr_endline " --utf8 set UTF-8 input language"; - prerr_endline " --charset <string> set HTML charset"; - prerr_endline " --inputenc <string> set LaTeX input encoding"; + prerr_endline " --html produce a HTML document (default)"; + prerr_endline " --latex produce a LaTeX document"; + prerr_endline " --texmacs produce a TeXmacs document"; + prerr_endline " --dvi output the DVI"; + prerr_endline " --ps output the PostScript"; + prerr_endline " --stdout write output to stdout"; + prerr_endline " -o <file> write output in file <file>"; + prerr_endline " -d <dir> output files into directory <dir>"; + prerr_endline " -g (gallina) skip proofs"; + prerr_endline " -s (short) no titles for files"; + prerr_endline " -l light mode (only defs and statements)"; + prerr_endline " -t <string> give a title to the document"; + prerr_endline " --body-only suppress LaTeX/HTML header and trailer"; + prerr_endline " --with-header <file> prepend <file> as html reader"; + prerr_endline " --with-footer <file> append <file> as html footer"; + prerr_endline " --no-index do not output the index"; + prerr_endline " --multi-index index split in multiple files"; + prerr_endline " --toc output a table of contents"; + prerr_endline " --vernac <file> consider <file> as a .v file"; + prerr_endline " --tex <file> consider <file> as a .tex file"; + prerr_endline " -p <string> insert <string> in LaTeX preamble"; + prerr_endline " --files-from <file> read file names to process in <file>"; + prerr_endline " --quiet quiet mode (default)"; + prerr_endline " --verbose verbose mode"; + prerr_endline " --no-externals no links to Coq standard library"; + prerr_endline " --coqlib <url> set URL for Coq standard library"; + prerr_endline " (default is http://coq.inria.fr/library/)"; + prerr_endline " --coqlib_path <dir> set the path where Coq files are installed"; + prerr_endline " -R <dir> <coqdir> map physical dir to Coq dir"; + prerr_endline " --latin1 set ISO-8859-1 input language"; + prerr_endline " --utf8 set UTF-8 input language"; + prerr_endline " --charset <string> set HTML charset"; + prerr_endline " --inputenc <string> set LaTeX input encoding"; prerr_endline ""; exit 1 @@ -201,6 +203,14 @@ let parse () = | ("-nopreamble" | "--nopreamble" | "--no-preamble" | "-bodyonly" | "--bodyonly" | "--body-only") :: rem -> header_trailer := false; parse_rec rem + | ("-with-header" | "--with-header") :: f ::rem -> + header_trailer := true; header_file_spec := true; header_file := f; parse_rec rem + | ("-with-header" | "--with-header") :: [] -> + usage () + | ("-with-footer" | "--with-footer") :: f ::rem -> + header_trailer := true; footer_file_spec := true; footer_file := f; parse_rec rem + | ("-with-footer" | "--with-footer") :: [] -> + usage () | ("-p" | "--preamble") :: s :: rem -> Output.push_in_preamble s; parse_rec rem | ("-p" | "--preamble") :: [] -> diff --git a/tools/coqdoc/output.ml b/tools/coqdoc/output.ml index 5e37213867..fd8768fdf1 100644 --- a/tools/coqdoc/output.ml +++ b/tools/coqdoc/output.ml @@ -277,27 +277,47 @@ end module Html = struct let header () = - if !header_trailer then begin - printf "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"; - printf "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; - printf "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"; - printf "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n" !charset; - printf "<link href=\"coqdoc.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"; - printf "<title>%s</title>\n</head>\n\n" !page_title; - printf "<body>\n\n<div id=\"page\">\n\n<div id=\"header\">\n</div>\n\n"; - printf "<div id=\"main\">\n\n" - end + if !header_trailer then + if !header_file_spec then + let cin = Pervasives.open_in !header_file in + try + while true do + let s = Pervasives.input_line cin in + printf "%s\n" s + done + with End_of_file -> Pervasives.close_in cin + else + begin + printf "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"; + printf "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; + printf "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"; + printf "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n" !charset; + printf "<link href=\"coqdoc.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"; + printf "<title>%s</title>\n</head>\n\n" !page_title; + printf "<body>\n\n<div id=\"page\">\n\n<div id=\"header\">\n</div>\n\n"; + printf "<div id=\"main\">\n\n" + end let self = "http://coq.inria.fr" let trailer () = if !index && !current_module <> "Index" then printf "</div>\n\n<div id=\"footer\">\n<hr/><a href=\"index.html\">Index</a>"; - if !header_trailer then begin - printf "<hr/>This page has been generated by "; - printf "<a href=\"%s\">coqdoc</a>\n" self; - printf "</div>\n\n</div>\n\n</body>\n</html>" - end + if !header_trailer then + if !footer_file_spec then + let cin = Pervasives.open_in !footer_file in + try + while true do + let s = Pervasives.input_line cin in + printf "%s\n" s + done + with End_of_file -> Pervasives.close_in cin + else + begin + printf "<hr/>This page has been generated by "; + printf "<a href=\"%s\">coqdoc</a>\n" self; + printf "</div>\n\n</div>\n\n</body>\n</html>" + end let start_module () = if not !short then begin |
