Don't overwrite HTML and LateX style files, generate style file for LaTeX
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5656 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
a1434b7470
commit
e64970f29d
3
Changes
3
Changes
|
@ -132,7 +132,8 @@ OCamldoc:
|
|||
- handling recursive modules
|
||||
- handling private types
|
||||
- some fixes in html generation
|
||||
|
||||
- don't overwrite existing style.css file when generating HTML
|
||||
- create the ocamldoc.sty file when generating LaTeX (if it does not already exists)
|
||||
|
||||
Objective Caml 3.06:
|
||||
--------------------
|
||||
|
|
|
@ -112,6 +112,7 @@ EXECMOFILES=$(CMOFILES)\
|
|||
odoc_ocamlhtml.cmo\
|
||||
odoc_html.cmo\
|
||||
odoc_man.cmo\
|
||||
odoc_latex_style.cmo \
|
||||
odoc_latex.cmo\
|
||||
odoc_texi.cmo\
|
||||
odoc_dot.cmo
|
||||
|
@ -229,7 +230,7 @@ odoc_crc.ml: $(CMIFILES)
|
|||
Odoc_sig Odoc_ast Odoc_control Odoc_inherit \
|
||||
Odoc_search Odoc_cross Odoc_merge Odoc_analyse \
|
||||
Odoc_dag2html Odoc_ocamlhtml Odoc_html Odoc_to_text \
|
||||
Odoc_latex Odoc_man Odoc_texi Odoc_scan > $@
|
||||
Odoc_latex_style Odoc_latex Odoc_man Odoc_texi Odoc_scan > $@
|
||||
|
||||
# Parsers and lexers dependencies :
|
||||
###################################
|
||||
|
|
|
@ -109,6 +109,7 @@ EXECMOFILES=$(CMOFILES)\
|
|||
odoc_ocamlhtml.cmo\
|
||||
odoc_html.cmo\
|
||||
odoc_man.cmo\
|
||||
odoc_latex_style.cmo \
|
||||
odoc_latex.cmo\
|
||||
odoc_texi.cmo\
|
||||
odoc_dot.cmo\
|
||||
|
@ -266,7 +267,7 @@ odoc_crc.ml: $(CMIFILES)
|
|||
Odoc_sig Odoc_ast Odoc_control Odoc_inherit\
|
||||
Odoc_search Odoc_cross Odoc_merge Odoc_analyse\
|
||||
Odoc_dag2html Odoc_ocamlhtml Odoc_html Odoc_to_text \
|
||||
Odoc_latex Odoc_man Odoc_texi Odoc_scan > $@
|
||||
Odoc_latex_style Odoc_latex Odoc_man Odoc_texi Odoc_scan > $@
|
||||
|
||||
# generic rules :
|
||||
#################
|
||||
|
|
|
@ -582,10 +582,17 @@ class html =
|
|||
let default_style = String.concat "\n" default_style_options in
|
||||
(
|
||||
try
|
||||
let chanout = open_out (Filename.concat !Args.target_dir style_file) in
|
||||
output_string chanout default_style ;
|
||||
flush chanout ;
|
||||
close_out chanout
|
||||
let file = Filename.concat !Args.target_dir style_file in
|
||||
if Sys.file_exists file then
|
||||
Odoc_info.verbose (Odoc_messages.file_exists_dont_generate file)
|
||||
else
|
||||
(
|
||||
let chanout = open_out file in
|
||||
output_string chanout default_style ;
|
||||
flush chanout ;
|
||||
close_out chanout;
|
||||
Odoc_info.verbose (Odoc_messages.file_generated file)
|
||||
)
|
||||
with
|
||||
Sys_error s ->
|
||||
prerr_endline s ;
|
||||
|
|
|
@ -892,8 +892,29 @@ class latex =
|
|||
(match !Args.title with None -> "" | Some _ -> "\\maketitle\n")^
|
||||
(if !Args.with_toc then "\\tableofcontents\n" else "")
|
||||
|
||||
(** Generate the LaTeX style file, if it does not exists. *)
|
||||
method generate_style_file =
|
||||
try
|
||||
let dir = Filename.dirname !Args.out_file in
|
||||
let file = Filename.concat dir "ocamldoc.sty" in
|
||||
if Sys.file_exists file then
|
||||
Odoc_info.verbose (Odoc_messages.file_exists_dont_generate file)
|
||||
else
|
||||
(
|
||||
let chanout = open_out file in
|
||||
output_string chanout Odoc_latex_style.content ;
|
||||
flush chanout ;
|
||||
close_out chanout;
|
||||
Odoc_info.verbose (Odoc_messages.file_generated file)
|
||||
)
|
||||
with
|
||||
Sys_error s ->
|
||||
prerr_endline s ;
|
||||
incr Odoc_info.errors ;
|
||||
|
||||
(** Generate the LaTeX file from a module list, in the {!Odoc_info.Args.out_file} file. *)
|
||||
method generate module_list =
|
||||
self#generate_style_file ;
|
||||
if !Args.separate_files then
|
||||
(
|
||||
let f m =
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
(***********************************************************************)
|
||||
(* OCamldoc *)
|
||||
(* *)
|
||||
(* Maxence Guesdon, projet Cristal, INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2001 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed *)
|
||||
(* under the terms of the Q Public License version 1.0. *)
|
||||
(* *)
|
||||
(***********************************************************************)
|
||||
|
||||
(** The content of the LaTeX style to generate when generating LaTeX code. *)
|
||||
|
||||
let content ="
|
||||
%% Support macros for LaTeX documentation generated by ocamldoc.
|
||||
%% This file is in the public domain; do what you want with it.
|
||||
|
||||
\\NeedsTeXFormat{LaTeX2e}
|
||||
\\ProvidesPackage{ocamldoc}
|
||||
[2001/12/04 v1.0 ocamldoc support]
|
||||
|
||||
\\newenvironment{ocamldoccode}{%
|
||||
\\bgroup
|
||||
\\leftskip\\@totalleftmargin
|
||||
\\rightskip\\z@skip
|
||||
\\parindent\\z@
|
||||
\\parfillskip\\@flushglue
|
||||
\\parskip\\z@skip
|
||||
%\\noindent
|
||||
\\@@par\\smallskip
|
||||
\\@tempswafalse
|
||||
\\def\\par{%
|
||||
\\if@tempswa
|
||||
\\leavevmode\\null\\@@par\\penalty\\interlinepenalty
|
||||
\\else
|
||||
\\@tempswatrue
|
||||
\\ifhmode\\@@par\\penalty\\interlinepenalty\\fi
|
||||
\\fi}
|
||||
\\obeylines
|
||||
\\verbatim@font
|
||||
\\let\\org@prime~%
|
||||
\\@noligs
|
||||
\\let\\org@dospecials\\dospecials
|
||||
\\g@remfrom@specials{\\\\}
|
||||
\\g@remfrom@specials{\\{}
|
||||
\\g@remfrom@specials{\\}}
|
||||
\\let\\do\\@makeother
|
||||
\\dospecials
|
||||
\\let\\dospecials\\org@dospecials
|
||||
\\frenchspacing\\@vobeyspaces
|
||||
\\everypar \\expandafter{\\the\\everypar \\unpenalty}}
|
||||
{\\egroup\\par}
|
||||
|
||||
\\def\\g@remfrom@specials#1{%
|
||||
\\def\\@new@specials{}
|
||||
\\def\\@remove##1{%
|
||||
\\ifx##1#1\\else
|
||||
\\g@addto@macro\\@new@specials{\\do ##1}\\fi}
|
||||
\\let\\do\\@remove\\dospecials
|
||||
\\let\\dospecials\\@new@specials
|
||||
}
|
||||
|
||||
\\newenvironment{ocamldocdescription}
|
||||
{\\list{}{\\rightmargin0pt \\topsep0pt}\\raggedright\\item\\relax}
|
||||
{\\endlist\\medskip}
|
||||
|
||||
\\newenvironment{ocamldoccomment}
|
||||
{\\list{}{\\leftmargin 2\\leftmargini \\rightmargin0pt \\topsep0pt}\\raggedright\\item\\relax}
|
||||
{\\endlist}
|
||||
|
||||
\\let\\ocamldocvspace\\vspace
|
||||
\\endinput
|
||||
"
|
||||
|
|
@ -245,6 +245,9 @@ let merging = "Merging..."
|
|||
let cross_referencing = "Cross referencing..."
|
||||
let generating_doc = "Generating documentation..."
|
||||
let loading f = "Loading "^f^"..."
|
||||
let file_generated f = "File "^f^" generated."
|
||||
let file_exists_dont_generate f =
|
||||
"File "^f^" exists, we don't generate it."
|
||||
|
||||
(** Messages for documentation generation.*)
|
||||
|
||||
|
|
Loading…
Reference in New Issue