| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This file is generated by author/assets.pl. Do not edit manually. |
|
2
|
|
|
|
|
|
|
package Amon2::Setup::Asset::MicroTemplateJS; |
|
3
|
1
|
|
|
1
|
|
393
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
81
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub tags { |
|
7
|
1
|
|
|
1
|
0
|
4
|
<<',,,'; |
|
8
|
|
|
|
|
|
|
<script src="<: uri_for('/static/js/micro_template.js') :>"></script> |
|
9
|
|
|
|
|
|
|
,,, |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub files { |
|
13
|
|
|
|
|
|
|
return { |
|
14
|
0
|
|
|
0
|
0
|
|
'js/micro_template.js' => '// Simple JavaScript Templating |
|
15
|
|
|
|
|
|
|
// John Resig - http://ejohn.org/ - MIT Licensed |
|
16
|
|
|
|
|
|
|
(function(){ |
|
17
|
|
|
|
|
|
|
var cache = {}; |
|
18
|
|
|
|
|
|
|
this.tmpl = function tmpl(str, data){ |
|
19
|
|
|
|
|
|
|
// Figure out if we\'re getting a template, or if we need to |
|
20
|
|
|
|
|
|
|
// load the template - and be sure to cache the result. |
|
21
|
|
|
|
|
|
|
var fn = !/\\W/.test(str) ? |
|
22
|
|
|
|
|
|
|
cache[str] = cache[str] || |
|
23
|
|
|
|
|
|
|
tmpl(document.getElementById(str).innerHTML) : |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
// Generate a reusable function that will serve as a template |
|
26
|
|
|
|
|
|
|
// generator (and which will be cached). |
|
27
|
|
|
|
|
|
|
new Function("obj", |
|
28
|
|
|
|
|
|
|
"var p=[];" + |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
// Introduce the data as local variables using with(){} |
|
31
|
|
|
|
|
|
|
"with(obj){p.push(\'" + |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
// Convert the template into pure JavaScript |
|
34
|
|
|
|
|
|
|
str |
|
35
|
|
|
|
|
|
|
.replace(/[\\r\\t\\n]/g, " ") |
|
36
|
|
|
|
|
|
|
.split("<%").join("\\t") |
|
37
|
|
|
|
|
|
|
.replace(/(^|%>)[^\\t]*?(\\t|$)/g, function(){return arguments[0].split("\'").join("\\\\\'");}) |
|
38
|
|
|
|
|
|
|
.replace(/\\t==(.*?)%>/g,"\',$1,\'") |
|
39
|
|
|
|
|
|
|
.replace(/\\t=(.*?)%>/g, "\',(($1)+\'\').replace(/&/g,\'&\').replace(/</g,\'<\').replace(/>/g,\'>\').replace(/\\"/g,\'"\').replace(/\\\'/g,\''\'),\'") |
|
40
|
|
|
|
|
|
|
.split("\\t").join("\');") |
|
41
|
|
|
|
|
|
|
.split("%>").join("p.push(\'") |
|
42
|
|
|
|
|
|
|
+ "\');}return p.join(\'\');"); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
// Provide some basic currying to the user |
|
45
|
|
|
|
|
|
|
return data ? fn( data ) : fn; |
|
46
|
|
|
|
|
|
|
}; |
|
47
|
|
|
|
|
|
|
})(); |
|
48
|
|
|
|
|
|
|
' |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |