-
Notifications
You must be signed in to change notification settings - Fork 736
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
Section title out of sequence warnings may be generated when using operation macro #628
Section title out of sequence warnings may be generated when using operation macro #628
Conversation
Renderings with standard section depth first to avoid warnings that document starts with level 3 headings. Adjust block level when adding the content to the parent.
def write_title(content, snippet, level, id, snippet_titles) | ||
section_level = '=' * (level + 1) | ||
def write_title(content, snippet, id, snippet_titles) | ||
section_level = '==' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch to hardcoding two =
feels like it may cause a regression to me. For example, will it not now be wrong if the macro is used in a deeply nested section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new line 53 will adjust the level of all top level blocks the moment they are inserted. This avoid the warning that would otherwise occur when starting with a section of a too high level, and avoid having a regression.
I am using this patch and it is working for me. I would be happy to see it in milestone 2.0.4.RELEASE along with #581 solved. |
Renderings with standard section depth first to avoid warnings that document starts with level 3 headings. Adjust block level when adding the content to the parent. See gh-628
Thanks for the PR, @ahus1. The proposed changes are now in master along with a polishing commit that updated the tests to cover the scenario that previously generated a warning. |
I've run the sample rest-notes-spring-hateoas locally using
gradlew asciidoctor
and saw that it generated lots of error messages likeI traced this down to
operation_block_macro.rb
and changed it so that the block level is adjusted afterAsciidoctor.load
when the blocks are added to the parent. I assume this is safe when there are no nested blocks.Once I change it, the output is still correct and the warning message is gone.