refactor(parser): simplified grammar rules for attributes #804
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.
Process the attributes in a more generic way: positional values
are retained until the block is initialized, in which case they
are process accordingly, by mapping the position to an expected
attribute name.
Overall, the grammar for block and inline attributes is much simpler,
which means that adding support for new elements will require
less effort.
Also:
AdmonitionKind
andBlockKind
types, whoseconstant values are all
string
now and stored in thestyle
key.[
)are not tolerated (this was already the case for block attributes). This
allows for a better consistency and simpler grammar rules.
BREAKING CHANGE: for images and links, positional attributes are delimited
with commas, so if a link text should contain such a comma, it is necessary
that the text be wrapped in single or double quotes. This makes the syntax
(and thus, the parsing) consistent between block attributes and inline
attributes.
Eg:
link:http://example.com["a description, with comma"]
BREAKING CHANGE: inline attributes content must not start with spaces, as
it is the case with block attributes.
Eg:
image::cookie.png[ cookie ]
is not valid.Fixes #750
Signed-off-by: Xavier Coulon [email protected]