this repo has no description
at main 233 lines 5.1 kB view raw
1type style = [ `Bold | `Italic | `Emphasis | `Superscript | `Subscript ] 2 3module rec Class : sig 4 type t = string list 5end = 6 Class 7 8and Link : sig 9 type t = { target : Target.t; content : Inline.t; tooltip : string option } 10end = 11 Link 12 13and Target : sig 14 type internal = Resolved of Url.t | Unresolved 15 16 type href = string 17 18 type t = Internal of internal | External of href 19end = 20 Target 21 22and Raw_markup : sig 23 type target = Odoc_model.Comment.raw_markup_target 24 25 and t = target * string 26end = 27 Raw_markup 28 29and Source : sig 30 type t = token list 31 32 and tag = string option 33 34 and token = Elt of Inline.t | Tag of tag * t 35end = 36 Source 37 38and Math : sig 39 type t = string 40end = 41 Math 42 43and Inline : sig 44 type entity = string 45 46 type t = one list 47 48 and one = { attr : Class.t; desc : desc } 49 50 and desc = 51 | Text of string 52 | Entity of entity 53 | Linebreak 54 | Styled of style * t 55 | Link of Link.t 56 | Source of Source.t 57 | Math of Math.t 58 | Raw_markup of Raw_markup.t 59end = 60 Inline 61 62and Description : sig 63 type one = { attr : Class.t; key : Inline.t; definition : Block.t } 64 65 type t = one list 66end = 67 Description 68 69and Heading : sig 70 type t = { 71 label : string option; 72 level : int; 73 title : Inline.t; 74 source_anchor : Url.t option; 75 (** Used for the source link of the item displayed on the page. *) 76 } 77end = 78 Heading 79 80and Block : sig 81 type lang_tag = string 82 83 type t = one list 84 85 and one = { attr : Class.t; desc : desc } 86 87 and desc = 88 | Inline of Inline.t 89 | Paragraph of Inline.t 90 | List of list_type * t list 91 | Description of Description.t 92 | Source of lang_tag * string list * (string * string) list * Source.t * t 93 | Math of Math.t 94 | Verbatim of string 95 | Raw_markup of Raw_markup.t 96 | Table of t Table.t 97 | Image of Target.t * string 98 | Video of Target.t * string 99 | Audio of Target.t * string 100 101 and list_type = Ordered | Unordered 102end = 103 Block 104 105and Table : sig 106 type alignment = Left | Center | Right | Default 107 108 type 'a t = { 109 data : ('a * [ `Header | `Data ]) list list; 110 align : alignment list; 111 } 112end = 113 Table 114 115and DocumentedSrc : sig 116 type 'a documented = { 117 attrs : Class.t; 118 anchor : Url.Anchor.t option; 119 code : 'a; 120 doc : Block.t; 121 markers : string * string; 122 } 123 124 type t = one list 125 126 and one = 127 | Code of Source.t 128 | Documented of Inline.t documented 129 | Nested of t documented 130 | Subpage of Subpage.t 131 | Alternative of Alternative.t 132end = 133 DocumentedSrc 134 135and Alternative : sig 136 type expansion = { 137 status : [ `Inline | `Open | `Closed | `Default ]; 138 summary : Source.t; 139 expansion : DocumentedSrc.t; 140 url : Url.Path.t; 141 } 142 143 type t = Expansion of expansion 144end = 145 Alternative 146 147and Subpage : sig 148 type status = [ `Inline | `Open | `Closed | `Default ] 149 150 type t = { status : status; content : Page.t } 151end = 152 Subpage 153 154and Include : sig 155 type status = [ `Inline | `Open | `Closed | `Default ] 156 157 type t = { status : status; content : Item.t list; summary : Source.t } 158end = 159 Include 160 161and Item : sig 162 type 'a item = { 163 attr : Class.t; 164 anchor : Url.Anchor.t option; 165 content : 'a; 166 doc : Block.t; 167 source_anchor : Url.Anchor.t option; 168 } 169 170 type text = Block.t 171 172 type t = 173 | Text of text 174 | Heading of Heading.t 175 | Declaration of DocumentedSrc.t item 176 | Include of Include.t item 177end = 178 Item 179 180and Page : sig 181 type t = { 182 preamble : Item.t list; 183 items : Item.t list; 184 url : Url.Path.t; 185 source_anchor : Url.t option; 186 (** Url to the corresponding source code. Might be a whole source file 187 or a sub part. *) 188 resources : Odoc_extension_registry.resource list; 189 (** Resources (JS/CSS) to inject into the page, collected from extensions. *) 190 assets : Odoc_extension_registry.asset list; 191 (** Binary assets to write alongside this page's HTML output. *) 192 } 193end = 194 Page 195 196and Source_page : sig 197 type target = { 198 documentation : Url.Anchor.t option; 199 implementation : Url.Anchor.t option; 200 } 201 type info = Syntax of string | Anchor of string | Link of target 202 203 type code = span list 204 and span = Tagged_code of info * code | Plain_code of string 205 206 type t = { url : Url.Path.t; contents : code } 207end = 208 Source_page 209 210(** Resources that extensions can inject into pages (HTML only) *) 211module Resource = struct 212 type t = 213 | Js_url of string (** External JavaScript: <script src="..."> *) 214 | Css_url of string (** External CSS: <link rel="stylesheet" href="..."> *) 215 | Js_inline of string (** Inline JavaScript: <script>...</script> *) 216 | Css_inline of string (** Inline CSS: <style>...</style> *) 217 218 let equal a b = 219 match (a, b) with 220 | Js_url a, Js_url b -> String.equal a b 221 | Css_url a, Css_url b -> String.equal a b 222 | Js_inline a, Js_inline b -> String.equal a b 223 | Css_inline a, Css_inline b -> String.equal a b 224 | _ -> false 225end 226 227module Document = struct 228 type t = Page of Page.t | Source_page of Source_page.t 229end 230 231let inline ?(attr = []) desc = Inline.{ attr; desc } 232 233let block ?(attr = []) desc = Block.{ attr; desc }