fix(templates): fixed string interpolation in template strings
addresses https://github.com/bigskysoftware/_hyperscript/issues/561
Edit:
Actually, you still cant escape them...
You couldnt before, but, after this fix you still wont be able to.
Working on a better version now. Hopefully will have in a few days
Ok, well, it escapes properly in all but 1 case now in my local copy that Im working on.
I know what that case is and why it happens, and I could disgustingly fix it but id rather like... nicely fix it.
`test \${x}`
currently this case fails still in my local copy.
But Im close. I just need to find a good way to fix the last case
I did have to split up consumeIdentifier and consumeTemplateIdentifier into 2 separate functions though.
Actually, since the current one on here doesnt escape at ALL I will push the updated version in the meantime so you can see where its at.
When I fix the final escaping case:
`test \${x}`
This PR will be reinstated as no longer a draft.
https://github.com/BirdeeHub/_hyperscript/blob/3e29b493e3eb032f5177371218b4f6cf18485c27/src/_hyperscript.js#L279-L286
^ this clause is the one catching that 1 case that I havent addressed yet...
It works now :)
Thank you for this change, did you run the entire test suite against it?
yeah I ran all the tests, I also tried it out in the playground.
I also added the new test which tests many different permutations of the interpolation. In the test I had to double escape because it gets passed through JS first, but in the playground it works as expected, you can escape with \${} and it will not interpolate
Also it seems your test suite fails one of the tests when ran via opening test/index.html file with a browser directly but succeeds if you serve with python or something and then go to the page in the browser? This is unrelated to the interpolation syntax though, I forget which but I think it was the socket one? I just remember the failure making sense when I looked at the code of the offending test.