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

Convert collection links from raw HTML to directive #200

Merged

Conversation

felixfontein
Copy link
Collaborator

@felixfontein felixfontein commented Aug 20, 2023

Currently includes #195, #198, and #199. Will rebase once these are merged.

Converts the inline HTML for collection links to a custom directive. The external links are a custom nodes class inherited from docutils's reference with a custom HTML generator; for other builders, the reference generator provided by that builder is used (so in LaTeX it is a regular hyperlink reference). The "Communication" button though needs a Sphinx pending_xref node (to resolve the reference), which improves on the previous version by not relying on implementation details, but at the same time is worse than before because pending_xref is replaced by a plain ref (Sphinx doesn't allow to customize this), which rendered to HTML neither has target="_blank" nor aria-role="button". (Aside from that, it looks and behaves like a button, though.)

The HTML output didn't change (except the missing attributes for the "Communication" button, which you cannot see here):
HTML output

The LaTeX output is now as expected - the first four buttons are hyperlinks, the last one an internal reference in the PDF file:
LaTeX output

@felixfontein felixfontein force-pushed the latex-indent-styling-links branch 2 times, most recently from 58cf15f to 41d8feb Compare August 24, 2023 10:55
@felixfontein felixfontein changed the title [WIP] Convert collection links from raw HTML to directive Convert collection links from raw HTML to directive Aug 24, 2023
@felixfontein felixfontein marked this pull request as ready for review August 24, 2023 11:06
Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

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

LGTM. Some really minor nits on wording. I couldn't find any faults or optimizations for the code side but I did look and it all seems fine. I think this is really nice work @felixfontein

changelogs/fragments/200-collection-links.yml Outdated Show resolved Hide resolved
src/sphinx_antsibull_ext/directives.py Outdated Show resolved Hide resolved
src/sphinx_antsibull_ext/directives.py Outdated Show resolved Hide resolved
felixfontein and others added 2 commits August 29, 2023 13:18
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
@felixfontein felixfontein merged commit efc4770 into ansible-community:main Aug 29, 2023
9 of 10 checks passed
@felixfontein felixfontein deleted the latex-indent-styling-links branch August 29, 2023 15:59
@felixfontein
Copy link
Collaborator Author

@oraNod thanks a lot for reviewing this and improving the formulations :)

@oraNod
Copy link
Contributor

oraNod commented Aug 29, 2023

@oraNod thanks a lot for reviewing this and improving the formulations :)

you're welcome. thanks for all your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants