Templating library which generates HTML+JS for interfacing RESTfully?

Discussion in 'Python' started by Alec Taylor, May 31, 2012.

  1. Alec Taylor

    Alec Taylor Guest

    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 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="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 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); 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>`
    Alec Taylor, May 31, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. writeOnceDebugEverywhere()

    Open-source tool which generates Java Value objects ?

    writeOnceDebugEverywhere(), Mar 23, 2005, in forum: Java
    Replies:
    5
    Views:
    721
    frebe
    Mar 23, 2005
  2. Ian Ward
    Replies:
    1
    Views:
    312
    Jarek Zgoda
    Aug 30, 2006
  3. Ian Ward
    Replies:
    0
    Views:
    273
    Ian Ward
    Sep 25, 2006
  4. Christian
    Replies:
    2
    Views:
    445
    Peter Flynn
    Apr 3, 2008
  5. Alec Taylor
    Replies:
    0
    Views:
    200
    Alec Taylor
    Dec 7, 2012
Loading...

Share This Page