From 68aa5d3e6823c7cf0e3494aef8d3185cca4b7a60 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Sun, 14 Sep 2014 00:05:00 +0100 Subject: [PATCH 01/85] Use https for the demo. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index de42e76..853710f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JavaScript Templates ## Demo -[JavaScript Templates Demo](http://blueimp.github.io/JavaScript-Templates/) +[JavaScript Templates Demo](https://blueimp.github.io/JavaScript-Templates/) ## Description < 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers. @@ -62,7 +62,7 @@ document.getElementById("result").innerHTML = tmpl("tmpl-demo", data); The following is an example how to use the JavaScript Templates engine on the server-side with [node.js](http://nodejs.org/). -Create a new directory and add the **tmpl.js** file. Or alternatively, install the **blueimp-tmpl** package with [npm](http://npmjs.org/): +Create a new directory and add the **tmpl.js** file. Or alternatively, install the **blueimp-tmpl** package with [npm](https://www.npmjs.org/): ```sh npm install blueimp-tmpl @@ -291,7 +291,7 @@ Use **include(str, obj)** to include content from a different template: ```html
-{% include('tmpl-link', {name: "Website", url: "http://example.org"}); %} +{% include('tmpl-link', {name: "Website", url: "https://example.org"}); %}
``` @@ -319,7 +319,7 @@ Use **include(str, obj)** to include content from a different template: The JavaScript Templates project comes with a compilation script, that allows you to compile your templates into JavaScript code and combine them with a minimal Templates runtime into one minified JavaScript file. The compilation script is built for [node.js](http://nodejs.org/) and also requires [UglifyJS](https://github.com/mishoo/UglifyJS). -To use it, first install both the JavaScript Templates project and UglifyJS via [npm](http://npmjs.org/): +To use it, first install both the JavaScript Templates project and UglifyJS via [npm](https://www.npmjs.org/): ```sh npm install uglify-js @@ -338,7 +338,7 @@ The files given as command line arguments to **tmpl.js** can either be pure temp The generated file can be included in your project as a replacement for the original **tmpl.js** runtime. It provides you with the same API and provides a **tmpl(id, data)** function that accepts the id of one of your templates as first and a data object as optional second parameter. ## Tests -The JavaScript Templates project comes with [Unit Tests](http://en.wikipedia.org/wiki/Unit_testing). +The JavaScript Templates project comes with [Unit Tests](https://en.wikipedia.org/wiki/Unit_testing). There are two different ways to run the tests: * Open test/index.html in your browser or From 587fd7c683e5df40597a19bf162abd8081abdcb4 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Sun, 14 Sep 2014 22:58:41 +0100 Subject: [PATCH 02/85] Use the https version of the test resources. --- test/index.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/index.html b/test/index.html index 5827909..a83c7c3 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ - + - + diff --git a/js/compile.js b/js/compile.js index 84ff2ce..0bf0144 100755 --- a/js/compile.js +++ b/js/compile.js @@ -1,6 +1,6 @@ #!/usr/bin/env node /* - * JavaScript Templates Compiler 2.4.0 + * JavaScript Templates Compiler * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -53,7 +53,7 @@ if (index > 1) { stats = fs.statSync(file); if (!stats.isFile()) { - console.error(file + ' is not a file.'); + console.error(file + " is not a file."); return; } content = fs.readFileSync(file, "utf8"); @@ -74,7 +74,7 @@ } }); if (!list.length) { - console.error('Missing input file.'); + console.error("Missing input file."); return; } // Combine the generated functions as cache of the minimal runtime: diff --git a/js/demo.js b/js/demo.js index afcedc2..2862415 100644 --- a/js/demo.js +++ b/js/demo.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Demo JS 2.4.0 + * JavaScript Templates Demo * https://github.com/blueimp/JavaScript-Templates * * Copyright 2013, Sebastian Tschan diff --git a/js/runtime.js b/js/runtime.js index c4121fd..cb4c27e 100644 --- a/js/runtime.js +++ b/js/runtime.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Runtime 2.4.1 + * JavaScript Templates Runtime * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -9,10 +9,10 @@ * http://www.opensource.org/licenses/MIT */ -/*jslint sloppy: true */ /*global define */ (function ($) { + "use strict"; var tmpl = function (id, data) { var f = tmpl.cache[id]; return data ? f(data, tmpl) : function (data) { diff --git a/js/tmpl.js b/js/tmpl.js index 9380053..90b9e42 100644 --- a/js/tmpl.js +++ b/js/tmpl.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates 2.4.1 + * JavaScript Templates * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -12,7 +12,7 @@ * http://ejohn.org/blog/javascript-micro-templating/ */ -/*jslint evil: true, regexp: true, unparam: true */ +/*jshint evil: true */ /*global document, define */ (function ($) { @@ -21,7 +21,7 @@ var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str)) : new Function( - tmpl.arg + ',tmpl', + tmpl.arg + ",tmpl", "var _e=tmpl.encode" + tmpl.helper + ",_s='" + str.replace(tmpl.regexp, tmpl.func) + "';return _s;" diff --git a/test/index.html b/test/index.html index 9bdd78b..5be1e78 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ JavaScript Templates Demo - +

JavaScript Templates Demo

-

< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies.
-Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.

+

1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies.
+Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.