summaryrefslogtreecommitdiff
path: root/ocamldoc/odoc_man.ml
diff options
context:
space:
mode:
authorJules Aguillon <jules@j3s.fr>2022-02-16 18:21:19 +0100
committerJules Aguillon <jules@j3s.fr>2022-02-22 17:40:44 +0100
commit8bb4540c32895114c7a5fd091b1e520652648161 (patch)
treec14b5aeffa8efaa531ca1303206406236882d24e /ocamldoc/odoc_man.ml
parent8ad72f7a5f476bb2d5797432c63240205f7cb154 (diff)
downloadocaml-8bb4540c32895114c7a5fd091b1e520652648161.tar.gz
ocamldoc: Support alerts in other backends
And render a '.' after the alert name. This is how the deprecated tag is rendered. We expect a sentence in the payload.
Diffstat (limited to 'ocamldoc/odoc_man.ml')
-rw-r--r--ocamldoc/odoc_man.ml22
1 files changed, 20 insertions, 2 deletions
diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml
index d2da071c7e..49364bc6ec 100644
--- a/ocamldoc/odoc_man.ml
+++ b/ocamldoc/odoc_man.ml
@@ -193,6 +193,23 @@ class virtual info =
)
[] l
+ method str_man_of_alerts l =
+ List.map (fun al ->
+ let b = Buffer.create 256 in
+ bs b ".B ";
+ bs b Odoc_messages.alert;
+ bs b " ";
+ bs b al.alert_name;
+ bs b ".\n";
+ (match al.alert_payload with
+ | None -> ()
+ | Some p ->
+ bs b p;
+ bs b "\n"
+ );
+ Buffer.contents b
+ ) l
+
(** Print the groff string to display an optional info structure. *)
method man_of_info ?margin:(_ :int option) b info_opt =
match info_opt with
@@ -227,8 +244,9 @@ class virtual info =
self#str_man_of_raised_exceptions info.M.i_raised_exceptions;
self#str_man_of_return_opt info.M.i_return_value;
self#str_man_of_sees info.M.i_sees;
- ] @
- (self#str_man_of_custom info.M.i_custom)
+ ]
+ @ self#str_man_of_custom info.M.i_custom
+ @ self#str_man_of_alerts info.M.i_alerts
in
let l = List.filter ((<>) "") l in
Buffer.add_string b (String.concat "\n.sp\n" l)