File tree 7 files changed +45
-21
lines changed
7 files changed +45
-21
lines changed Original file line number Diff line number Diff line change
1
+ Unreleased
2
+ ----------
3
+
4
+ Bugs fixed
5
+ - Man page renderer fails to output pages that have children (@jonludlam , @Julow , #766 )
6
+
1
7
2.0.0
2
8
-----
3
9
Breaking changes
Original file line number Diff line number Diff line change @@ -179,17 +179,18 @@ module Path = struct
179
179
inner None l
180
180
181
181
let split :
182
- is_dir :(kind -> bool ) ->
182
+ is_dir :(kind -> [ `Always | `Never | `IfNotLast ] ) ->
183
183
(kind * string ) list ->
184
184
(kind * string ) list * (kind * string ) list =
185
185
fun ~is_dir l ->
186
- let rec inner = function
187
- | ((kind , _ ) as x ) :: xs when is_dir kind ->
188
- let dirs, files = inner xs in
189
- (x :: dirs, files)
190
- | xs -> ([] , xs)
186
+ let rec inner dirs = function
187
+ | [ ((kind, _) as x) ] when is_dir kind = `IfNotLast ->
188
+ (List. rev dirs, [ x ])
189
+ | ((kind , _ ) as x ) :: xs when is_dir kind <> `Never ->
190
+ inner (x :: dirs) xs
191
+ | xs -> (List. rev dirs, xs)
191
192
in
192
- inner l
193
+ inner [] l
193
194
end
194
195
195
196
module Anchor = struct
Original file line number Diff line number Diff line change @@ -38,9 +38,18 @@ module Path : sig
38
38
val of_list : (kind * string ) list -> t option
39
39
40
40
val split :
41
- is_dir :(kind -> bool ) ->
41
+ is_dir :(kind -> [ `Always | `Never | `IfNotLast ] ) ->
42
42
(kind * string ) list ->
43
43
(kind * string ) list * (kind * string ) list
44
+ (* * [split is_dir path] splits the list [path] into a directory
45
+ and filename, based on the [is_dir] function. The function
46
+ [is_dir] should return whether or not the path element [kind]
47
+ should be a directory or not. If the function [is_dir] returns
48
+ [`IfNotLast] then the element will be a directory only if it
49
+ is not the last element in the path. The return value is a tuple
50
+ of directory-type elements and filename-type elements. If the
51
+ [is_dir] function can return [`Always], the caller must be prepared
52
+ to handle the case where the filename part is empty. *)
44
53
end
45
54
46
55
module Anchor : sig
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ module Path = struct
16
16
let get_dir_and_file url =
17
17
let l = Url.Path. to_list url in
18
18
let is_dir =
19
- if ! flat then function `Page -> true | _ -> false
20
- else function `LeafPage -> false | `File -> false | _ -> true
19
+ if ! flat then function `Page -> `Always | _ -> `Never
20
+ else function `LeafPage -> `Never | `File -> `Never | _ -> `Always
21
21
in
22
22
let dir, file = Url.Path. split ~is_dir l in
23
23
let dir = List. map segment_to_string dir in
Original file line number Diff line number Diff line change @@ -42,18 +42,11 @@ module Link = struct
42
42
let get_dir_and_file url =
43
43
let open Odoc_document in
44
44
let l = Url.Path. to_list url in
45
- let is_dir = function `Page -> true | _ -> false in
45
+ let is_dir = function `Page -> `IfNotLast | _ -> `Never in
46
46
let dir, file = Url.Path. split ~is_dir l in
47
47
let segment_to_string (_kind , name ) = name in
48
- let dir = List. map segment_to_string dir in
49
- match (dir, file) with
50
- | [] , [] -> assert false
51
- | dir , [] ->
52
- let rev_dir = List. rev dir in
53
- let file' = List. hd rev_dir in
54
- let dir' = List. tl rev_dir |> List. rev in
55
- (dir', file')
56
- | _ , xs -> (dir, String. concat " ." (List. map segment_to_string xs))
48
+ ( List. map segment_to_string dir,
49
+ String. concat " ." (List. map segment_to_string file) )
57
50
58
51
let filename url =
59
52
let dir, file = get_dir_and_file url in
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ let segment_to_string (kind, name) =
10
10
let as_filename (url : Url.Path.t ) =
11
11
let components = Url.Path. to_list url in
12
12
let dir, path =
13
- Url.Path. split ~is_dir: (function `Page -> true | _ -> false ) components
13
+ Url.Path. split
14
+ ~is_dir: (function `Page -> `IfNotLast | _ -> `Never )
15
+ components
14
16
in
15
17
let dir = List. map segment_to_string dir in
16
18
let path = String. concat " ." (List. map segment_to_string path) in
Original file line number Diff line number Diff line change @@ -34,3 +34,16 @@ file 'package.mld' should be written to the file 'package/index.html'.
34
34
$ find html -type f | sort
35
35
html/package/Test/index .html
36
36
html/package/index .html
37
+
38
+ Let' s make sure the manpage and latex renderers work too
39
+
40
+ $ for i in *.odocl; do odoc man-generate $i -o man; odoc latex-generate $i -o latex; done
41
+
42
+ $ find man -type f | sort
43
+ man/package.3o
44
+ man/package/Test.3o
45
+
46
+ $ find latex -type f | sort
47
+ latex/package.tex
48
+ latex/package/Test.tex
49
+
You can’t perform that action at this time.
0 commit comments