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

Re-implement page rendering #7

Merged
merged 2 commits into from
Aug 20, 2024
Merged

Re-implement page rendering #7

merged 2 commits into from
Aug 20, 2024

Conversation

mudge
Copy link
Contributor

@mudge mudge commented Aug 15, 2024

Rather than trying to re-use the existing SectNode to implement arbitrary pages, introduce a dedicated PageNode type to handle them. This way, we don't introduce errant whitespace in the resulting Asciidoc.

The trickiest thing here is that we now handle the level of section titles by using the existing depth keyword argument.

The current source and expected output (minus extra whitespace) of our indexpage.xml and examples_page.xml are used as text fixtures to ensure there are no regressions there.

Rather than trying to re-use the existing SectNode to implement
arbitrary pages, introduce a dedicated PageNode type to handle them.
This way, we don't introduce errant whitespace in the resulting
Asciidoc.

The trickiest thing here is that we now handle the level of section
titles by using the existing depth keyword argument.

The current source and expected output (minus extra whitespace) of our
indexpage.xml and examples_page.xml are used as text fixtures to ensure
there are no regressions there.
@mudge mudge marked this pull request as draft August 15, 2024 15:34
@mudge
Copy link
Contributor Author

mudge commented Aug 15, 2024

The title depth isn't quite right as the "Interrupt Numbers" section in the hardware_irq Detailed Description (4.1.15.1.) is now being promoted to section 4.1.16. (rather than 4.1.15.1.1.). Note that previously it didn't appear as a real section title at all.

Rather than having a mix of depths and hard-coded levels for certain
titles, rely entirely on a `depth` keyword argument passed to
`to_asciidoc` which dictates the current level of any node.

It is a parent node's responsibility to increase the depth when
rendering a child that introduces a new level (e.g. a detailed
description inside a module).

This way, we can render the Doxygen index starting at depth 2 and any
arbitrary pages (e.g. the Examples page) at depth 1.

This also fixes the level of `<title>`s within `<sect1>`s (e.g. the
"Interrupt Numbers" section of hardware_irq).
@mudge
Copy link
Contributor Author

mudge commented Aug 20, 2024

With 28b49db, the title depth is now fixed, see (note the small italic text "Interrupt Numbers" in "Before" compared to the proper subheading in "After"):

Before After
Screenshot 2024-08-20 at 16 03 12 Screenshot 2024-08-20 at 16 02 48

@mudge mudge marked this pull request as ready for review August 20, 2024 15:04
Copy link
Contributor

@nathan-contino nathan-contino left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing this.

@nathan-contino nathan-contino merged commit 020b5a4 into main Aug 20, 2024
1 check passed
@nathan-contino nathan-contino deleted the page-node branch August 20, 2024 15:08
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