I have an app that has page content that includes script tags, but when it tries to render it gives the error 'Uncaught SyntaxError: Unexpected token ILLEGAL'.
I'm initializing a backbone app as follows:
- content_for :javascript do
- javascript_tag do
App.initialize({ data: #{@data.to_json.html_safe } });
which generates the following JSON:
<script type="text/javascript">
//<![CDATA[
App.initialize({ data: {"content":"<div style=\"padding-left:5px;\"><script type=\"text/javascript\" src=\"http://www.opentable.com/frontdoor/default.aspx?rid=52900&restref=52900&bgcolor=8AA86B&titlecolor=0F0F0F&subtitlecolor=0F0F0F&btnbgimage=http://www.opentable.com/frontdoor/img/ot_btn_black.png&otlink=FFFFFF&icon=light&mode=short&hover=1\"></script></div>"});
//]]>
</script>
I'm trying to render it as follows (with hamlc):
- if @page.attributes.content
.text.page-content~ @page.attributes.content