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

markup/asciidoc: Add support for .TableOfContents #7099

Merged
merged 1 commit into from
Sep 6, 2020

Conversation

npiganeau
Copy link
Contributor

Fill the .TableOfContents template variable when writing Asciidoc content.
This is done by letting Asciidoc render its TOC as HTML, then extract this
HTML rendered TOC, parse it into a tableofcontents.Root and finally remove
it from the HTML content.
This aims to stay in the logic that the Asciidoc parsing is entirely done
by the external helper.

See #1687

Copy link

@rustysys-dev rustysys-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@npiganeau I have no clue if I am authorized to approve anything or not.. Ill try the button, but that being said, I reviewed your PR and lgtm.

you need to fix the conflicting go.sum file though

@npiganeau
Copy link
Contributor Author

@rustysys-dev Thanks for your review. I've just fixed the conflicts in go.sum.

@rustysys-dev
Copy link

rustysys-dev commented May 17, 2020

@bep I apologize if mentioning you on this PR discouraged (please let me know if it is)

That being said, I wanted to bring the Hugo teams attention to this PR as it fixes a feature that is broken for asciidoc, and is important for my team and I.

I checked the code, and the logic follows through, is formatted correctly, and has tests and documentation. If you have some time to approve/merge/comment, we would all appreciate it.

@stale
Copy link

stale bot commented Aug 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Aug 16, 2020
@forestsword
Copy link

Not stale. @rustysys-dev any way to move this fix along aside from @npiganeau rebasing?

@stale stale bot removed the Stale label Aug 19, 2020
@rustysys-dev
Copy link

rustysys-dev commented Aug 24, 2020

@forestsword As you said, aside from @npiganeau re-basing we cannot do anything with this unless someone who has merge permissions decides to take a look at this. Once the re-basing is complete then we can try to get the attention of someone in charge again.

that being said, the fact that these specific files are conflicting means that someone may have fixed this elsewhere.

@forestsword
Copy link

It wasn't fixed. That file was just moved to the new markdown/asciidocext. @npiganeau are you still interested in this, I can do a rebase with your code if you'd like and open a new PR.

@bep
Copy link
Member

bep commented Aug 24, 2020

If this looks good to the Asciidoc users in here, I'll happilly merge (once rebased).

@npiganeau
Copy link
Contributor Author

Rebase is done

@bep
Copy link
Member

bep commented Aug 24, 2020

@muenchhausen

@forestsword
Copy link

LGTM working as expected.

@muenchhausen
Copy link
Contributor

@muenchhausen

I will try it out in the weekend.

@muenchhausen
Copy link
Contributor

I was successfully able to run your changes.

Do you have a sample repo with an adoc file and a theme that uses .TableOfContents? I would like to see it.
We can also extend my sample repo hugo_asciidoc_ddd.

I found a small issue: Please correct your documentation and add empty lines between the headers. There is also a missing blank between :toclevels: and 4. Otherwise AsciiDoc won't be rendered correctly.

Fill the .TableOfContents template variable when writing Asciidoc content.
This is done by letting Asciidoc render its TOC as HTML, then extract this
HTML rendered TOC, parse it into a tableofcontents.Root and finally remove
it from the HTML content.
This aims to stay in the logic that the Asciidoc parsing is entirely done
by the external helper.

See gohugoio#1687
@npiganeau
Copy link
Contributor Author

Documentation is corrected.

See muenchhausen/hugo_asciidoc_ddd#2 for a sample with TOC extraction to .TableOfContent.

@muenchhausen
Copy link
Contributor

@npiganeau your changes work fine, thanks a lot! @bep I propose to merge.

@bep bep merged commit 3ba7c92 into gohugoio:master Sep 6, 2020
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants