File tree Expand file tree Collapse file tree 9 files changed +72
-7
lines changed Expand file tree Collapse file tree 9 files changed +72
-7
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,11 @@ type t = {
7
7
indent : bool ;
8
8
flat : bool ;
9
9
open_details : bool ;
10
+ omit_breadcrumbs : bool ;
10
11
}
11
12
12
- let v ?theme_uri ?support_uri ~semantic_uris ~indent ~flat ~open_details () =
13
- { theme_uri; support_uri; semantic_uris; indent; flat; open_details }
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
15
15
16
let theme_uri config =
16
17
match config.theme_uri with None -> Types. Relative None | Some uri -> uri
@@ -25,3 +26,5 @@ let indent config = config.indent
25
26
let flat config = config.flat
26
27
27
28
let open_details config = config.open_details
29
+
30
+ let omit_breadcrumbs config = config.omit_breadcrumbs
Original file line number Diff line number Diff line change 9
9
indent :bool ->
10
10
flat :bool ->
11
11
open_details :bool ->
12
+ omit_breadcrumbs :bool ->
12
13
unit ->
13
14
t
14
15
@@ -23,3 +24,5 @@ val indent : t -> bool
23
24
val flat : t -> bool
24
25
25
26
val open_details : t -> bool
27
+
28
+ val omit_breadcrumbs : t -> bool
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ let page_creator ~config ~url name header toc content =
72
72
]
73
73
in
74
74
75
- let breadcrumbs =
75
+ let gen_breadcrumbs () =
76
76
let rec get_parents x =
77
77
match x with
78
78
| [] -> []
@@ -130,6 +130,7 @@ let page_creator ~config ~url name header toc content =
130
130
make_navigation ~up_url l
131
131
in
132
132
133
+ let breadcrumbs = if Config. omit_breadcrumbs config then [] else gen_breadcrumbs () in
133
134
let body =
134
135
breadcrumbs
135
136
@ [ Html. header ~a: [ Html. a_class [ " odoc-preamble" ] ] header ]
Original file line number Diff line number Diff line change @@ -516,15 +516,20 @@ module Odoc_html_args = struct
516
516
in
517
517
Arg. (value & flag & info ~docs ~doc [ " flat" ])
518
518
519
+ let omit_breadcrumbs =
520
+ let doc =
521
+ " Don't emit the breadcrumbs navigation element"
522
+ in
523
+ Arg. (value & flag & info ~docs ~doc [ " omit-breadcrumbs" ])
519
524
let extra_args =
520
- let config semantic_uris closed_details indent theme_uri support_uri flat =
525
+ let config semantic_uris closed_details indent theme_uri support_uri flat omit_breadcrumbs =
521
526
let open_details = not closed_details in
522
527
Odoc_html.Config. v ~theme_uri ~support_uri ~semantic_uris ~indent ~flat
523
- ~open_details ()
528
+ ~open_details ~omit_breadcrumbs ()
524
529
in
525
530
Term. (
526
531
const config $ semantic_uris $ closed_details $ indent $ theme_uri
527
- $ support_uri $ flat)
532
+ $ support_uri $ flat $ omit_breadcrumbs )
528
533
end
529
534
530
535
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 ()
29
+ ~open_details: false ~omit_breadcrumbs: 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 27
27
(libraries sexplib0 unix fpath)
28
28
(enabled_if
29
29
(>= %{ocaml_version} 4.04)))
30
+
31
+ (cram
32
+ (deps %{bin:odoc}))
33
+
Original file line number Diff line number Diff line change
1
+ $ ocamlc -c -bin-annot test. mli
2
+ $ ocamlc -c -bin-annot test2. mli
3
+ $ odoc compile -- package test test. cmti
4
+ $ odoc compile -- package test -I . test2. cmti
5
+ $ odoc link test. odoc
6
+ $ odoc link test2. odoc
7
+ $ odoc html-generate test. odocl -o html -- indent
8
+
9
+ This should have the breadcrumbs in it as a nav with id ' odoc-nav' . Let's also
10
+ check it's got the expected content by looking for ' type-t'
11
+
12
+ $ grep odoc-nav html/ test/ Test / index . html
13
+ <nav class="odoc-nav" ><a href="../index.html" >Up</a > –
14
+ $ grep type-t html/ test/ Test / index . html
15
+ <div class="spec type anchored" id="type-t" >
16
+ <a href="#type-t" class="anchor" ></a >
17
+
18
+ Generate again, this time omitting the breadcrumbs:
19
+
20
+ $ odoc html-generate test. odocl -o html -- omit-breadcrumbs -- indent
21
+ $ grep odoc-nav html/ test/ Test / index . html
22
+ [1 ]
23
+ $ grep type-t html/ test/ Test / index . html
24
+ <div class="spec type anchored" id="type-t" >
25
+ <a href="#type-t" class="anchor" ></a >
26
+
27
+ Check semantic_uris:
28
+ $ odoc html-generate test2. odocl -o html -- indent
29
+ $ grep Test . t html/ test/ Test2/ index . html
30
+ <a href="../Test/index.html#type-t" >Test . t</a >
31
+ $ odoc html-generate test2. odocl -o html -- semantic-uris -- indent
32
+ $ grep Test . t html/ test/ Test2/ index . html
33
+ <a href="../Test/#type-t" >Test . t</a >
34
+
35
+
36
+
Original file line number Diff line number Diff line change
1
+ (* * Test *)
2
+
3
+ (* * {1 Section 1} *)
4
+
5
+ type t
6
+
7
+ (* * {1 Section 2} *)
8
+
9
+ type u
10
+
Original file line number Diff line number Diff line change
1
+ val v : Test .t
2
+
3
+
You can’t perform that action at this time.
0 commit comments