SimonDanisch / Bonito.jl

Serving JS to the browser
MIT License
204 stars 29 forks source link

Exclude JS template literal placeholders "${...}" from interpolation #210

Closed topolarity closed 6 months ago

topolarity commented 8 months ago

This commit carves out a specific exception for "${...}" which is never a useful interpolation from the Julia side (it always errors since {...} is a deprecated syntax) and is a template literal placeholder on the Javascript side.

The D3.js examples use this feature heavily, and this small fix is enough to get them working as js"..." strings.

There remain other interpolation issues for, e.g., jQuery which uses $ as a magic global (e.g. $("button.continue").html("Next Step...")), but fixing those would be a breaking change to syntax.

SimonDanisch commented 8 months ago

Thank you, that seems reasonable! I guess I was sleeping when answering in the issue :)