File tree Expand file tree Collapse file tree 6 files changed +29
-8
lines changed
test/generators/html_opts.t Expand file tree Collapse file tree 6 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ type t = {
8
8
flat : bool ;
9
9
open_details : bool ;
10
10
omit_breadcrumbs : bool ;
11
+ omit_toc : bool ;
11
12
}
12
13
13
- let v ?theme_uri ?support_uri ~semantic_uris ~indent ~flat ~open_details ~omit_breadcrumbs () =
14
- { theme_uri; support_uri; semantic_uris; indent; flat; open_details; omit_breadcrumbs }
14
+ let v ?theme_uri ?support_uri ~semantic_uris ~indent ~flat ~open_details ~omit_breadcrumbs ~ omit_toc () =
15
+ { theme_uri; support_uri; semantic_uris; indent; flat; open_details; omit_breadcrumbs; omit_toc }
15
16
16
17
let theme_uri config =
17
18
match config.theme_uri with None -> Types. Relative None | Some uri -> uri
@@ -27,4 +28,6 @@ let flat config = config.flat
27
28
28
29
let open_details config = config.open_details
29
30
30
- let omit_breadcrumbs config = config.omit_breadcrumbs
31
+ let omit_breadcrumbs config = config.omit_breadcrumbs
32
+
33
+ let omit_toc config = config.omit_toc
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ val v :
10
10
flat :bool ->
11
11
open_details :bool ->
12
12
omit_breadcrumbs :bool ->
13
+ omit_toc :bool ->
13
14
unit ->
14
15
t
15
16
@@ -26,3 +27,5 @@ val flat : t -> bool
26
27
val open_details : t -> bool
27
28
28
29
val omit_breadcrumbs : t -> bool
30
+
31
+ val omit_toc : t -> bool
Original file line number Diff line number Diff line change @@ -131,10 +131,11 @@ let page_creator ~config ~url name header toc content =
131
131
in
132
132
133
133
let breadcrumbs = if Config. omit_breadcrumbs config then [] else gen_breadcrumbs () in
134
+ let toc = if Config. omit_toc config then [] else html_of_toc toc in
134
135
let body =
135
136
breadcrumbs
136
137
@ [ Html. header ~a: [ Html. a_class [ " odoc-preamble" ] ] header ]
137
- @ html_of_toc toc
138
+ @ toc
138
139
@ [ Html. div ~a: [ Html. a_class [ " odoc-content" ] ] content ]
139
140
in
140
141
Html. html head (Html. body ~a: [ Html. a_class [ " odoc" ] ] body)
Original file line number Diff line number Diff line change @@ -521,15 +521,22 @@ module Odoc_html_args = struct
521
521
" Don't emit the breadcrumbs navigation element"
522
522
in
523
523
Arg. (value & flag & info ~docs ~doc [ " omit-breadcrumbs" ])
524
+
525
+ let omit_toc =
526
+ let doc =
527
+ " Don't emit the table of contents div"
528
+ in
529
+ Arg. (value & flag & info ~docs ~doc [ " omit-toc" ])
530
+
524
531
let extra_args =
525
- let config semantic_uris closed_details indent theme_uri support_uri flat omit_breadcrumbs =
532
+ let config semantic_uris closed_details indent theme_uri support_uri flat omit_breadcrumbs omit_toc =
526
533
let open_details = not closed_details in
527
534
Odoc_html.Config. v ~theme_uri ~support_uri ~semantic_uris ~indent ~flat
528
- ~open_details ~omit_breadcrumbs ()
535
+ ~open_details ~omit_breadcrumbs ~omit_toc ()
529
536
in
530
537
Term. (
531
538
const config $ semantic_uris $ closed_details $ indent $ theme_uri
532
- $ support_uri $ flat $ omit_breadcrumbs)
539
+ $ support_uri $ flat $ omit_breadcrumbs $ omit_toc )
533
540
end
534
541
535
542
module Odoc_html = Make_renderer (Odoc_html_args )
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ let from_mld ~xref_base_uri ~resolver ~output ~warnings_options input =
26
26
let page = Odoc_document.Comment. to_ir resolved.content in
27
27
let config =
28
28
Odoc_html.Config. v ~semantic_uris: false ~indent: false ~flat: false
29
- ~open_details: false ~omit_breadcrumbs: false ()
29
+ ~open_details: false ~omit_breadcrumbs: false ~omit_toc: false ()
30
30
in
31
31
let html = Odoc_html.Generator. doc ~config ~xref_base_uri page in
32
32
let oc = open_out (Fs.File. to_string output) in
Original file line number Diff line number Diff line change @@ -32,5 +32,12 @@ Check semantic_uris:
32
32
$ grep Test . t html/ test/ Test2/ index . html
33
33
<a href="../Test/#type-t" >Test . t</a >
34
34
35
+ Check omission of toc:
36
+ $ odoc html-generate test. odocl -o html -- indent
37
+ $ grep odoc-toc html/ test/ Test / index . html
38
+ <nav class="odoc-toc" >
39
+ $ odoc html-generate test. odocl -o html -- indent -- omit-toc
40
+ $ grep odoc-toc html/ test/ Test / index . html
41
+ [1 ]
35
42
36
43
You can’t perform that action at this time.
0 commit comments