-
Notifications
You must be signed in to change notification settings - Fork 102
Dedicated sidebar file #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Dedicated sidebar file #1250
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fb217b9
Move Json module to Odoc_utils
panglesd 882f2cf
Sidebar generation: Add a command to generate the sidebar
panglesd cfe7ab5
Sidebar generate: Add a "kind" to the json output
panglesd e7a2a7c
Sidebar-generate: take sidebar as input in html-generate
panglesd b1ad13f
Sidebar generate: Update driver
panglesd 180676a
Changelog entry for #1250
panglesd 47dbb84
Close open channel
panglesd af779c3
Move sidebar_to_json in Odoc_html library
panglesd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.