Refactor of AST traversal method #944
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for opening a pull request and contributing to asciidoctor-maven-plugin!
What kind of change does this PR introduce? (check at least one)
What is the goal of this pull request?
Solve limitations in the current method used to traverse the AST.
Currently, we explored all nodes in a loop in
NodeSinker
that already showed issues with nested elements that need to generate content "around" nodes, like lists. That forced to have specific loops for such elements.The new method does not look externally (outside of
NodeProcessors
) but instead injects NodeSinker in the NodeProcessors so each one decides if further traversal needs to happen. This has simplified the code notably and removes the need for specific dependency injection.Now all
NodeProcessors
are instantiated and stored inNodeSinker
without special cases.Are there any alternative ways to implement this?
Probably, so far this works 😄
Are there any implications of this pull request? Anything a user must know?
There are some changes in how HTML content is generated:
<h1></h1>
<pre></pre>
<div>
elements for better organization.content
instead ofsource
Is it related to an existing issue?
But it's related to this PR #938
Finally, please add a corresponding entry to CHANGELOG.adoc