Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Templating library which generates HTML+JS for interfacing RESTfully?

Thread Tools

Templating library which generates HTML+JS for interfacing RESTfully?

Alec Taylor
Posts: n/a
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 (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 xorJSON), 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=" r=blue&default_tab=people&excerpt_length=200"></script><a href="">Powered byDisqus</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); = id;js.src = "//";fjs.parentNo de.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=""></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>`
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ANN: Templayer 1.4 - HTML templating library Ian Ward Python 0 09-25-2006 03:18 PM
ANN: Templayer 1.3 - HTML templating library Ian Ward Python 1 08-30-2006 06:18 PM
Open-source tool which generates Java Value objects ? writeOnceDebugEverywhere() Java 5 03-23-2005 07:24 PM
Text-templating library for C++ Przemyslaw Wegrzyn C++ 4 09-09-2004 12:40 PM
Interfacing Python crypto library Gandalf Python 0 06-15-2004 11:37 AM