-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix named block #15
fix named block #15
Conversation
Run & review this pull request in StackBlitz Codeflow. |
f1839e1
to
76c86b8
Compare
@@ -267,12 +267,12 @@ module.exports.preprocessGlimmerTemplates = function preprocessGlimmerTemplates( | |||
let start = n.range[0]; | |||
let codeSlice = code.slice(...n.range); | |||
for (const part of n.tag.split('.')) { | |||
const regex = new RegExp(`\\b${part}\\b`); | |||
let pattern = `\\b${part}\\b`; | |||
if (part.startsWith(':')) { |
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.
What's the significance of the leading \b vs not?
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.
\b
is only an assertion that we are at a word boundary. so either before or after there is a word character and at the other side there is a non-word character (special character).
But with named block, we are not at a word boundary since there are no word characters at the beginning. :
is not a word character. but with :
we are sure that we match the correct part
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.
Thanks for fixing yesterday 😅
|
||
const name = n?.name ?? n.tag; | ||
|
||
if (htmlTags.includes(name)) { |
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's possible to override plain html tags with block params
b8e1e87
to
71085b5
Compare
the regex
\b:custom\b
wasn't able to match the tag name...https://regex101.com/r/U2MlJe/2