Repository navigation
Add verbose option for positional info of attributes - #20
Closed
chimeyrock999 wants to merge 1 commit into
Closed
chimeyrock999 wants to merge 1 commit into
chimeyrock999 wants to merge 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
Member
|
thanks, released in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Initial checklist
Description of changes
Closes #19.
Adds an opt-in
verboseoption todirectiveFromMarkdown, mirroringverboseinhast-util-from-parse5.When on, directives with attributes get
data.position.attributes: oneDirectiveAttributePositionper attribute, in source order, with:name: the attribute name (idfor#a,classfor.a)start/end: the whole attribute (#a,.a,a,a=b,a="b")value: the raw value without quotes; empty between the quotes fora=""; not present foraIt is a list rather than a record keyed by name because duplicates are allowed and
classvalues are joined:every occurrence is included, and for a given name the last one is the one whose value is in
attributes(all of them, forclass).attributesitself is unchanged, and withoutverbosethe tree is exactly what it was before.Notes on the implementation:
directive*AttributeValueLiteralto cover the quotes (and to give empty quoted values a place)directive*Attribute) is not used forstart/end, because it includes trailing whitespace for value-less attributes ({a b}gives"a ")#/.marker and quotes are one character on the same line, so those points are shifted by one instead of tracking the marker tokensTypes (
FromMarkdownOptions,DirectiveAttributePosition,DirectiveDataPosition,data.positionon the three*DirectiveDatainterfaces) and the readme are updated.npm testpasses, with 100% coverage.