Skip to content

Instantly share code, notes, and snippets.

@ngzhian
Created July 12, 2017 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngzhian/02bfc668e52074a86ae451501ce9b95a to your computer and use it in GitHub Desktop.
Save ngzhian/02bfc668e52074a86ae451501ce9b95a to your computer and use it in GitHub Desktop.
ocamldoc ml
ocamlc -I +ocamldoc -c tg.ml && ocamldoc -g tg.cmo test.ml
module Generator (G : Odoc_gen.Base) =
struct
class generator =
object(self)
inherit G.generator as generator
method generate module_list =
(* let _ = Odoc_info.dump_modules "modump" in *)
(* let mtds = Odoc_info.Search.methods module_list in *)
let vals = Odoc_info.Search.values module_list in
(* Printf.printf "%s\n" (String.concat "\n" (List.map (fun (t : Odoc_value.t_value) -> t.val_name) vals)); *)
List.iter (fun (t : Odoc_value.t_value) ->
match t.val_code with
| None -> ()
(* | Some c -> Printf.printf "%s\n" c; *)
| Some c -> Printf.printf "%s\n" "c";
Printf.printf "\n\n";
(* Printf.printf "%s\n" (Odoc_info.string_of_value t); *)
) vals;
()
end
end;;
let _ = Odoc_args.extend_base_generator (module Generator : Odoc_gen.Base_functor);;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment