Spot on Greg. Worked a charm. Thanks!

On 25/04/2011, at 9:45 PM, Gregory Collins wrote:

> On Mon, Apr 25, 2011 at 9:09 AM, Todd Porter <[email protected]> wrote:
>> Hi Snap team,
>> 
>> am enjoying learning your framework.
>> 
>> I am trying to dynamically inject some json data into a page: <script>var 
>> json = {} </script>.
>> 
>> At first I tried bindString to support something like 
>> <script><json/></script> but Heist ignores (correctly I guess?) or 
>> alternatively escapes if I decide to pull the script tags into my string.
>> 
>> So then tried creating the nodes using Blaze as follows:
>> 
>> jsonSplice :: Splice Application
>> jsonSplice = return . renderHtml $ do
>>    H.script "var json = {}"
>> 
>> but get the following:
>> 
>> Couldn't match expected type `X.Node'
>>                with actual type `hexpat-0.19.6:Text.XML.Expat.Tree.NodeG
>>                                    [] BS.ByteString BS.ByteString'
>>    Expected type: Splice Application
>>      Actual type: TemplateMonad Application Forest
>> 
>> Apologies if I am missing something obvious but this has me stumped, given 
>> the expected and actual types look equivalent to me.
> 
> Problem seems to be that you are using Text.Blaze.Renderer.Hexpat, and
> heist doesn't use hexpat under the hood anymore; now we use xmlhtml.
> If you replace it with Text.Blaze.Renderer.XmlHtml (from the xmlhtml
> package), it should work (?).
> 
> G
> -- 
> Gregory Collins <[email protected]>

_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to