@@ -36,35 +36,38 @@ let warn_root_canonical location =
36
36
Error. raise_warning
37
37
@@ Error. make " Canonical paths must contain a dot, eg. X.Y." location
38
38
39
- let rec find_tag f = function
39
+ let rec find_tag ~ filter = function
40
40
| [] -> None
41
41
| hd :: tl -> (
42
- match f hd.Location. value with
42
+ match filter hd.Location. value with
43
43
| Some x -> Some (x, hd.location)
44
44
| None ->
45
45
warn_unexpected_tag hd;
46
- find_tag f tl)
46
+ find_tag ~filter tl)
47
47
48
- let rec find_tags acc f = function
48
+ let rec find_tags acc ~ filter = function
49
49
| [] -> List. rev acc
50
50
| hd :: tl -> (
51
- match f hd.Location. value with
52
- | Some x -> find_tags ((x, hd.location) :: acc) f tl
51
+ match filter hd.Location. value with
52
+ | Some x -> find_tags ((x, hd.location) :: acc) ~filter tl
53
53
| None ->
54
54
warn_unexpected_tag hd;
55
- find_tags acc f tl)
55
+ find_tags acc ~filter tl)
56
56
57
57
let handle_internal_tags (type a ) tags : a handle_internal_tags -> a = function
58
58
| Expect_status -> (
59
59
match
60
60
find_tag
61
- (function (`Inline | `Open | `Closed ) as t -> Some t | _ -> None )
61
+ ~filter: (function
62
+ | (`Inline | `Open | `Closed ) as t -> Some t | _ -> None )
62
63
tags
63
64
with
64
65
| Some (status , _ ) -> status
65
66
| None -> `Default )
66
67
| Expect_canonical -> (
67
- match find_tag (function `Canonical p -> Some p | _ -> None ) tags with
68
+ match
69
+ find_tag ~filter: (function `Canonical p -> Some p | _ -> None ) tags
70
+ with
68
71
| Some (`Root _ , location ) ->
69
72
warn_root_canonical location;
70
73
None
@@ -73,7 +76,7 @@ let handle_internal_tags (type a) tags : a handle_internal_tags -> a = function
73
76
| Expect_page_tags ->
74
77
let unparsed_lines =
75
78
find_tags []
76
- (function `Children_order _ as p -> Some p | _ -> None )
79
+ ~filter: (function `Children_order _ as p -> Some p | _ -> None )
77
80
tags
78
81
in
79
82
let lines =
@@ -90,7 +93,7 @@ let handle_internal_tags (type a) tags : a handle_internal_tags -> a = function
90
93
Frontmatter. of_lines lines |> Error. raise_warnings
91
94
| Expect_none ->
92
95
(* Will raise warnings. *)
93
- ignore (find_tag (fun _ -> None ) tags);
96
+ ignore (find_tag ~filter: (fun _ -> None ) tags);
94
97
()
95
98
96
99
(* Errors *)
0 commit comments