blueimp-templates-rails 2.2.2 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tmpl.js +72 -72
- data/lib/blueimp-templates-rails/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571e8294d42ff37e33c6bc834d3678ab35e92858
|
4
|
+
data.tar.gz: 3f007023a5483bf812c84929d13c45d6bb43710f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a933752d7e3b08bc893220cdf97c5570636f1856c0a9a2af1c8405bd46d9990f5aa91557c52d1e383eb490b13c284aae9725c4fa24540fe98debaa744e98d2d
|
7
|
+
data.tar.gz: ca0145b07e70e88229defd84df6e14a46ae1f3fcb2ef1aab1725fa991a7d49761f43bff471489e72d44d256d15749a35b0de5048ffd40feb6774962cfe961547
|
@@ -1,86 +1,86 @@
|
|
1
1
|
/*
|
2
|
-
* JavaScript Templates
|
2
|
+
* JavaScript Templates
|
3
3
|
* https://github.com/blueimp/JavaScript-Templates
|
4
4
|
*
|
5
5
|
* Copyright 2011, Sebastian Tschan
|
6
6
|
* https://blueimp.net
|
7
7
|
*
|
8
8
|
* Licensed under the MIT license:
|
9
|
-
*
|
9
|
+
* https://opensource.org/licenses/MIT
|
10
10
|
*
|
11
11
|
* Inspired by John Resig's JavaScript Micro-Templating:
|
12
12
|
* http://ejohn.org/blog/javascript-micro-templating/
|
13
13
|
*/
|
14
14
|
|
15
|
-
/*
|
16
|
-
/*global document, define */
|
15
|
+
/* global define */
|
17
16
|
|
18
|
-
(function ($) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return f(data, tmpl);
|
31
|
-
};
|
32
|
-
};
|
33
|
-
tmpl.cache = {};
|
34
|
-
tmpl.load = function (id) {
|
35
|
-
return document.getElementById(id).innerHTML;
|
36
|
-
};
|
37
|
-
tmpl.regexp = /([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
|
38
|
-
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
39
|
-
if (p1) { // whitespace, quote and backspace in interpolation context
|
40
|
-
return {
|
41
|
-
"\n": "\\n",
|
42
|
-
"\r": "\\r",
|
43
|
-
"\t": "\\t",
|
44
|
-
" " : " "
|
45
|
-
}[s] || "\\" + s;
|
46
|
-
}
|
47
|
-
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
48
|
-
if (p2 === "=") {
|
49
|
-
return "'+_e(" + p3 + ")+'";
|
50
|
-
}
|
51
|
-
return "'+" + p3 + "+'";
|
52
|
-
}
|
53
|
-
if (p4) { // evaluation start tag: {%
|
54
|
-
return "';";
|
55
|
-
}
|
56
|
-
if (p5) { // evaluation end tag: %}
|
57
|
-
return "_s+='";
|
58
|
-
}
|
59
|
-
};
|
60
|
-
tmpl.encReg = /[<>&"'\x00]/g;
|
61
|
-
tmpl.encMap = {
|
62
|
-
"<" : "<",
|
63
|
-
">" : ">",
|
64
|
-
"&" : "&",
|
65
|
-
"\"" : """,
|
66
|
-
"'" : "'"
|
67
|
-
};
|
68
|
-
tmpl.encode = function (s) {
|
69
|
-
return String(s).replace(
|
70
|
-
tmpl.encReg,
|
71
|
-
function (c) {
|
72
|
-
return tmpl.encMap[c] || "";
|
73
|
-
}
|
74
|
-
);
|
75
|
-
};
|
76
|
-
tmpl.arg = "o";
|
77
|
-
tmpl.helper = ",print=function(s,e){_s+=e&&(s||'')||_e(s);}" +
|
78
|
-
",include=function(s,d){_s+=tmpl(s,d);}";
|
79
|
-
if (typeof define === "function" && define.amd) {
|
80
|
-
define(function () {
|
81
|
-
return tmpl;
|
82
|
-
});
|
83
|
-
} else {
|
84
|
-
$.tmpl = tmpl;
|
17
|
+
;(function ($) {
|
18
|
+
'use strict'
|
19
|
+
var tmpl = function (str, data) {
|
20
|
+
var f = !/[^\w\-\.:]/.test(str)
|
21
|
+
? tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str))
|
22
|
+
: new Function(// eslint-disable-line no-new-func
|
23
|
+
tmpl.arg + ',tmpl',
|
24
|
+
'var _e=tmpl.encode' + tmpl.helper + ",_s='" +
|
25
|
+
str.replace(tmpl.regexp, tmpl.func) + "';return _s;"
|
26
|
+
)
|
27
|
+
return data ? f(data, tmpl) : function (data) {
|
28
|
+
return f(data, tmpl)
|
85
29
|
}
|
86
|
-
}
|
30
|
+
}
|
31
|
+
tmpl.cache = {}
|
32
|
+
tmpl.load = function (id) {
|
33
|
+
return document.getElementById(id).innerHTML
|
34
|
+
}
|
35
|
+
tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g
|
36
|
+
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
37
|
+
if (p1) { // whitespace, quote and backspace in HTML context
|
38
|
+
return {
|
39
|
+
'\n': '\\n',
|
40
|
+
'\r': '\\r',
|
41
|
+
'\t': '\\t',
|
42
|
+
' ': ' '
|
43
|
+
}[p1] || '\\' + p1
|
44
|
+
}
|
45
|
+
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
46
|
+
if (p2 === '=') {
|
47
|
+
return "'+_e(" + p3 + ")+'"
|
48
|
+
}
|
49
|
+
return "'+(" + p3 + "==null?'':" + p3 + ")+'"
|
50
|
+
}
|
51
|
+
if (p4) { // evaluation start tag: {%
|
52
|
+
return "';"
|
53
|
+
}
|
54
|
+
if (p5) { // evaluation end tag: %}
|
55
|
+
return "_s+='"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
tmpl.encReg = /[<>&"'\x00]/g // eslint-disable-line no-control-regex
|
59
|
+
tmpl.encMap = {
|
60
|
+
'<': '<',
|
61
|
+
'>': '>',
|
62
|
+
'&': '&',
|
63
|
+
'"': '"',
|
64
|
+
"'": '''
|
65
|
+
}
|
66
|
+
tmpl.encode = function (s) {
|
67
|
+
return (s == null ? '' : '' + s).replace(
|
68
|
+
tmpl.encReg,
|
69
|
+
function (c) {
|
70
|
+
return tmpl.encMap[c] || ''
|
71
|
+
}
|
72
|
+
)
|
73
|
+
}
|
74
|
+
tmpl.arg = 'o'
|
75
|
+
tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" +
|
76
|
+
',include=function(s,d){_s+=tmpl(s,d);}'
|
77
|
+
if (typeof define === 'function' && define.amd) {
|
78
|
+
define(function () {
|
79
|
+
return tmpl
|
80
|
+
})
|
81
|
+
} else if (typeof module === 'object' && module.exports) {
|
82
|
+
module.exports = tmpl
|
83
|
+
} else {
|
84
|
+
$.tmpl = tmpl
|
85
|
+
}
|
86
|
+
}(this))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueimp-templates-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Tschan
|
@@ -9,28 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.0'
|
21
|
-
- - <
|
21
|
+
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '6.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '3.0'
|
31
|
-
- - <
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.0'
|
34
34
|
description: This gem wraps the blueimp JavaScript Templates library as a Rails asset
|
35
35
|
gem. The library is by Sebastian Tschan, and the gem is packaged by Mike Virata-Stone.
|
36
36
|
email:
|
@@ -40,10 +40,10 @@ executables: []
|
|
40
40
|
extensions: []
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
|
-
- lib/blueimp-templates-rails.rb
|
44
|
-
- lib/blueimp-templates-rails/version.rb
|
45
43
|
- app/assets/javascripts/blueimp-templates.js
|
46
44
|
- app/assets/javascripts/tmpl.js
|
45
|
+
- lib/blueimp-templates-rails.rb
|
46
|
+
- lib/blueimp-templates-rails/version.rb
|
47
47
|
homepage: https://github.com/blueimp/JavaScript-Templates
|
48
48
|
licenses:
|
49
49
|
- MIT
|
@@ -54,17 +54,17 @@ require_paths:
|
|
54
54
|
- lib
|
55
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.4.8
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Rails asset gem for blueimp JavaScript Templates.
|