<div dir="ltr">You could solve this in one of two ways:<div><br></div><div>1. Switch over to embedding `t` as JSON and concatenating in Javascript, e.g.: [julius| str = "a" + #{toJSON t} + "bc"|]. I think we never ended up adding the aeson instances to shakespeare-js, but I'm in favor of doing so.</div>
<div>2. Writing some escape algorithm on the characters. This would be more complicated.</div><div><br></div><div>The reason we haven't implemented the idea that Greg mentions is that it prevents certain use cases, such as interpolating actual Javascript code.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 14, 2012 at 12:08 PM, Dmitry Vyal <span dir="ltr"><<a href="mailto:akamaus@gmail.com" target="_blank">akamaus@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings<br>
<br>
Recently I stumbled upon an unexpected escaping problem. I hoped Shakespeare templates would solve these forever, but looks like it's not the case.<br>
<br>
For example, look at this snippet:<br>
Prelude Text.Julius Data.Text.Lazy Data.Text> let t = "X\"Y\"Z"; j = [julius| str = "a#{t}bc"; |] in putStrLn $ Data.Text.Lazy.unpack $ renderJavascriptUrl (\u env -> Data.Text.pack "") j<br>
str = "aX"Y"Zbc";<br>
<br>
Clearly we have have a problem here. Can something be done with it?<br>
<br>
Best wishes,<br>
Dmitry<br>
<br>
______________________________<u></u>_________________<br>
web-devel mailing list<br>
<a href="mailto:web-devel@haskell.org" target="_blank">web-devel@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/web-devel</a><br>
</blockquote></div><br></div>