_hyperscript
_hyperscript copied to clipboard
slashes break inside backticks
@0.9.5
set pdfurl to https://yyy.xxxxxx.com/path/out/${trackingcode}.pdf
gives pdfurl as
https://yyy.xxxxxx.com/path/out/AB123456789KK.pdf
@0.9.7
set pdfurl to https://yyy.xxxxxx.com/path/out/${trackingcode}.pdf
gives pdfurl as
https:
I have encountered the same. The tokenizer does a lot of (overly aggressive and error prone?) interpreting of the contents of template literals. In this case it sees the //
as a comment prefix which leads the parser to discard the rest.
Can I get some more context on this? I added two regression tests that both pass (raw template eval + in the context of a set)
https://github.com/bigskysoftware/_hyperscript/issues/399
It seems like in some cases we are starting template string parsing in the wrong "mode"
I assume the above code is:
set pdfurl to `https://yyy.xxxxxx.com/path/out/${trackingcode}.pdf`
Here's one that breaks
set count 1
set optName to `options_${count}_value`
This produces the string literally options_${count}_value
when I would expect options_1_value
.
I have to do this as a workaround
set optName to 'options_' + `${count}_value`