background preloader

Janl/mustache.js

Janl/mustache.js
Related:  Scripting

StringTemplate {{ mustache }} Logic-less templates. Available in Ruby, JavaScript, Python, Erlang, node.js, PHP, Perl, Objective-C, Java, .NET, Android, C++, Go, Lua, ooc, ActionScript, ColdFusion, Scala, Clojure, Fantom, CoffeeScript, D, Haskell, XQuery, ASP, Io, Dart, and for Haxe Works great with TextMate, Vim, Emacs, and Coda The Manual: mustache(5) and mustache(1) Demo <h1>{{header}}</h1> {{#bug}} {{/bug}} {{#items}} {{#first}} <li><strong>{{name}}</strong></li> {{/first}} {{#link}} <li><a href="{{url}}">{{name}}</a></li> {{/link}} {{/items}} {{#empty}} <p>The list is empty.

Underscore.js A Lean and Mean Un-opinionated Templating Engine - CodeProject Download Clifton.Core.TemplateEngine.zip - 89.4 KB Table of Contents Introductory Rant I've fussed with the templating engine RazorEngine in conjunction with Microsoft's Razor parser and code generator and every time I fuss with it, I spend far too much time getting the NuGet dependencies working correctly, and I've never been able to get the whole ApplicationDomain thing working correctly so that I don't end up with hundreds of temporary assembly files in my bin folder. So I'm presenting you with a lean and mean template parser that simply gets the job done. Goals Simple - Let's try to write this in under 500 lines of code. Requirements We should be able to apply template parsing to any kind of text document, not just HTML. Code Blocks A code block always begins with @{ and always ends with a matching }. Literal Copy With a Code Block Inside a code block, a line of text can be copied literally using the @: syntax, for example: Hide Copy Code @: Do not interpret me as code. Variable Replacement

mustache(5) -- Logic-less templates. mustache(5) Mustache Manual mustache(5) mustache - Logic-less templates. A typical Mustache template: Hello {{name}} You have just won {{value}} dollars! {{#in_ca}} Well, {{taxed_value}} dollars, after taxes. {{/in_ca}} Given the following hash: Will produce the following: Hello Chris You have just won 10000 dollars! Mustache can be used for HTML, config files, source code - anything. We call it "logic-less" because there are no if statements, else clauses, or for loops. Tags are indicated by the double mustaches. Variables The most basic tag type is the variable. All variables are HTML escaped by default. You can also use & to unescape a variable: {{& name}}. By default a variable "miss" returns an empty string. Template: * {{name}} * {{age}} * {{company}} * {{{company}}} Hash: Output: Sections Sections render blocks of text one or more times, depending on the value of the key in the current context. A section begins with a pound and ends with a slash. False Values or Empty Lists Shown. Shown. Why?

Prototype v1.7.1 API documentation | Home An object-oriented JavaScript framework Prototype is a JavaScript framework that aims to ease development of dynamic web applications. It offers a familiar class-style OO framework, extensive Ajax support, higher-order programming constructs, and easy DOM manipulation. Targeted platforms Prototype currently targets the following platforms: Microsoft Internet Explorer for Windows, version 6.0 and higherMozilla Firefox 1.5 and higherApple Safari 2.0.4 and higherOpera 9.25 and higherChrome 1.0 and higher Using Prototype To use Prototype in your application, download the latest release from the Prototype web site ( and copy dist/prototype.js to a suitable location. Building Prototype from source prototype.js is a composite file generated from many source files in the src/ directory. From the root Prototype directory, Contributing to Prototype Check out the Prototype source with Find out how to contribute: Documentation

Easy HTML Templates with Mustache Tutorial by Matt Doyle | Level: Beginner | Published on 27 April 2012 Categories: Learn how to create HTML templates using Mustache, the easy-to-use, logic-less template system. Templates are a great way to separate your website's code from its design. There are many great web template systems available for different languages and platforms, including Smarty for PHP and the Django template language for Python. In this tutorial you'll explore Mustache, a relatively new and very simple template system that you can easily use to create HTML templates. The advantages of using Mustache How to install and use the Mustache processor How Mustache tags, variables, and data objects work Using sections to create conditions and loops Including one Mustache template inside another ...and lots more! Along the way, you'll see plenty of code examples that show you how Mustache works. What is Mustache? Mustache is a simple template system that you can use when building websites and web apps. logic-less Perl:

repeatingbeats/invoke - GitHub The Top 10 Javascript MVC Frameworks Reviewed UPDATE 1/14/2012: Added Batman.js and Angular.js due to popular demand and because they looked impressive. Over the last several months I have been in a constant search for the perfect javascript MVC framework. Driven by a dire need for the right level of abstraction and features, I have tried out - some more cursorily than others - every framework I could get my hands on. Here lies a brief synopsis of each framework. Lastly, I share the framework which I ultimately decided on. Specifically, the following four features are very important to me: UI Bindings - I'm not just talking about templates, I'm talking about a declarative approach to automatically updating the view layer when the underlying model changes. The Contenders Here is a table showing all of the frameworks support for the above features. 1. Backbone.js is the web's darling framework. Pros: Strong community and lots of momentum. Cons: Lacks strong abstractions and leaves something to be desired. 2. Pros: Bindings support. 3.

Mustache is a JavaScript template library that helps developers work with JSON objects instead of having their data source return HTML. When you make a network call to gather data from mobile devices, it's best to keep the payload, or the return data, as small as possible. JSON, or JavaScript Object Notation, is a string of characters that can be transformed into any array to pull in data. Most of the popular social networks, including Facebook, Twitter, and foursquare, and APIs, use JSON to return data.

Mustache has a lot of other features, including logic and loops that help you easily build out a list of data with a few lines of code. by indigetal Nov 29

Je test cette lib justement ! (avec node.js mais elle a l'air d'être utilisée aussi coté client.)

franchement avec un nom comme ça c'est normal qu'elle est du succés.... by simonw Nov 26

Related: