this repo has no description
at main 44 lines 1.1 kB view raw
1(** Standard definition and types for all renderers *) 2 3type syntax = OCaml | Reason 4 5let string_of_syntax = function OCaml -> "ml" | Reason -> "re" 6 7type page = { 8 filename : Fpath.t; 9 path : Url.Path.t; 10 content : Format.formatter -> unit; 11 children : page list; 12 assets : Odoc_extension_registry.asset list; 13 (** Binary assets to write alongside this page *) 14} 15 16let traverse ~f t = 17 let rec aux node = 18 f node.filename node.content node.assets; 19 List.iter aux node.children 20 in 21 List.iter aux t 22 23type input = 24 | CU of Odoc_model.Lang.Compilation_unit.t 25 | Page of Odoc_model.Lang.Page.t 26 27type 'a t = { 28 name : string; 29 render : 'a -> Sidebar.t option -> Types.Document.t -> page list; 30 filepath : 'a -> Url.Path.t -> Fpath.t; 31} 32 33let document_of_page ~syntax v = 34 match syntax with Reason -> Reason.page v | OCaml -> ML.page v 35 36let documents_of_implementation ~syntax v = 37 match syntax with 38 | Reason -> Reason.implementation v 39 | OCaml -> ML.implementation v 40 41let document_of_compilation_unit ~syntax v = 42 match syntax with 43 | Reason -> Reason.compilation_unit v 44 | OCaml -> ML.compilation_unit v