-
Notifications
You must be signed in to change notification settings - Fork 96
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
Represent sidebar TOC as a Tree #1232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR uses the Tree.t
representation for page hierarchies. Looks good to me!
to keep the implementation of Page_hierarchy and Skeleton separate
I'm not sure, what do you mean here?
I think I just meant that I didn’t want to implement changes that required the new code in Skeleton or Page hierarchy. That would be made in a future PR. |
I can try. I think when we discussed together there was:
This allows to better see how things are modified: the file renaming + lots of modification prevented git to detect the renaming. Splitting it in two commits would help with that. (I've not tried though, maybe the items 2 and 3 are not reasonably doable!) |
src/document/sidebar.ml
Outdated
match | ||
(id :> Odoc_model.Paths.Identifier.t) | ||
|> Url.from_identifier ~stop_before:false | ||
with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we doing with aliases in the sidebar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@panglesd what do you think about it? It looks to me that we don't lose anything from the previous implementation, that's something that could be improved in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how much you have taken from the original PR, but in the original PR we keep track of which module have an expansion.
If it has one, we use ~stop_before:false
, if it has none we use stop_before:true
. So, aliases appear in the sidebar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good, we need to keep that behaviour!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The has_expansion
bool is recorded here and used here.
I think there is some refactoring to do though, in the final version: sidebar_toc_entry
is still there, but used only for pages sidebar. This should be made explicit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how much you have taken from the original PR, but in the original PR we keep track of which module have an expansion.
I've checked: currently, what has been taken is mostly refactoring: introducing a tree type and using it in each tree structure, and moving things in the right directory. So, in the current state of this PR the sidebar is only showing root modules (as before), so no need to handle aliases!
This PR should be reviewed commit-by-commit. |
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
…_page_hierarchy Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
Co-authored-by: Paul-Elliot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I removed the last commit by the way. |
Lovely thanks! |
Several changes: - Entries are now defined in the `odoc_index` library, - Entries can have new kinds (pages, source, ...) - Indexes have the form of "skeletons of entries", that can be folded. - Indexes can be created by odoc with the `odoc compile-index` command, and then consumed by sherlodoc. These changes come from: - ocaml/odoc#1228 - ocaml/odoc#1232 - ocaml/odoc#1233 - ocaml/odoc#1244 - ocaml/odoc#1250 - ocaml/odoc#1251
Follow-up on #1228
Reduce diff of #1220
@panglesd I made the changes minimal, to keep the implementation of Page_hierarchy and Skeleton separate, let me know what you think.