-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1250 from panglesd/root-in-sidebar
Dedicated sidebar file
- Loading branch information
Showing
32 changed files
with
450 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
open Odoc_utils | ||
|
||
let toc_to_json ((url, inline) : Odoc_document.Sidebar.entry) : Json.json = | ||
let config = | ||
Config.v ~semantic_uris:true ~indent:true ~flat:false ~open_details:false | ||
~as_json:true ~remap:[] () | ||
in | ||
let url, kind = | ||
match url with | ||
| None -> (`Null, `Null) | ||
| Some url -> | ||
let href = Link.href ~config ~resolve:(Link.Base "") url in | ||
let kind = | ||
Format.asprintf "%a" Odoc_document.Url.Anchor.pp_kind url.kind | ||
in | ||
|
||
(`String href, `String kind) | ||
in | ||
let inline = | ||
let inline = Generator.inline ~config ~xref_base_uri:"" [ inline ] in | ||
let inline = | ||
String.concat "" | ||
@@ List.map (Format.asprintf "%a" (Tyxml.Html.pp_elt ())) inline | ||
in | ||
`String inline | ||
in | ||
`Object [ ("url", url); ("kind", kind); ("content", inline) ] | ||
|
||
let pages_to_json ({ name; pages } : Odoc_document.Sidebar.pages) = | ||
`Object [ ("name", `String name); ("pages", Tree.to_json toc_to_json pages) ] | ||
|
||
let libs_to_json ({ name; units } : Odoc_document.Sidebar.library) = | ||
`Object | ||
[ | ||
("name", `String name); | ||
("modules", `Array (List.map (Tree.to_json toc_to_json) units)); | ||
] | ||
|
||
let to_json ({ pages; libraries } : Odoc_document.Sidebar.t) = | ||
let pages = List.map pages_to_json pages in | ||
let libraries = List.map libs_to_json libraries in | ||
`Object [ ("pages", `Array pages); ("libraries", `Array libraries) ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val to_json : Odoc_document.Sidebar.t -> Odoc_utils.Json.json |
Oops, something went wrong.