Are there any templating libraries—e.g.: Jinja2, Django Template Engine, Mako
&etc—which can be used to interface over REST, XMLRPC xor JSONRPC?
My use-cases follow:
1. Generate a website, e.g.: to run from example.com (currently every
templating language does this out of the box)
2. Generate the JS, HTML and CSS to put into a mobile phone app (PhoneGap)
3. Generate JavaScript "widget" code for pasting onto your site (see footnote
[1] for popular examples)
My current plan is to write the entire client using HTML, CSS
(twitter-bootstrap responsive) and JavaScript—e.g.: with Backbone.js—allowing
me to use that same client code for the website and PhoneGap clients. With that
done, the widgets wouldn't be too difficult to extrapolate.
However, this seems like a really complex way of doing things, especially when
taking into consideration checks requiring login, forced redirects and more
fine grained RBAC.
Is there a templating language which can easily interface via REST (XML xor
JSON), XMLRPC xor JSONRPC?
Thanks for all information and suggestions,
Alec Taylor
[1] | The example JavaScript widgets:
- DISQUS gives the following snippet:
`<script type="text/javascript"
src="http://example.disqus.com/combination_widget.js?num_items=5&hide_mods=0&color=blue&default_tab=people&excerpt_length=200"></script><a
href="http://disqus.com/">Powered by Disqus</a>`
- Facebook gives the following snippet:
`<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs =
d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js =
d.createElement(s); js.id = id;js.src =
"//connect.facebook.net/en_US/all.js#xfbml=1&appId=237216179703726";fjs.parentNode.insertBefore(js,
fjs);}(document, 'script', 'facebook-jssdk'));</script>`
`<div class="fb-like" data-send="true" data-width="450"
data-show-faces="true"></div>`
- Twitter gives the following snippet:
`<script charset="utf-8"
src="http://widgets.twimg.com/j/2/widget.js"></script><script>new
TWTR.Widget({version: 2,type: 'profile',rpp: 4,interval: 30000,width:
250,height: 300,theme: {shell: {background: '#333333',color: '#ffffff'},tweets:
{background: '#000000',color: '#ffffff',links: '#4aed05'}},features:
{scrollbar: false,loop: false,live: false,behavior:
'all'}}).render().setUser('twitter').start();</script>`
--
http://mail.python.org/mailman/listinfo/python-list