this repo has no description
at main 64 lines 2.2 kB view raw
1(* Page shell interface for pluggable HTML page assembly. 2 3 A shell controls the overall page structure: the <head> contents, 4 the <body> layout, and how pre-rendered HTML fragments are arranged 5 into a complete page. *) 6 7module Html := Tyxml.Html 8 9(** Data for assembling a documentation page. All HTML fragments are 10 pre-rendered by the generator. *) 11type page_data = { 12 url : Odoc_document.Url.Path.t; 13 header : Html_types.flow5_without_header_footer Html.elt list; 14 preamble : Html_types.flow5_without_header_footer Html.elt list; 15 content : Html_types.div_content Html.elt list; 16 breadcrumbs : Types.breadcrumbs; 17 toc : Types.toc list; 18 sidebar : Html_types.div_content Html.elt list option; 19 sidebar_data : Odoc_document.Sidebar.t option; 20 uses_katex : bool; 21 source_anchor : string option; 22 resources : Odoc_extension_registry.resource list; 23 assets : Odoc_extension_registry.asset list; 24 children : Odoc_document.Renderer.page list; 25} 26 27(** Data for assembling a source code page. *) 28type src_page_data = { 29 url : Odoc_document.Url.Path.t; 30 header : Html_types.flow5_without_header_footer Html.elt list; 31 breadcrumbs : Types.breadcrumbs; 32 sidebar : Html_types.div_content Html.elt list option; 33 sidebar_data : Odoc_document.Sidebar.t option; 34 title : string; 35 content : Html_types.div_content Html.elt list; 36} 37 38(** The interface that a page shell must implement. *) 39module type S = sig 40 val name : string 41 (** Short identifier for CLI selection, e.g. "default" or "json". *) 42 43 val make : 44 config:Config.t -> page_data -> Odoc_document.Renderer.page 45 (** Assemble a documentation page from pre-rendered fragments. *) 46 47 val make_src : 48 config:Config.t -> src_page_data -> Odoc_document.Renderer.page 49 (** Assemble a source code page from pre-rendered fragments. *) 50end 51 52(** {1 Shell Registry} *) 53 54val register : (module S) -> unit 55(** Register a shell. Shells are identified by name. *) 56 57val find : string -> (module S) option 58(** Look up a shell by name. *) 59 60val list_shells : unit -> string list 61(** List all registered shell names. *) 62 63val default : unit -> (module S) 64(** Return the default shell ("default"). Raises if no default is registered. *)