From 9b0f41f17921f63360c6ddce30692af817e11063 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 17 Jul 2012 12:23:46 +0200 Subject: [PATCH 001/105] Added X-UA-Compatible meta tag to force latest IE rendering engine or ChromeFrame if installed. --- index.html | 1 + test/index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/index.html b/index.html index 147a688..40bfa06 100644 --- a/index.html +++ b/index.html @@ -13,6 +13,7 @@ --> + JavaScript Templates Demo diff --git a/test/index.html b/test/index.html index 212dd0f..39a47d7 100644 --- a/test/index.html +++ b/test/index.html @@ -13,6 +13,7 @@ --> + JavaScript Templates Test From 96c33a5410010f4899a32db04b2ace6d064a0f2f Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 14 Nov 2012 14:57:51 +0100 Subject: [PATCH 002/105] Minor README update. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f9d6e9..5f5b9bf 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ var result = tmpl("

{%=p.title%}

", {title: "JavaScript Templates"}); ### Template parsing The template contents are matched and replaced using the regular expression **tmpl.regexp** and the replacement function **tmpl.func**. The replacement function operates based on the [parenthesized submatch strings](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter). -To use different tags for the template syntax, override **tmpl.regexp** with a modified regular expression, by exchanging all occurrences of "**\\{%**" and "**%\\}**", e.g. with "**\\[%**" and "**%\\]**": +To use different tags for the template syntax, override **tmpl.regexp** with a modified regular expression, by exchanging all occurrences of "{%" and "%}", e.g. with "[%" and "%]": ```js tmpl.regexp = /([\s'\\])(?![^%]*%\])|(?:\[%(=|#)([\s\S]+?)%\])|(\[%)|(%\])/g; @@ -300,7 +300,7 @@ Use **include(str, obj)** to include content from a different template: ``` -If else condition: +**If else condition**: ```html {% if (o.author.url) { %} @@ -310,7 +310,7 @@ If else condition: {% } %} ``` -For loop: +**For loop**: ```html