-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add basic {% doc %} tag parsing support #621
Conversation
bdfdee9
to
9f70770
Compare
31923d9
to
c2768ee
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c2768ee
to
a6b207d
Compare
8e2f374
to
d1954f6
Compare
d1954f6
to
1afd9de
Compare
1afd9de
to
b09fec0
Compare
liquidDoc: { | ||
type: ConcreteNodeTypes.LiquidRawTag, | ||
name: 'doc', | ||
body: (tokens: Node[]) => tokens[1].sourceString, | ||
children: (tokens: Node[]) => { | ||
const contentNode = tokens[1]; | ||
return toLiquidDocAST( | ||
source, | ||
contentNode.sourceString, | ||
offset + contentNode.source.startIdx, | ||
); | ||
}, | ||
whitespaceStart: (tokens: Node[]) => tokens[0].children[1].sourceString, | ||
whitespaceEnd: (tokens: Node[]) => tokens[0].children[7].sourceString, | ||
delimiterWhitespaceStart: (tokens: Node[]) => tokens[2].children[1].sourceString, | ||
delimiterWhitespaceEnd: (tokens: Node[]) => tokens[2].children[7].sourceString, | ||
locStart, | ||
locEnd, | ||
source, | ||
blockStartLocStart: (tokens: Node[]) => tokens[0].source.startIdx, | ||
blockStartLocEnd: (tokens: Node[]) => tokens[0].source.endIdx, | ||
blockEndLocStart: (tokens: Node[]) => tokens[2].source.startIdx, | ||
blockEndLocEnd: (tokens: Node[]) => tokens[2].source.endIdx, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs an override for {% liquid %}
. If not in this PR, it should be created as an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b09fec0
to
450083b
Compare
450083b
to
330b509
Compare
*/ | ||
function toLiquidDocAST(source: string, matchingSource: string, offset: number) { | ||
// When we switch parser, our locStart and locEnd functions must account | ||
// for the offset of the {% liquid %} markup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad copy paste, this should say doc
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We could add a changeset here, but—since there are no public API changes—I think we're OK.
Add stage-2 ast tests for doc tags
330b509
to
59c43dc
Compare
What are you adding in this PR?
https://github.com/Shopify/develop-advanced-edits/issues/441
Adds support for Liquid doc tags (
{% doc %}
) in the LiquidHTML parser.This is the basic implementation which we will iterate on.
What's next? Any followup issues?
What did you learn?
Before you deploy
changeset
<- waiting until we built on top of this to add a changeset