-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Preserve Liquid tags contents #4484
Conversation
proto.inlineTokenizers.liquid = tokenizer; | ||
|
||
function tokenizer(eat, value) { | ||
const match = /^({%-?[\s\S]*?-?%}|{{-?[\s\S]*?-?}})/.exec(value); |
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.
It seems the -?
part is unnecessary, {%- something -%}
is already included in {% something %}
, or are those leading/trailing spaces necessary?
And I think string.match(regex)
should be better than regex.exec(string)
since we do not use multiple exec
calls, what do you think?
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 you're right about -?
. I don't understand what you mean about the leading/trailing spaces.
I don't know if one is better. I was using exec
specifically because I only care about the first match but that was before I was using ^
. But sure, I'll change it
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 don't understand what you mean about the leading/trailing spaces.
I meant this:
{% something %}
^ ^
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.
They're not mandatory from what I could gather from parsers implementations
|
||
{{ foo | ||
multiline | ||
where does it end }} |
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.
Let’s add some examples from the issue:
{% include_relative _installations/tarball.md %}
{% cloudinary nice_prefix_-_for_the_filename.jpg %}
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.
Just what @ikatyang said.
Closes #3695