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

Fixes #1082. Return empty list in DescriptionList.getBlocks() instead… #1083

Merged
merged 1 commit into from Feb 15, 2022

Conversation

robertpanzer
Copy link
Member

… of return a list of DescriptionListItems, which are not blocks

Thank you for opening a pull request and contributing to AsciidoctorJ!

Please take a bit of time giving some details about your pull request:

Kind of change

  • Bug fix
  • New non-breaking feature
  • New breaking feature
  • Documentation update
  • Build improvement

Description

What is the goal of this pull request?

#1082 reports that DescriptionList.getSections() returns a list of objects that are not StructuralNodes but DescriptionListEntries instead. (This only works due to type erasure).

How does it achieve that?

This PR tries to fix the problem by making DescriptionList.getSections() return a new empty list.
That way there will no longer be a ClassCastException when recursively traversing the AST only via getSections().

Are there any alternative ways to implement this?

It could be possible to change the form of the AST by making DescriptionListEntry a StructuralNode that has the terms as properties.
That might be difficult as the implementation of Asciidoctor Ruby currently treats the terms and its description as a list with 2 items: [[ListItem Term1, ListItem Term2], ListItem Description].
This might be difficult to implement, leaves the question open how to handle description list entries without description and also this would be a breaking change.

Are there any implications of this pull request? Anything a user must know?

Adding any nodes to the result of DescriptionList.getSections() is without any effect.

Issue

Fixes #1082

Release notes

Please add a corresponding entry to the file CHANGELOG.adoc

…s() instead of return a list of DescriptionListItems, which are not blocks
@abelsromero
Copy link
Member

abelsromero commented Feb 14, 2022

Been thinking on & off and I think you are right, it's best to keep it simple and be consistent with the fact these are not blocks and return empty.

@robertpanzer robertpanzer merged commit 21dca59 into asciidoctor:main Feb 15, 2022
@robertpanzer robertpanzer deleted the fix-1082 branch February 15, 2022 15:45
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.

Failure getting blocks when using description lists
2 participants