Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > Django Plugins

    django-jstemplate 1.1.0

    Download button

    No screenshots available
    Downloads: 64  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Mjumbe Wawatu Ukweli | More programs
    BSD License / FREE
    September 8th, 2012, 05:36 GMT [view history]
    ROOT / Internet / Django Plugins

     Read user reviews (0)  Refer to a friend  Subscribe

    django-jstemplate description

    A Django template tag for embedding Mustache.js -- or other JavaScript templates -- templates safely

    django-jstemplate is a templatetag framework for easier integration of mustache.js, dust.js, handlebars.js, or other JavaScript templates with Django templates. Also will wrap your templates in elements expected for libraries such as ICanHaz.js. Django-jstemplates is extensible, so if your favorite template library is not included, it's easy to add. Inspired by django-icanhaz.

    Quick Usage

    (Read the full docs on Read the Docs)

    Add "jstemplate" to your INSTALLED_APPS setting.

    app/jstemplates/main.mustache:

    < div >
     < p >This is {{ name }}'s template< /p >
    < /div >

    app/templates/main.html:

    {% load jstemplate %}

    < html >
    < head >
     < script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" >< /script >
     < script src="{{ STATIC_URL }}libs/mustache-0.3.0.js" >< /script >
     < script src="{{ STATIC_URL }}libs/django.mustache.js" >< /script >
    < /head >

    < body >
     < div id="dynamic-area" >< /div >

     {% mustachejs "main" %}

     < script >
     $(document).ready(function() {

     var $area = $('#dynamic-area')
     , template;

     template = Mustache.template('main');
     $area.html(template.render());

     });
     < /script >
    < /body >
    < /html >


    Rationale

    The collision between Django templates' use of {{ and }} as template variable markers and mustache.js' use of same has spawned a variety of solutions. One solution simply replaces [[ and ]] with {{ and }} inside an mustachejs template tag; another makes a valiant attempt to reconstruct verbatim text within a chunk of a Django template after it has already been mangled by the Django template tokenizer.

    I prefer to keep my JavaScript templates in separate files in a dedicated directory anyway, to avoid confusion between server-side and client-side templating. So this solution is essentially just an "include" tag that avoids parsing the included file as a Django template.


    Product's homepage

    Requirements:

    · Python
    · Django

    What's New in This Release: [ read full changelog ]

    · Python 3 support!

      


    TAGS:

    templatetag framework | template tag | Django | template | tag

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM