diff --git a/src/html/generator.ml b/src/html/generator.ml index e099813c12..d9dff60a73 100644 --- a/src/html/generator.ml +++ b/src/html/generator.ml @@ -33,11 +33,12 @@ let mk_anchor_link id = let mk_anchor anchor = match anchor with - | None -> ([], []) + | None -> ([], [], []) | Some { Odoc_document.Url.Anchor.anchor; _ } -> let link = mk_anchor_link anchor in - let attrib = [ Html.a_id anchor; Html.a_class [ "anchored" ] ] in - (attrib, link) + let extra_attr = [ Html.a_id anchor ] in + let extra_class = [ "anchored" ] in + (extra_attr, extra_class, link) let class_ (l : Class.t) = if l = [] then [] else [ Html.a_class l ] @@ -204,7 +205,7 @@ let div : ([< Html_types.div_attrib ], [< item ], [> Html_types.div ]) Html.star = Html.Unsafe.node "div" -let spec_class = function [] -> [] | attr -> class_ ("spec" :: attr) +let spec_class attr = class_ ("spec" :: attr) let spec_doc_div ~resolve = function | [] -> [] @@ -250,28 +251,22 @@ let rec documentedSrc ~resolve (t : DocumentedSrc.t) : item Html.elt list = | [] -> [] | doc -> let opening, closing = markers in + let delim s = + [ Html.span ~a:(class_ [ "comment-delim" ]) [ Html.txt s ] ] + in [ - Html.td + Html.div ~a:(class_ [ "def-doc" ]) - (Html.span - ~a:(class_ [ "comment-delim" ]) - [ Html.txt opening ] - :: block ~resolve doc - @ [ - Html.span - ~a:(class_ [ "comment-delim" ]) - [ Html.txt closing ]; - ]); + (delim opening @ block ~resolve doc @ delim closing); ] in - let a, link = mk_anchor anchor in - let content = - let c = link @ content in - Html.td ~a:(class_ attrs) (c :> any Html.elt list) - in - Html.tr ~a (content :: doc) + let extra_attr, extra_class, link = mk_anchor anchor in + let content = (content :> any Html.elt list) in + Html.li + ~a:(extra_attr @ class_ (attrs @ extra_class)) + (link @ content @ doc) in - Html.table (List.map one l) :: to_html rest + Html.ol (List.map one l) :: to_html rest in to_html t @@ -307,8 +302,8 @@ and items ~resolve l : item Html.elt list = let details ~open' = let open' = if open' then [ Html.a_open () ] else [] in let summary = - let anchor_attrib, anchor_link = mk_anchor anchor in - let a = spec_class attr @ anchor_attrib in + let extra_attr, extra_class, anchor_link = mk_anchor anchor in + let a = spec_class (attr @ extra_class) @ extra_attr in Html.summary ~a @@ anchor_link @ source (inline ~resolve) summary in [ Html.details ~a:open' summary included_html ] @@ -322,8 +317,8 @@ and items ~resolve l : item Html.elt list = let inc = [ Html.div ~a:[ Html.a_class a_class ] (doc @ content) ] in (continue_with [@tailcall]) rest inc | Declaration { Item.attr; anchor; content; doc } :: rest -> - let anchor_attrib, anchor_link = mk_anchor anchor in - let a = spec_class attr @ anchor_attrib in + let extra_attr, extra_class, anchor_link = mk_anchor anchor in + let a = spec_class (attr @ extra_class) @ extra_attr in let content = anchor_link @ documentedSrc ~resolve content in let spec = let doc = spec_doc_div ~resolve doc in diff --git a/src/odoc/etc/odoc.css b/src/odoc/etc/odoc.css index 9bf2267d6e..4cbbfffcbd 100644 --- a/src/odoc/etc/odoc.css +++ b/src/odoc/etc/odoc.css @@ -419,8 +419,8 @@ pre code { padding: 0.35em 0.5em; } -.def-doc { - margin-bottom: 10px; +li:not(:last-child) > .def-doc { + margin-bottom: 15px; } /* Spacing between items */ @@ -428,19 +428,34 @@ div.odoc-spec,.odoc-include { margin-bottom: 2em; } -.spec.type .variant { +.spec.type .variant p, .spec.type .record p { + margin: 5px; +} + +.spec.type .variant, .spec.type .record { margin-left: 2ch; + list-style: none; + display: flex; + flex-wrap: wrap; + row-gap: 4px; } -.spec.type .variant p { - margin: 0; - font-style: italic; + +.spec.type .record > code, .spec.type .variant > code { + min-width: 40%; } -.spec.type .record { - margin-left: 2ch; + +.spec.type > ol { + margin-top: 0; + margin-bottom: 0; } -.spec.type .record p { - margin: 0; - font-style: italic; + +.spec.type .record > .def-doc, .spec.type .variant > .def-doc { + min-width:50%; + padding-left: 22px; + margin-left: 10%; + border-radius: 3px; + flex-grow:1; + border-left: 0.1em solid var(--spec-summary-border-color); } div.def { @@ -449,11 +464,6 @@ div.def { padding-left: 2ex; } -div.def+div.def-doc { - margin-left: 1ex; - margin-top: 2.5px -} - div.def-doc>*:first-child { margin-top: 0; } diff --git a/test/generators/html/Alias-X.html b/test/generators/html/Alias-X.html index 16211f07b0..d66a1eefbd 100644 --- a/test/generators/html/Alias-X.html +++ b/test/generators/html/Alias-X.html @@ -15,7 +15,7 @@
Alias.Xtype t
= int
diff --git a/test/generators/html/Alias.html b/test/generators/html/Alias.html
index 8b1900a638..12b4b96368 100644
--- a/test/generators/html/Alias.html
+++ b/test/generators/html/Alias.html
@@ -12,7 +12,7 @@ Module Alias
-
+
module X
diff --git a/test/generators/html/Bugs.html b/test/generators/html/Bugs.html
index dc716de80f..f17228f347 100644
--- a/test/generators/html/Bugs.html
+++ b/test/generators/html/Bugs.html
@@ -12,7 +12,7 @@ Module Bugs
-
-
+
val foo :
diff --git a/test/generators/html/Bugs_post_406.html b/test/generators/html/Bugs_post_406.html
index 73ca532ec8..682bb9bcd9 100644
--- a/test/generators/html/Bugs_post_406.html
+++ b/test/generators/html/Bugs_post_406.html
@@ -16,7 +16,7 @@ Module Bugs_post_406
-
-
+
class
let_open'
diff --git a/test/generators/html/Bugs_pre_410.html b/test/generators/html/Bugs_pre_410.html
index 5078379897..091e0caebd 100644
--- a/test/generators/html/Bugs_pre_410.html
+++ b/test/generators/html/Bugs_pre_410.html
@@ -13,7 +13,7 @@ Module Bugs_pre_410
-
-
+
val foo' :
diff --git a/test/generators/html/Class.html b/test/generators/html/Class.html
index 99af51a5bc..b76484dba5 100644
--- a/test/generators/html/Class.html
+++ b/test/generators/html/Class.html
@@ -12,7 +12,7 @@ Module Class
-
-
-
-
+
class
mutually'
@@ -62,7 +62,7 @@ Module Class
-
+
class
recursive'
@@ -71,8 +71,8 @@ Module Class
-
-
-
-
+
class 'a
polymorphic'
diff --git a/test/generators/html/External.html b/test/generators/html/External.html
index bda7395d2f..6a6d1bd6e2 100644
--- a/test/generators/html/External.html
+++ b/test/generators/html/External.html
@@ -13,7 +13,7 @@ Module External
-
+
val foo :
diff --git a/test/generators/html/Functor-F1-argument-1-Arg.html b/test/generators/html/Functor-F1-argument-1-Arg.html
index 6f1fdddf7b..61ff7b2c10 100644
--- a/test/generators/html/Functor-F1-argument-1-Arg.html
+++ b/test/generators/html/Functor-F1-argument-1-Arg.html
@@ -17,7 +17,7 @@ Parameter F1.1-Arg
-
+
diff --git a/test/generators/html/Functor-F1.html b/test/generators/html/Functor-F1.html
index 4374fabfa6..94d2fd210c 100644
--- a/test/generators/html/Functor-F1.html
+++ b/test/generators/html/Functor-F1.html
@@ -22,7 +22,7 @@ Module Functor.F1
Parameters
-
+
module
Arg
@@ -32,7 +32,7 @@ Parameters
Signature
-
+
diff --git a/test/generators/html/Functor-F2-argument-1-Arg.html b/test/generators/html/Functor-F2-argument-1-Arg.html
index 566fbde26a..f9ad727c70 100644
--- a/test/generators/html/Functor-F2-argument-1-Arg.html
+++ b/test/generators/html/Functor-F2-argument-1-Arg.html
@@ -17,7 +17,7 @@ Parameter F2.1-Arg
-
+
diff --git a/test/generators/html/Functor-F2.html b/test/generators/html/Functor-F2.html
index 8569659e87..0aaa72fc94 100644
--- a/test/generators/html/Functor-F2.html
+++ b/test/generators/html/Functor-F2.html
@@ -22,7 +22,7 @@ Module Functor.F2
Parameters
-
+
module
Arg
@@ -32,7 +32,7 @@ Parameters
Signature
-
+
type t
= Arg.t
diff --git a/test/generators/html/Functor-F3-argument-1-Arg.html b/test/generators/html/Functor-F3-argument-1-Arg.html
index ae9df67c95..04e9b90bc2 100644
--- a/test/generators/html/Functor-F3-argument-1-Arg.html
+++ b/test/generators/html/Functor-F3-argument-1-Arg.html
@@ -17,7 +17,7 @@ Parameter F3.1-Arg
-
+
diff --git a/test/generators/html/Functor-F3.html b/test/generators/html/Functor-F3.html
index eb8fa26a51..f3e65eb200 100644
--- a/test/generators/html/Functor-F3.html
+++ b/test/generators/html/Functor-F3.html
@@ -22,7 +22,7 @@ Module Functor.F3
Parameters
-
+
module
Arg
@@ -32,7 +32,7 @@ Parameters
Signature
-
+
type t
= Arg.t
diff --git a/test/generators/html/Functor-F4-argument-1-Arg.html b/test/generators/html/Functor-F4-argument-1-Arg.html
index 06bbe6c3d9..016324ce3d 100644
--- a/test/generators/html/Functor-F4-argument-1-Arg.html
+++ b/test/generators/html/Functor-F4-argument-1-Arg.html
@@ -17,7 +17,7 @@ Parameter F4.1-Arg
-
+
diff --git a/test/generators/html/Functor-F4.html b/test/generators/html/Functor-F4.html
index fa74de1950..fbbb68ace5 100644
--- a/test/generators/html/Functor-F4.html
+++ b/test/generators/html/Functor-F4.html
@@ -22,7 +22,7 @@ Module Functor.F4
Parameters
-
+
module
Arg
@@ -32,7 +32,7 @@ Parameters
Signature
-
+
diff --git a/test/generators/html/Functor-F5.html b/test/generators/html/Functor-F5.html
index b476e8e7c7..779b851dc2 100644
--- a/test/generators/html/Functor-F5.html
+++ b/test/generators/html/Functor-F5.html
@@ -23,7 +23,7 @@ Parameters
Signature
-
+
diff --git a/test/generators/html/Functor-module-type-S.html b/test/generators/html/Functor-module-type-S.html
index c7ae05228e..e904fd4589 100644
--- a/test/generators/html/Functor-module-type-S.html
+++ b/test/generators/html/Functor-module-type-S.html
@@ -15,7 +15,7 @@ Module type Functor.S
-
+
diff --git a/test/generators/html/Functor-module-type-S1-argument-1-_.html b/test/generators/html/Functor-module-type-S1-argument-1-_.html
index ef0e8cd037..2926155df1 100644
--- a/test/generators/html/Functor-module-type-S1-argument-1-_.html
+++ b/test/generators/html/Functor-module-type-S1-argument-1-_.html
@@ -17,7 +17,7 @@ Parameter S1.1-_
-
+
diff --git a/test/generators/html/Functor-module-type-S1.html b/test/generators/html/Functor-module-type-S1.html
index 7564aaee5b..c6ff6b11c9 100644
--- a/test/generators/html/Functor-module-type-S1.html
+++ b/test/generators/html/Functor-module-type-S1.html
@@ -22,7 +22,7 @@ Module type Functor.S1
Parameters
-
+
module
_
@@ -32,7 +32,7 @@ Parameters
Signature
-
+
diff --git a/test/generators/html/Functor.html b/test/generators/html/Functor.html
index 6ec1ff4001..06a1738ff5 100644
--- a/test/generators/html/Functor.html
+++ b/test/generators/html/Functor.html
@@ -13,7 +13,7 @@ Module Functor
-
-
-
-
-
-
-
+
module
diff --git a/test/generators/html/Functor2-X-argument-1-Y.html b/test/generators/html/Functor2-X-argument-1-Y.html
index 7c5a10e847..bef2e0eeb5 100644
--- a/test/generators/html/Functor2-X-argument-1-Y.html
+++ b/test/generators/html/Functor2-X-argument-1-Y.html
@@ -17,7 +17,7 @@ Parameter X.1-Y
-
+
diff --git a/test/generators/html/Functor2-X-argument-2-Z.html b/test/generators/html/Functor2-X-argument-2-Z.html
index 34503908cf..a4bb38497f 100644
--- a/test/generators/html/Functor2-X-argument-2-Z.html
+++ b/test/generators/html/Functor2-X-argument-2-Z.html
@@ -17,7 +17,7 @@ Parameter X.2-Z
-
+
diff --git a/test/generators/html/Functor2-X.html b/test/generators/html/Functor2-X.html
index 01e7a1aa23..d979923192 100644
--- a/test/generators/html/Functor2-X.html
+++ b/test/generators/html/Functor2-X.html
@@ -22,7 +22,7 @@ Module Functor2.X
Parameters
-
+
module
Y
@@ -31,7 +31,7 @@ Parameters
-
+
module
Z
@@ -41,7 +41,7 @@ Parameters
Signature
-
+
type y_t
= Y.t
@@ -49,7 +49,7 @@ Signature
-
+
type z_t
= Z.t
@@ -57,7 +57,7 @@ Signature
-
+
type x_t
= y_t
diff --git a/test/generators/html/Functor2-module-type-S.html b/test/generators/html/Functor2-module-type-S.html
index f9af33d977..5c5bbb9857 100644
--- a/test/generators/html/Functor2-module-type-S.html
+++ b/test/generators/html/Functor2-module-type-S.html
@@ -15,7 +15,7 @@ Module type Functor2.S
-
+
diff --git a/test/generators/html/Functor2-module-type-XF-argument-1-Y.html b/test/generators/html/Functor2-module-type-XF-argument-1-Y.html
index e25c3fe51c..6ce6db27e8 100644
--- a/test/generators/html/Functor2-module-type-XF-argument-1-Y.html
+++ b/test/generators/html/Functor2-module-type-XF-argument-1-Y.html
@@ -17,7 +17,7 @@ Parameter XF.1-Y
-
+
diff --git a/test/generators/html/Functor2-module-type-XF-argument-2-Z.html b/test/generators/html/Functor2-module-type-XF-argument-2-Z.html
index b7852cda04..caf4277287 100644
--- a/test/generators/html/Functor2-module-type-XF-argument-2-Z.html
+++ b/test/generators/html/Functor2-module-type-XF-argument-2-Z.html
@@ -17,7 +17,7 @@ Parameter XF.2-Z
-
+
diff --git a/test/generators/html/Functor2-module-type-XF.html b/test/generators/html/Functor2-module-type-XF.html
index 6fc9b6cbfe..918c2a9f88 100644
--- a/test/generators/html/Functor2-module-type-XF.html
+++ b/test/generators/html/Functor2-module-type-XF.html
@@ -23,7 +23,7 @@ Module type Functor2.XF
Parameters
-
+
module
Y
@@ -32,7 +32,7 @@ Parameters
-
+
module
Z
@@ -42,7 +42,7 @@ Parameters
Signature
-
-
-
+
type x_t
= y_t
diff --git a/test/generators/html/Functor2.html b/test/generators/html/Functor2.html
index cd3780c871..be8fbdbbeb 100644
--- a/test/generators/html/Functor2.html
+++ b/test/generators/html/Functor2.html
@@ -13,7 +13,7 @@ Module Functor2
-
-
-
+
module
diff --git a/test/generators/html/Include-module-type-Dorminant_Module.html b/test/generators/html/Include-module-type-Dorminant_Module.html
index 372f12900c..205aef9514 100644
--- a/test/generators/html/Include-module-type-Dorminant_Module.html
+++ b/test/generators/html/Include-module-type-Dorminant_Module.html
@@ -28,7 +28,7 @@ Module type Include.Dorminant_Module
-
+
val a :
diff --git a/test/generators/html/Include-module-type-Inherent_Module.html b/test/generators/html/Include-module-type-Inherent_Module.html
index f4d502d5f1..60cef3b722 100644
--- a/test/generators/html/Include-module-type-Inherent_Module.html
+++ b/test/generators/html/Include-module-type-Inherent_Module.html
@@ -16,7 +16,7 @@ Module type Include.Inherent_Module
-
+
val a :
diff --git a/test/generators/html/Include-module-type-Inlined.html b/test/generators/html/Include-module-type-Inlined.html
index 38ee80ccf3..3952b4fbbd 100644
--- a/test/generators/html/Include-module-type-Inlined.html
+++ b/test/generators/html/Include-module-type-Inlined.html
@@ -16,7 +16,7 @@ Module type Include.Inlined
-
+
diff --git a/test/generators/html/Include-module-type-Not_inlined.html b/test/generators/html/Include-module-type-Not_inlined.html
index 02f8bb787b..b1b1ce05b7 100644
--- a/test/generators/html/Include-module-type-Not_inlined.html
+++ b/test/generators/html/Include-module-type-Not_inlined.html
@@ -16,7 +16,7 @@ Module type Include.Not_inlined
-
+
diff --git a/test/generators/html/Include-module-type-Not_inlined_and_closed.html b/test/generators/html/Include-module-type-Not_inlined_and_closed.html
index a18903a118..f47df423d1 100644
--- a/test/generators/html/Include-module-type-Not_inlined_and_closed.html
+++ b/test/generators/html/Include-module-type-Not_inlined_and_closed.html
@@ -17,7 +17,7 @@ Module type Include.Not_inlined_and_closed
-
+
diff --git a/test/generators/html/Include-module-type-Not_inlined_and_opened.html b/test/generators/html/Include-module-type-Not_inlined_and_opened.html
index f6f16266b8..ccddf167e1 100644
--- a/test/generators/html/Include-module-type-Not_inlined_and_opened.html
+++ b/test/generators/html/Include-module-type-Not_inlined_and_opened.html
@@ -17,7 +17,7 @@ Module type Include.Not_inlined_and_opened
-
+
diff --git a/test/generators/html/Include.html b/test/generators/html/Include.html
index 759e52695f..fd98420248 100644
--- a/test/generators/html/Include.html
+++ b/test/generators/html/Include.html
@@ -13,8 +13,8 @@ Module Include
-
+
+
module
type
@@ -36,7 +36,7 @@ Module Include
-
-
+
-
+
module
@@ -94,7 +94,7 @@ Module Include
-
-
+
module
@@ -130,7 +130,7 @@ Module Include
-
-
+
-
+
-
+
val a : u
diff --git a/test/generators/html/Include2-X.html b/test/generators/html/Include2-X.html
index 456361ca4f..735aaafbe7 100644
--- a/test/generators/html/Include2-X.html
+++ b/test/generators/html/Include2-X.html
@@ -16,7 +16,7 @@ Module Include2.X
-
+
type t
= int
diff --git a/test/generators/html/Include2-Y.html b/test/generators/html/Include2-Y.html
index 01e0fe9cb7..cbfeed49f5 100644
--- a/test/generators/html/Include2-Y.html
+++ b/test/generators/html/Include2-Y.html
@@ -16,7 +16,7 @@ Module Include2.Y
-
+
diff --git a/test/generators/html/Include2-Y_include_doc.html b/test/generators/html/Include2-Y_include_doc.html
index ed554b29d2..747d46d7c5 100644
--- a/test/generators/html/Include2-Y_include_doc.html
+++ b/test/generators/html/Include2-Y_include_doc.html
@@ -33,7 +33,7 @@ Module Include2.Y_include_doc
-
+
type t
= Y.t
diff --git a/test/generators/html/Include2-Y_include_synopsis.html b/test/generators/html/Include2-Y_include_synopsis.html
index 01eb9a3cb8..679ec6f5a3 100644
--- a/test/generators/html/Include2-Y_include_synopsis.html
+++ b/test/generators/html/Include2-Y_include_synopsis.html
@@ -31,7 +31,7 @@ Module Include2.Y_include_synopsis
-
+
type t
= Y.t
diff --git a/test/generators/html/Include2.html b/test/generators/html/Include2.html
index 48ca8e68e7..6e9b2d3723 100644
--- a/test/generators/html/Include2.html
+++ b/test/generators/html/Include2.html
@@ -13,7 +13,7 @@ Module Include2
-
+
module
@@ -42,7 +42,7 @@ Module Include2
Comment about X that should not appear when including X below.
-
+
-
-
-
+
module
diff --git a/test/generators/html/Include_sections-module-type-Something.html b/test/generators/html/Include_sections-module-type-Something.html
index 07b3300b9c..f31eee3462 100644
--- a/test/generators/html/Include_sections-module-type-Something.html
+++ b/test/generators/html/Include_sections-module-type-Something.html
@@ -24,7 +24,7 @@ Module type Include_sections.Something
-
+
val something : unit
@@ -33,7 +33,7 @@ Module type Include_sections.Something
Something 1
foo
-
+
@@ -41,7 +41,7 @@ Something 1
Something 2
-
+ foo bar
diff --git a/test/generators/html/Include_sections.html b/test/generators/html/Include_sections.html
index 55574d4a76..3a1fccfda0 100644
--- a/test/generators/html/Include_sections.html
+++ b/test/generators/html/Include_sections.html
@@ -34,7 +34,7 @@ Module Include_sections
-
+
module
@@ -109,7 +109,7 @@
-
+
val something : unit
@@ -119,7 +119,7 @@
Something 1
foo