[Ur] CMS like features ? unsafe XML - encodings?

Chris Double chris.double at double.co.nz
Sun Dec 19 01:10:33 EST 2010


On Thu, Dec 16, 2010 at 3:35 AM, Adam Chlipala <adamc at impredicative.com> wrote:
> More interesting is some HTML parsing code which I just added to the Meta
> library (that I announced yesterday).  This will let you convert arbitrary
> strings into verified HTML, and the library is implemented entirely within
> Ur.  See the [Html] module and the "testHtml" test.

This works well except in the case where the HTML being embedded uses
elements that Ur/Web doesn't know about. 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:

<script type="text/javascript">
var sc_project=123456;
var sc_security="abcdefg";
</script>
<script type="text/javascript"
src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
<noscript><div class="statcounter">
<a title="web stats" class="statcounter" href="http://www.statcounter.com/">
<img class="statcounter"
src="http://c.statcounter.com/123456/0/abcdef/1/" alt="web
stats"></img>
</a></div></noscript>

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? 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?

Chris.
-- 
http://www.bluishcoder.co.nz



More information about the Ur mailing list