Skip to content
This repository
Newer
Older
100644 67 lines (58 sloc) 2.203 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 open Odoc_info
19 open Odoc_html
20 open Module
21
22 (* overring the existing html generator
23 * to be able to say
24 * [@inline doc] in a signature documentation to
25 * tell ocamldoc to inline the signature instead of just
26 * putting a link to it
27 *)
28 class my_gen =
29 object(self)
30 inherit Odoc_html.html
31
32 method html_of_module b ?(info=true) ?complete:(_=true) ?(with_link=true) m =
33 let complete = true in
34 let (html_file, _) = Naming.html_files m.m_name in
35 let father = Name.father m.m_name in
36 bs b "<pre>";
37 bs b ((self#keyword "module")^" ");
38 if with_link then
39 bp b "<a href=\"%s\">%s</a>" html_file (Name.simple m.m_name)
40 else
41 bs b (Name.simple m.m_name);
42 ( match m.m_kind with
43 | Module_functor _ when !Odoc_info.Args.html_short_functors -> ()
44 | _ -> bs b ": "
45 );
46 let modu =
47 match m.m_info with
48 | Some {i_custom=i_custom} when
49 List.exists (function ("inline",[Odoc_info.Raw "doc"]) -> true | _ -> false) i_custom && with_link -> None
50 | _ -> Some m in
51 self#html_of_module_kind b father ?modu m.m_kind;
52 bs b "</pre>";
53 if info then
54 (if complete then
55 self#html_of_info ~indent: false
56 else
57 self#html_of_info_first_sentence
58 ) b m.m_info
59
60 method no_html _ = ""
61
62 initializer
63 tag_functions <- ("inline", self#no_html) :: tag_functions
64 end
65
66 let my_generator = new my_gen
67 let _ = Odoc_args.set_doc_generator (Some (my_generator :> Odoc_args.doc_generator))
Something went wrong with that request. Please try again.