Commit 012df573 authored by gerd's avatar gerd

Basic I18N features also for Latex mode.


git-svn-id: https://godirepo.camlcity.org/svn/app-presentation/trunk@24 50e5f3cf-a9f2-0310-83d8-d11ec64cb5ab
parent 3653bea4
......@@ -71,24 +71,42 @@ let convert_to_html no_gifs remove_prefix langs filename =
;;
let convert_to_latex use_ocamldoc front_file filename =
let convert_to_latex use_ocamldoc front_file langs filename =
let convert idx (root : To_latex.shared node) lang outlang =
let dirname = Filename.dirname filename in
let outname = Filename.chop_extension (Filename.basename filename) ^
outlang ^ ".tex" in
let out = open_out outname in
root # extension # enumerate_pages 0;
ignore(root # extension # enumerate_pictures 1);
root # extension # set_dirname dirname;
root # extension # set_option "use_ocamldoc" (string_of_bool use_ocamldoc);
( match front_file with
Some f -> root # extension # set_option "front_file" f
| None -> ()
);
let hier = root # extension # collect_hierarchy idx (fun ~lang -> "") in
root # extension # print_pages out lang idx hier;
close_out out
in
(* read in style definition *)
let idx = (new hash_index :> To_latex.shared index) in
let document = parse_document idx To_latex.tag_map filename in
let dirname = Filename.dirname filename in
let outname = Filename.chop_extension (Filename.basename filename) ^ ".tex" in
let out = open_out outname in
let root = document # root in
root # extension # enumerate_pages 0;
ignore(root # extension # enumerate_pictures 1);
root # extension # set_dirname dirname;
root # extension # set_option "use_ocamldoc" (string_of_bool use_ocamldoc);
( match front_file with
Some f -> root # extension # set_option "front_file" f
| None -> ()
);
let hier = root # extension # collect_hierarchy idx "" in
root # extension # print_pages out idx hier
let langs' =
if langs = [] then
languages_of_doc root
else
langs
in
if langs' = [] then
(* No I18N *)
convert idx root `Any ""
else
List.iter
(fun lang -> convert idx root (`Lang lang) ("." ^ lang))
langs'
;;
......@@ -106,7 +124,7 @@ let main() =
"-remove", Arg.String (fun s -> remove := s),
"<prefix> remove this prefix from all URLs";
"-latex", Arg.Unit (fun _ -> action :=
(fun fn -> convert_to_latex !ocamldoc !front_file fn)),
(fun fn -> convert_to_latex !ocamldoc !front_file !langs fn)),
" output LateX code instead of HTML";
"-ocamldoc", Arg.Set ocamldoc,
" [Latex:] include the ocamldoc package";
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment