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

Don't assign nil value to named attribute mapped to absent positional attribute #4033

Closed
mojavelinux opened this issue Apr 22, 2021 · 1 comment
Assignees
Labels
regression v2.0.15 Issues resolved in the 2.0.15 release
Milestone

Comments

@mojavelinux
Copy link
Member

When the attrlist parser was updated to account for empty positional attributes to solve #3813, it resulted in an attribute mapped to that position being assigned a nil value. This presents a challenge for converters, which often assume that if an attribute is set, the value is non-nil.

The affect of this can be seen in the handling of the block image macro. If the positional attribute for width is empty, like in this example:

image::tux.png[Tux,]

It results in an empty width attribute in the HTML output:

<img src="tux.png" width="">

This output differs from earlier version of Asciidoctor.

The mapped attribute should only be assigned if the value is non-nil.

@mojavelinux mojavelinux added this to the v2.0.x milestone Apr 22, 2021
@mojavelinux mojavelinux self-assigned this Apr 22, 2021
@mojavelinux
Copy link
Member Author

mojavelinux commented Apr 22, 2021

It's interesting to note that the AttributeList.rekey method already works this way. It's the logic integrated with the attrlist parsing that's behaving incorrectly.

mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Apr 22, 2021
…apped to absent positional attribute when parsing attrlist
@mojavelinux mojavelinux added the v2.0.15 Issues resolved in the 2.0.15 release label Apr 23, 2021
ggrossetie pushed a commit to ggrossetie/asciidoctor that referenced this issue Jun 12, 2021
…apped to absent positional attribute when parsing attrlist (PR asciidoctor#4034)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression v2.0.15 Issues resolved in the 2.0.15 release
Projects
None yet
Development

No branches or pull requests

1 participant