MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit 8d51bb2c authored by Jean-Christophe Filliâtre's avatar Jean-Christophe Filliâtre
Browse files

why3doc: index generation

parent af69cabc
......@@ -841,6 +841,10 @@ identifier use to its definition.
\item Option \verb|--output| is the same as \verb|-o|
\item Option \verb|--stdlib-url|~\textsl{url} sets a URL for files
found in load path, so that links to definitions can be added
\item Option \verb|--index| (resp. \verb|--no-index|) to include
(resp. exclude) the generation of an index file \texttt{index.html}.
The default behavior is to generate an index if more than one file
is passed on the command line.
\end{itemize}
\paragraph{Typesetting textual comments}
......
(** {1 Dijkstra's "Dutch national flag"}
Variant which number of occurrences instead of permut predicate
Variant with number of occurrences instead of predicate [permut]
*)
......
(* Greatest common divisor, with Bézout coefficients *)
(** {1 Greatest common divisor, with Bézout coefficients} *)
module GcdBezout
......
......@@ -92,6 +92,7 @@
}
let space = [' ' '\t']
let ident = ['A'-'Z' 'a'-'z' '_'] ['A'-'Z' 'a'-'z' '0'-'9' '_']*
let special = ['<' '>' '&']
......@@ -247,7 +248,21 @@ and raw_html fmt depth = parse
| _ as c { pp_print_char fmt c; raw_html fmt depth lexbuf }
and extract_header = parse
| "(**" space* "{" ['1'-'6'] ([^ '}']* as header) "}"
{ header }
| space+ | "\n"
{ extract_header lexbuf }
| "(*"
{ skip_comment lexbuf; extract_header lexbuf }
| eof | _
{ "" }
and skip_comment = parse
| "*)" { () }
| "(*" { skip_comment lexbuf; skip_comment lexbuf }
| eof { () }
| _ { skip_comment lexbuf }
{
......@@ -263,6 +278,13 @@ and raw_html fmt depth = parse
fprintf fmt "</pre>@\n";
close_in cin
let extract_header fname =
let cin = open_in fname in
let lb = Lexing.from_channel cin in
let h = extract_header lb in
close_in cin;
h
}
(*
......
......@@ -33,6 +33,7 @@ let usage_msg = sprintf
let opt_loadpath = ref []
let opt_output = ref None
let opt_index = ref None (* default behavior *)
let opt_queue = Queue.create ()
let option_list = Arg.align [
......@@ -44,6 +45,10 @@ let option_list = Arg.align [
" same as -o";
"--stdlib-url", Arg.String Doc_def.set_stdlib_url,
"<url> Add links to <url> for files found on loadpath";
"--index", Arg.Unit (fun () -> opt_index := Some true),
" generates an index file index.html";
"--no-index", Arg.Unit (fun () -> opt_index := Some false),
" do not generate an index file index.html";
]
let add_opt_file x = Queue.add x opt_queue
......@@ -56,6 +61,10 @@ let () =
Doc_def.set_loadpath !opt_loadpath;
Doc_def.set_output_dir !opt_output
let index = match !opt_index with
| Some b -> b
| None -> Queue.length opt_queue > 1
let css =
let css_fname = "style.css" in
let css_full_fname = match !opt_output with
......@@ -87,8 +96,27 @@ let () =
Queue.iter Doc_def.add_file opt_queue;
try
let env = Env.create_env !opt_loadpath in
(* process files *)
Queue.iter (do_file env) opt_queue;
Queue.iter print_file opt_queue
Queue.iter print_file opt_queue;
(* then generate the index *)
if index then begin
let fhtml = Doc_def.output_file "index" in
let c = open_out fhtml in
let fmt = formatter_of_out_channel c in
Doc_html.print_header fmt ~title:"why3doc index" ~css ();
fprintf fmt "<ul>@\n";
let add fn =
let header = Doc_lexer.extract_header fn in
let header = if header = "" then "" else ": " ^ header in
fprintf fmt "<li> <a href=\"%s\">%s</a> %s </li>@\n"
(Doc_def.output_file fn) (Filename.basename fn) header
in
Queue.iter add opt_queue;
fprintf fmt "</ul>@\n";
Doc_html.print_footer fmt ();
close_out c
end
with e when not (Debug.test_flag Debug.stack_trace) ->
eprintf "%a@." Exn_printer.exn_printer e;
exit 1
......@@ -98,3 +126,4 @@ Local Variables:
compile-command: "unset LANG; make -C ../.. bin/why3doc.opt"
End:
*)
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