diff --git a/ocamldoc/odoc_args.ml b/ocamldoc/odoc_args.ml index be5ce12..5efd6ce 100644 --- a/ocamldoc/odoc_args.ml +++ b/ocamldoc/odoc_args.ml @@ -295,6 +295,7 @@ let default_options = [ "-man-mini", Arg.Set Odoc_man.man_mini, M.man_mini ; "-man-suffix", Arg.String (fun s -> Odoc_man.man_suffix := s), M.man_suffix ; "-man-section", Arg.String (fun s -> Odoc_man.man_section := s), M.man_section ; + "-man-date", Arg.String (fun s -> Odoc_man.man_date := s), M.man_date ; ] diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml index 7e01f8d..05c1f46 100644 --- a/ocamldoc/odoc_man.ml +++ b/ocamldoc/odoc_man.ml @@ -22,6 +22,7 @@ open Search let man_suffix = ref Odoc_messages.default_man_suffix let man_section = ref Odoc_messages.default_man_section +let man_date = ref (Odoc_misc.string_of_date ~hour: false (Unix.time ())) let man_mini = ref false @@ -720,14 +721,13 @@ class man = (** Generate the man page for the given class.*) method generate_for_class cl = Odoc_info.reset_type_names () ; - let date = Unix.time () in let file = self#file_name cl.cl_name in try let chanout = self#open_out file in let b = new_buf () in bs b (".TH \""^cl.cl_name^"\" "); bs b !man_section ; - bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); + bs b (" "^(!man_date)^" "); bs b "OCamldoc "; bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); @@ -779,14 +779,13 @@ class man = (** Generate the man page for the given class type.*) method generate_for_class_type ct = Odoc_info.reset_type_names () ; - let date = Unix.time () in let file = self#file_name ct.clt_name in try let chanout = self#open_out file in let b = new_buf () in bs b (".TH \""^ct.clt_name^"\" "); bs b !man_section ; - bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); + bs b (" "^(!man_date)^" "); bs b "OCamldoc "; bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); @@ -836,14 +835,13 @@ class man = (** Generate the man file for the given module type. @raise Failure if an error occurs.*) method generate_for_module_type mt = - let date = Unix.time () in let file = self#file_name mt.mt_name in try let chanout = self#open_out file in let b = new_buf () in bs b (".TH \""^mt.mt_name^"\" "); bs b !man_section ; - bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); + bs b (" "^(!man_date)^" "); bs b "OCamldoc "; bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); @@ -914,14 +912,13 @@ class man = (** Generate the man file for the given module. @raise Failure if an error occurs.*) method generate_for_module m = - let date = Unix.time () in let file = self#file_name m.m_name in try let chanout = self#open_out file in let b = new_buf () in bs b (".TH \""^m.m_name^"\" "); bs b !man_section ; - bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); + bs b (" "^(!man_date)^" "); bs b "OCamldoc "; bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); @@ -1045,14 +1042,13 @@ class man = | Res_const (_,f) -> f.vc_name ) in - let date = Unix.time () in let file = self#file_name name in try let chanout = self#open_out file in let b = new_buf () in bs b (".TH \""^name^"\" "); bs b !man_section ; - bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); + bs b (" "^(!man_date)^" "); bs b "OCamldoc "; bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); bs b ".SH NAME\n"; diff --git a/ocamldoc/odoc_messages.ml b/ocamldoc/odoc_messages.ml index 2d6327b..7ab6ddc 100644 --- a/ocamldoc/odoc_messages.ml +++ b/ocamldoc/odoc_messages.ml @@ -95,6 +95,8 @@ let man_mini = "\tGenerate man pages only for modules, module types, classes\n"^ let default_man_section = "3" let man_section = "
\n\t\tUse
in man page files "^ "(default is "^default_man_section^") "^man_only^"\n" +let man_date = "\n\t\tUse in man page files "^ + "(default is today's date in YYYY-MM-DD format)"^man_only^"\n" let default_man_suffix = default_man_section^"o" let man_suffix = "\n\t\tUse for man page files "^