[web-devel] A string escape issue with Yesod Julius

Dmitry Vyal akamaus at gmail.com
Thu Nov 15 21:10:00 CET 2012

On 11/15/2012 09:48 AM, Michael Snoyman wrote:
> You could solve this in one of two ways:
> 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.
> 2. Writing some escape algorithm on the characters. This would be more 
> complicated.
> The reason we haven't implemented the idea that Greg mentions is that 
> it prevents certain use cases, such as interpolating actual Javascript 
> code.
The first way works wonderfully, thanks! Speaking about corner use 
cases, that's reminds me situation with #{} and ^{} in Hamlet. Why not 
to go the same route in Julius?


More information about the web-devel mailing list