-
Notifications
You must be signed in to change notification settings - Fork 1.9k
JS: Add dot.js support
#13624
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
JS: Add dot.js support
#13624
Conversation
Co-authored-by: Kevin Stubbings <Kwstubbs@users.noreply.github.com>
|
Looks reasonable, but I'm thinking there are probably a few other types of |
asgerf
left a comment
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.
A quick code search shows about 800k files with the .dot extension, and from a few other searches I'd estimate around 1k of those are DoT templates.
Based on that, I'd like to restrict the extraction a bit to avoid extracting so many unrelated files as HTML.
For .erb files we only actually extract .html.erb files (due to this code). Would a similar restriction work for your use case, i.e. restricting to just .html.dot files?
Otherwise we can sniff the file header for HTML tags but that's a bit more work.
|
|
||
| /** | ||
| * doT-style syntax, using `{{! }}` for safe interpolation, and `{{= }}` for | ||
| * unsafe interpolation. |
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.
Looks like the two escaping mechanisms were flipped around, either in the comment or in the implementation.
- The comment says
{{! }}is safe, but the implementation treats it as raw (i.e. unsafe) - The comment says
{{= }}is unsafe, but the implementation treats it as escaping (i.e. safe, in most contexts).
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.
Oops, sorry, the model is right, {{! }} is for unsafe (raw) interpolation.
Thanks for the analysis! I'm happy to restrict it to |
|
@jorgectf any updates? Let me know if you need to help from my end. I'd prefer to get the PR merged rather than hanging. |
|
@asgerf Hi Asger, Jorge is currently on a month long vacation. I will look into this PR very soon. |
|
@Kwstubbs I'd prefer to focus on getting the PR merged, without expanding its scope. JST can be added in a separate PR. |
|
@asgerf made the same changes as the .html.erb files, let me know if that will do the trick. |
|
Unfortunately the test doesn't seem to react to the changes. There should be an update to the corresponding I've pushed two commits that fix two of the underlying issues. For some reason the test still isn't finding the flow, so there's still some work to do here, though I need to commit my time elsewhere right now. |
|
The issue might be that |
The tests still don't find the new results :/ |
I found the reason. I've pinged you in an internal PR. Your tests work after that PR has been merged. Also, could you add
Edit: The internal PR has been merged. |
|
Looks good, can you add a change-note? |
|
Hmm. I did some evaluations. They look fine and were very uneventful. |
I haven't been able to figure out a fix for the error. I think it has to be with the internal test, which I'm not familiar with. |
It's because you have to compile the extractor with your changes to see the changes to the tests. I think those outputs are what we should expect from your changes? |
Yes, the expected results LGTM, thank you! |
erik-krogh
left a comment
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.
Great.
LGTM 👍
@asgerf: Do you have any comments?
|
Perhaps a final evaluation, otherwise LGTM, and thanks for driving this to completion! |
Final evaluations (see backrefs) were very uneventful. I'm merging. |
No description provided.