[Ur] CMS like features ? unsafe XML - encodings?
Adam Chlipala
adamc at impredicative.com
Sun Dec 19 09:18:20 EST 2010
Chris Double wrote:
> A particular case I'm
> interested in is embedding snippets of code provided by HTML widget
> vendors. An example of this might be Google Analytics, Google Ads,
> Statcounter, Flattr, etc.
>
> Here is an example of a Statcounter snippet:
>
> [...snip...]
>
> This uses 'script', 'noscript' and various attributes not supported by
> the Meta Html parsing or xbody. In the case of Google Ads it's not
> allowed by the terms and conditions to edit the snippet they give you.
>
> What are some ways of being able to embed this using Ur/Web? Should
> Html and/or xbody be modified to allow these extra
> elements/attributes?
No, because this would allow circumventing all the nice type system
guarantees about encapsulation and so on.
> Should I resort to FFI? If the latter, is there
> an example I can follow of using the FFI to return a raw HTML string
> that can be put in the page?
>
This is what I recommend. Every XML type is just a C string from the
FFI's perspective, so you just need to write a function that returns a
string. You can write that type as [uw_Basis_string], [char*], or
whatever other synonym you like. You can return normal string literals.
More information about the Ur
mailing list