Skip to content
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

Merged
merged 11 commits into from
Nov 8, 2024
Merged

Represent sidebar TOC as a Tree #1232

merged 11 commits into from
Nov 8, 2024

Conversation

gpetiot
Copy link
Collaborator

@gpetiot gpetiot commented Oct 31, 2024

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.

Copy link
Collaborator

@panglesd panglesd left a 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?

@panglesd panglesd added the no changelog This pull request does not need a changelog entry label Nov 4, 2024
@gpetiot
Copy link
Collaborator Author

gpetiot commented Nov 4, 2024

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.

@gpetiot
Copy link
Collaborator Author

gpetiot commented Nov 4, 2024

By the way I tried to bridge the gap between this PR and #1220 but I just ended up reimplementing the whole #1220, ie I couldn’t further split the PR in smaller changes

@panglesd
Copy link
Collaborator

panglesd commented Nov 4, 2024

I can try. I think when we discussed together there was:

  • Gathering the unrelated changes (eg this one) in a commit,
  • Moving the relevant files in the index folder (without changing them) in a commit,
  • Actually changing them in another commit

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!)

match
(id :> Odoc_model.Paths.Identifier.t)
|> Url.from_identifier ~stop_before:false
with
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Member

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!

Copy link
Collaborator

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!

Copy link
Collaborator

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!

@gpetiot
Copy link
Collaborator Author

gpetiot commented Nov 5, 2024

This PR should be reviewed commit-by-commit.
I'm aiming at catching up #1220 but it can be merged at any point if the reviews are done and we decide it's better to switch to a fresh PR for the next commits.

Guillaume Petiot and others added 10 commits November 5, 2024 16:09
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]>
Copy link
Collaborator

@panglesd panglesd left a 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!

@gpetiot
Copy link
Collaborator Author

gpetiot commented Nov 8, 2024

I removed the last commit by the way.

@jonludlam
Copy link
Member

Lovely thanks!

@jonludlam jonludlam merged commit 271a4e4 into ocaml:master Nov 8, 2024
23 checks passed
@gpetiot gpetiot deleted the toc-tree branch November 8, 2024 14:44
panglesd added a commit to panglesd/sherlodoc that referenced this pull request Dec 9, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog This pull request does not need a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants