Allow string interpolation in attribute names #7
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.
Resolves #5
This is a partial solution, and I'm hoping to find some guidance to complete it.
I ran into a similar issue to #5 with the following error:
With my level of understanding of regexp it seems like adjusting the
ATTR_NAME
regexp to allow for erb tags is not possible, as it means removing the characters<%=>
from the negated set, however, this would allow full html tags to be included in the match. For example it would then match<span foo="bar"
out of<span foo="bar"></span>
(while we only wantfoo="bar"
).The approach I found to work is the one outlined in this PR. The solution itself comes down to deferring the substitution of the erb tags such that we don't have to deal with them while matching with the
ATTR_NAME
regexp. I'm not very happy with this solution because it now requires many lines to callgsub
, so I hope to improve it before merging.Additionally the attribute names produced by this are not valid as they look like this: