cmstyle 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/app/assets/images/novartis-micro.png +0 -0
- data/lib/app/assets/images/novartis-small.png +0 -0
- data/lib/app/assets/javascripts/application.js +16 -0
- data/lib/app/assets/stylesheets/application.css +96 -0
- data/lib/app/views/{cmstyle → layouts}/_footer.slim +0 -0
- data/lib/app/views/layouts/_header.slim +34 -0
- data/lib/app/views/layouts/_modals.slim +66 -0
- data/lib/app/views/layouts/application.slim +35 -0
- data/lib/assets/images/8020select.png +0 -0
- data/lib/assets/images/adoptahydrant.png +0 -0
- data/lib/assets/images/apple-touch-icon-114-precomposed.png +0 -0
- data/lib/assets/images/apple-touch-icon-144-precomposed.png +0 -0
- data/lib/assets/images/apple-touch-icon-57-precomposed.png +0 -0
- data/lib/assets/images/apple-touch-icon-72-precomposed.png +0 -0
- data/lib/assets/images/bootstrap-example-carousel.png +0 -0
- data/lib/assets/images/bootstrap-example-fluid.jpg +0 -0
- data/lib/assets/images/bootstrap-example-hero.jpg +0 -0
- data/lib/assets/images/bootstrap-example-marketing-narrow.png +0 -0
- data/lib/assets/images/bootstrap-example-signin.png +0 -0
- data/lib/assets/images/bootstrap-example-starter.jpg +0 -0
- data/lib/assets/images/bootstrap-example-sticky-footer.png +0 -0
- data/lib/assets/images/bootstrap-mdo-sfmoma-01.jpg +0 -0
- data/lib/assets/images/bootstrap-mdo-sfmoma-02.jpg +0 -0
- data/lib/assets/images/bootstrap-mdo-sfmoma-03.jpg +0 -0
- data/lib/assets/images/breakingnews.png +0 -0
- data/lib/assets/images/browser-icon-chrome.png +0 -0
- data/lib/assets/images/browser-icon-firefox.png +0 -0
- data/lib/assets/images/browser-icon-safari.png +0 -0
- data/lib/assets/images/bs-docs-bootstrap-features.png +0 -0
- data/lib/assets/images/bs-docs-masthead-pattern.png +0 -0
- data/lib/assets/images/bs-docs-responsive-illustrations.png +0 -0
- data/lib/assets/images/bs-docs-twitter-github.png +0 -0
- data/lib/assets/images/fleetio.png +0 -0
- data/lib/assets/images/gathercontent.png +0 -0
- data/lib/assets/images/glyphicons-halflings-white.png +0 -0
- data/lib/assets/images/glyphicons-halflings.png +0 -0
- data/lib/assets/images/grid-baseline-20px.png +0 -0
- data/lib/assets/images/jshint.png +0 -0
- data/lib/assets/images/kippt.png +0 -0
- data/lib/assets/images/less-logo-large.png +0 -0
- data/lib/assets/images/logo.png +0 -0
- data/lib/assets/images/noise.png +0 -0
- data/lib/assets/images/responsive-illustrations.png +0 -0
- data/lib/assets/images/slide-01.jpg +0 -0
- data/lib/assets/images/slide-02.jpg +0 -0
- data/lib/assets/images/slide-03.jpg +0 -0
- data/lib/assets/images/small-hogan-icon.png +0 -0
- data/lib/assets/images/soundready.png +0 -0
- data/lib/assets/images/stripes.png +0 -0
- data/lib/assets/javascripts/application.js +154 -0
- data/lib/assets/javascripts/bootstrap-affix.js +19 -0
- data/lib/assets/javascripts/bootstrap-alert.js +56 -0
- data/lib/assets/javascripts/bootstrap-button.js +96 -0
- data/lib/assets/javascripts/bootstrap-carousel.js +63 -0
- data/lib/assets/javascripts/bootstrap-collapse.js +88 -0
- data/lib/assets/javascripts/bootstrap-dropdown.js +145 -0
- data/lib/assets/javascripts/bootstrap-modal.js +114 -0
- data/lib/assets/javascripts/bootstrap-phantom.js +21 -0
- data/lib/assets/javascripts/bootstrap-popover.js +107 -0
- data/lib/assets/javascripts/bootstrap-scrollspy.js +31 -0
- data/lib/assets/javascripts/bootstrap-tab.js +80 -0
- data/lib/assets/javascripts/bootstrap-tooltip.js +153 -0
- data/lib/assets/javascripts/bootstrap-transition.js +13 -0
- data/lib/assets/javascripts/bootstrap-typeahead.js +199 -0
- data/lib/assets/javascripts/compiler.js +348 -0
- data/lib/assets/javascripts/hogan-1.0.5.amd.js +576 -0
- data/lib/assets/javascripts/hogan-1.0.5.common.js +576 -0
- data/lib/assets/javascripts/hogan-1.0.5.js +572 -0
- data/lib/assets/javascripts/hogan-1.0.5.mustache.js +619 -0
- data/lib/assets/javascripts/hogan.js +545 -0
- data/lib/assets/javascripts/index.js +848 -0
- data/lib/assets/javascripts/jquery.js +2 -0
- data/lib/assets/javascripts/mustache.js +90 -0
- data/lib/assets/javascripts/phantom.js +63 -0
- data/lib/assets/javascripts/prettify.js +0 -0
- data/lib/assets/javascripts/qunit.js +1510 -0
- data/lib/assets/javascripts/release.js +74 -0
- data/lib/assets/javascripts/server.js +14 -0
- data/lib/assets/javascripts/spec.js +77 -0
- data/lib/assets/javascripts/template-1.0.5.js +233 -0
- data/lib/assets/javascripts/template.js +233 -0
- data/lib/assets/javascripts/web_templates.js +32 -0
- data/lib/assets/stylesheets/bootstrap.css +2 -2
- data/lib/assets/stylesheets/css-tests.css +139 -0
- data/lib/assets/stylesheets/docs.css +1015 -0
- data/lib/assets/stylesheets/layout.css +206 -0
- data/lib/assets/stylesheets/prettify.css +0 -0
- data/lib/assets/stylesheets/qunit.css +232 -0
- data/lib/assets/stylesheets/skeleton.css +236 -0
- data/lib/cmstyle/railtie.rb +7 -0
- data/lib/cmstyle/version.rb +1 -1
- data/lib/cmstyle.rb +2 -1
- data/lib/tasks/cleanup.rake +52 -0
- data/lib/tasks/setup.rake +32 -0
- metadata +90 -6
- data/lib/app/views/cmstyle/_header.slim +0 -40
- data/lib/app/views/cmstyle/_modals.slim +0 -62
@@ -0,0 +1,74 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2011 Twitter, Inc.
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
* you may not use this file except in compliance with the License.
|
5
|
+
* You may obtain a copy of the License at
|
6
|
+
*
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
* See the License for the specific language governing permissions and
|
13
|
+
* limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var fs = require('fs');
|
17
|
+
var path = require('path');
|
18
|
+
var Hogan = require(__dirname + '/../lib/hogan');
|
19
|
+
var minlicense = '/**\n* @preserve Copyright 2012 Twitter, Inc.\n* @license http://www.apache.org/licenses/LICENSE-2.0.txt\n*/\n';
|
20
|
+
|
21
|
+
function read(path) {
|
22
|
+
return fs.readFileSync(path).toString()
|
23
|
+
}
|
24
|
+
|
25
|
+
// Good enough for little js files
|
26
|
+
function copy(src, dst) {
|
27
|
+
return fs.writeFileSync(dst, read(src));
|
28
|
+
}
|
29
|
+
|
30
|
+
function uglify(src, dst) {
|
31
|
+
var jsp = require("uglify-js").parser;
|
32
|
+
var pro = require("uglify-js").uglify;
|
33
|
+
var orig_code = read(src);
|
34
|
+
var ast = jsp.parse(orig_code); // parse code and get the initial AST
|
35
|
+
ast = pro.ast_mangle(ast); // get a new AST with mangled names
|
36
|
+
ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
|
37
|
+
fs.writeFileSync(dst, minlicense + pro.gen_code(ast));
|
38
|
+
}
|
39
|
+
|
40
|
+
var packageJSON = JSON.parse(read('package.json'));
|
41
|
+
var version = packageJSON.version.substring(0, packageJSON.version.indexOf('-'));
|
42
|
+
|
43
|
+
function removeFirstComment(text) {
|
44
|
+
return text.substring(text.indexOf('*/') + 2);
|
45
|
+
}
|
46
|
+
|
47
|
+
var context = {
|
48
|
+
template: removeFirstComment(read(__dirname + '/../lib/template.js')),
|
49
|
+
compiler: removeFirstComment(read(__dirname + '/../lib/compiler.js'))
|
50
|
+
};
|
51
|
+
|
52
|
+
var wrapperPath = '/../wrappers/';
|
53
|
+
var wrappers = fs.readdirSync(__dirname + wrapperPath).map(function(f) {
|
54
|
+
return __dirname + wrapperPath + f;
|
55
|
+
});
|
56
|
+
|
57
|
+
var distPath = __dirname + '/../dist/';
|
58
|
+
wrappers.forEach(function(wrapper) {
|
59
|
+
var tail = path.basename(wrapper, '.mustache');
|
60
|
+
var target = distPath + 'hogan-' + version + '.' + tail;
|
61
|
+
var uglified = distPath + 'hogan-' + version + '.min.' + tail;
|
62
|
+
fs.writeFileSync(target, Hogan.compile(read(wrapper)).render(context));
|
63
|
+
uglify(target, uglified);
|
64
|
+
});
|
65
|
+
|
66
|
+
// Also release Hogan.Template on its own.
|
67
|
+
var templateTarget = distPath + 'template-' + version + '.js';
|
68
|
+
fs.writeFileSync(templateTarget, read(__dirname + '/../lib/template.js'));
|
69
|
+
uglify(templateTarget, distPath + 'template-' + version + '.min.js');
|
70
|
+
|
71
|
+
// Add packageJSON to node distribution
|
72
|
+
packageJSON.version = version;
|
73
|
+
fs.writeFileSync(__dirname + '/../dist/nodejs/package.json',
|
74
|
+
JSON.stringify(packageJSON, null, " "));
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* Simple connect server for phantom.js
|
3
|
+
* Adapted from Modernizr
|
4
|
+
*/
|
5
|
+
|
6
|
+
var connect = require('connect')
|
7
|
+
, http = require('http')
|
8
|
+
, fs = require('fs')
|
9
|
+
, app = connect()
|
10
|
+
.use(connect.static(__dirname + '/../../'));
|
11
|
+
|
12
|
+
http.createServer(app).listen(3000);
|
13
|
+
|
14
|
+
fs.writeFileSync(__dirname + '/pid.txt', process.pid, 'utf-8')
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2011 Twitter, Inc.
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
* you may not use this file except in compliance with the License.
|
5
|
+
* You may obtain a copy of the License at
|
6
|
+
*
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
* See the License for the specific language governing permissions and
|
13
|
+
* limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var Hogan = Hogan || require('../lib/hogan');
|
17
|
+
var doc = this["document"];
|
18
|
+
var fs = require('fs');
|
19
|
+
|
20
|
+
var passed = 0;
|
21
|
+
var failed = 0;
|
22
|
+
|
23
|
+
if (!this["output"]) {
|
24
|
+
var output = function (string) {
|
25
|
+
return doc ? doc.write(string + '<br/>') : console.log(string);
|
26
|
+
};
|
27
|
+
}
|
28
|
+
|
29
|
+
function runTest(tests) {
|
30
|
+
tests.forEach(function(test) {
|
31
|
+
var partials = {};
|
32
|
+
for (var i in test.partials) {
|
33
|
+
partials[i] = Hogan.compile(test.partials[i]);
|
34
|
+
}
|
35
|
+
var t = Hogan.compile(test.template);
|
36
|
+
|
37
|
+
if (test.data.lambda) {
|
38
|
+
var func = (new Function ('return ' + test.data.lambda.js)());
|
39
|
+
test.data.lambda = function() { return func; };
|
40
|
+
}
|
41
|
+
|
42
|
+
var s = t.render(test.data, partials);
|
43
|
+
is(s, test.expected, test.name + ': ' + test.desc);
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
47
|
+
var testDir = './test/spec/specs';
|
48
|
+
var files = fs.readdirSync(testDir)
|
49
|
+
.filter(function(f) { return f.indexOf('.json') > 0; })
|
50
|
+
.map(function(f) { return testDir + '/' + f});
|
51
|
+
|
52
|
+
for (var i = 0; i < files.length; i++) {
|
53
|
+
var test = JSON.parse(fs.readFileSync(files[i]).toString());
|
54
|
+
runTest(test.tests);
|
55
|
+
}
|
56
|
+
|
57
|
+
function is(got, expected, msg) {
|
58
|
+
if (got === expected) {
|
59
|
+
output("OK: " + msg);
|
60
|
+
++passed;
|
61
|
+
} else {
|
62
|
+
output("FAIL: " + msg);
|
63
|
+
output("Expected |" + expected + "|");
|
64
|
+
output(" Got |" + got + "|");
|
65
|
+
++failed;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
function complete() {
|
70
|
+
output("\nTests Complete");
|
71
|
+
output("--------------");
|
72
|
+
output("Passed: " + passed);
|
73
|
+
output("Failed: " + failed);
|
74
|
+
output("\n");
|
75
|
+
}
|
76
|
+
|
77
|
+
complete();
|
@@ -0,0 +1,233 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2011 Twitter, Inc.
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
* you may not use this file except in compliance with the License.
|
5
|
+
* You may obtain a copy of the License at
|
6
|
+
*
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
* See the License for the specific language governing permissions and
|
13
|
+
* limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var Hogan = {};
|
17
|
+
|
18
|
+
(function (Hogan) {
|
19
|
+
Hogan.Template = function constructor(renderFunc, text, compiler) {
|
20
|
+
if (renderFunc) {
|
21
|
+
this.r = renderFunc;
|
22
|
+
}
|
23
|
+
this.c = compiler;
|
24
|
+
this.text = text || '';
|
25
|
+
}
|
26
|
+
|
27
|
+
Hogan.Template.prototype = {
|
28
|
+
// render: replaced by generated code.
|
29
|
+
r: function (context, partials, indent) { return ''; },
|
30
|
+
|
31
|
+
// variable escaping
|
32
|
+
v: hoganEscape,
|
33
|
+
|
34
|
+
render: function render(context, partials, indent) {
|
35
|
+
return this.ri([context], partials || {}, indent);
|
36
|
+
},
|
37
|
+
|
38
|
+
// render internal -- a hook for overrides that catches partials too
|
39
|
+
ri: function (context, partials, indent) {
|
40
|
+
return this.r(context, partials, indent);
|
41
|
+
},
|
42
|
+
|
43
|
+
// tries to find a partial in the curent scope and render it
|
44
|
+
rp: function(name, context, partials, indent) {
|
45
|
+
var partial = partials[name];
|
46
|
+
|
47
|
+
if (!partial) {
|
48
|
+
return '';
|
49
|
+
}
|
50
|
+
|
51
|
+
if (this.c && typeof partial == 'string') {
|
52
|
+
partial = this.c.compile(partial);
|
53
|
+
}
|
54
|
+
|
55
|
+
return partial.ri(context, partials, indent);
|
56
|
+
},
|
57
|
+
|
58
|
+
// render a section
|
59
|
+
rs: function(context, partials, section) {
|
60
|
+
var buf = '',
|
61
|
+
tail = context[context.length - 1];
|
62
|
+
|
63
|
+
if (!isArray(tail)) {
|
64
|
+
return buf = section(context, partials);
|
65
|
+
}
|
66
|
+
|
67
|
+
for (var i = 0; i < tail.length; i++) {
|
68
|
+
context.push(tail[i]);
|
69
|
+
buf += section(context, partials);
|
70
|
+
context.pop();
|
71
|
+
}
|
72
|
+
|
73
|
+
return buf;
|
74
|
+
},
|
75
|
+
|
76
|
+
// maybe start a section
|
77
|
+
s: function(val, ctx, partials, inverted, start, end, tags) {
|
78
|
+
var pass;
|
79
|
+
|
80
|
+
if (isArray(val) && val.length === 0) {
|
81
|
+
return false;
|
82
|
+
}
|
83
|
+
|
84
|
+
if (typeof val == 'function') {
|
85
|
+
val = this.ls(val, ctx, partials, inverted, start, end, tags);
|
86
|
+
}
|
87
|
+
|
88
|
+
pass = (val === '') || !!val;
|
89
|
+
|
90
|
+
if (!inverted && pass && ctx) {
|
91
|
+
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
|
92
|
+
}
|
93
|
+
|
94
|
+
return pass;
|
95
|
+
},
|
96
|
+
|
97
|
+
// find values with dotted names
|
98
|
+
d: function(key, ctx, partials, returnFound) {
|
99
|
+
var names = key.split('.'),
|
100
|
+
val = this.f(names[0], ctx, partials, returnFound),
|
101
|
+
cx = null;
|
102
|
+
|
103
|
+
if (key === '.' && isArray(ctx[ctx.length - 2])) {
|
104
|
+
return ctx[ctx.length - 1];
|
105
|
+
}
|
106
|
+
|
107
|
+
for (var i = 1; i < names.length; i++) {
|
108
|
+
if (val && typeof val == 'object' && names[i] in val) {
|
109
|
+
cx = val;
|
110
|
+
val = val[names[i]];
|
111
|
+
} else {
|
112
|
+
val = '';
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
if (returnFound && !val) {
|
117
|
+
return false;
|
118
|
+
}
|
119
|
+
|
120
|
+
if (!returnFound && typeof val == 'function') {
|
121
|
+
ctx.push(cx);
|
122
|
+
val = this.lv(val, ctx, partials);
|
123
|
+
ctx.pop();
|
124
|
+
}
|
125
|
+
|
126
|
+
return val;
|
127
|
+
},
|
128
|
+
|
129
|
+
// find values with normal names
|
130
|
+
f: function(key, ctx, partials, returnFound) {
|
131
|
+
var val = false,
|
132
|
+
v = null,
|
133
|
+
found = false;
|
134
|
+
|
135
|
+
for (var i = ctx.length - 1; i >= 0; i--) {
|
136
|
+
v = ctx[i];
|
137
|
+
if (v && typeof v == 'object' && key in v) {
|
138
|
+
val = v[key];
|
139
|
+
found = true;
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
if (!found) {
|
145
|
+
return (returnFound) ? false : "";
|
146
|
+
}
|
147
|
+
|
148
|
+
if (!returnFound && typeof val == 'function') {
|
149
|
+
val = this.lv(val, ctx, partials);
|
150
|
+
}
|
151
|
+
|
152
|
+
return val;
|
153
|
+
},
|
154
|
+
|
155
|
+
// higher order templates
|
156
|
+
ho: function(val, cx, partials, text, tags) {
|
157
|
+
var compiler = this.c;
|
158
|
+
var t = val.call(cx, text, function(t) {
|
159
|
+
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
|
160
|
+
});
|
161
|
+
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
|
162
|
+
this.b = s;
|
163
|
+
return false;
|
164
|
+
},
|
165
|
+
|
166
|
+
// higher order template result buffer
|
167
|
+
b: '',
|
168
|
+
|
169
|
+
// lambda replace section
|
170
|
+
ls: function(val, ctx, partials, inverted, start, end, tags) {
|
171
|
+
var cx = ctx[ctx.length - 1],
|
172
|
+
t = null;
|
173
|
+
|
174
|
+
if (!inverted && this.c && val.length > 0) {
|
175
|
+
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
|
176
|
+
}
|
177
|
+
|
178
|
+
t = val.call(cx);
|
179
|
+
|
180
|
+
if (typeof t == 'function') {
|
181
|
+
if (inverted) {
|
182
|
+
return true;
|
183
|
+
} else if (this.c) {
|
184
|
+
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
return t;
|
189
|
+
},
|
190
|
+
|
191
|
+
// lambda replace variable
|
192
|
+
lv: function(val, ctx, partials) {
|
193
|
+
var cx = ctx[ctx.length - 1];
|
194
|
+
var result = val.call(cx);
|
195
|
+
if (typeof result == 'function') {
|
196
|
+
result = result.call(cx);
|
197
|
+
}
|
198
|
+
result = result.toString();
|
199
|
+
|
200
|
+
if (this.c && ~result.indexOf("{{")) {
|
201
|
+
return this.c.compile(result).render(cx, partials);
|
202
|
+
}
|
203
|
+
|
204
|
+
return result;
|
205
|
+
}
|
206
|
+
|
207
|
+
};
|
208
|
+
|
209
|
+
var rAmp = /&/g,
|
210
|
+
rLt = /</g,
|
211
|
+
rGt = />/g,
|
212
|
+
rApos =/\'/g,
|
213
|
+
rQuot = /\"/g,
|
214
|
+
hChars =/[&<>\"\']/;
|
215
|
+
|
216
|
+
function hoganEscape(str) {
|
217
|
+
str = String((str === null || str === undefined) ? '' : str);
|
218
|
+
return hChars.test(str) ?
|
219
|
+
str
|
220
|
+
.replace(rAmp,'&')
|
221
|
+
.replace(rLt,'<')
|
222
|
+
.replace(rGt,'>')
|
223
|
+
.replace(rApos,''')
|
224
|
+
.replace(rQuot, '"') :
|
225
|
+
str;
|
226
|
+
}
|
227
|
+
|
228
|
+
var isArray = Array.isArray || function(a) {
|
229
|
+
return Object.prototype.toString.call(a) === '[object Array]';
|
230
|
+
};
|
231
|
+
|
232
|
+
})(typeof exports !== 'undefined' ? exports : Hogan);
|
233
|
+
|
@@ -0,0 +1,233 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2011 Twitter, Inc.
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
* you may not use this file except in compliance with the License.
|
5
|
+
* You may obtain a copy of the License at
|
6
|
+
*
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
* See the License for the specific language governing permissions and
|
13
|
+
* limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var Hogan = {};
|
17
|
+
|
18
|
+
(function (Hogan) {
|
19
|
+
Hogan.Template = function constructor(renderFunc, text, compiler) {
|
20
|
+
if (renderFunc) {
|
21
|
+
this.r = renderFunc;
|
22
|
+
}
|
23
|
+
this.c = compiler;
|
24
|
+
this.text = text || '';
|
25
|
+
}
|
26
|
+
|
27
|
+
Hogan.Template.prototype = {
|
28
|
+
// render: replaced by generated code.
|
29
|
+
r: function (context, partials, indent) { return ''; },
|
30
|
+
|
31
|
+
// variable escaping
|
32
|
+
v: hoganEscape,
|
33
|
+
|
34
|
+
render: function render(context, partials, indent) {
|
35
|
+
return this.ri([context], partials || {}, indent);
|
36
|
+
},
|
37
|
+
|
38
|
+
// render internal -- a hook for overrides that catches partials too
|
39
|
+
ri: function (context, partials, indent) {
|
40
|
+
return this.r(context, partials, indent);
|
41
|
+
},
|
42
|
+
|
43
|
+
// tries to find a partial in the curent scope and render it
|
44
|
+
rp: function(name, context, partials, indent) {
|
45
|
+
var partial = partials[name];
|
46
|
+
|
47
|
+
if (!partial) {
|
48
|
+
return '';
|
49
|
+
}
|
50
|
+
|
51
|
+
if (this.c && typeof partial == 'string') {
|
52
|
+
partial = this.c.compile(partial);
|
53
|
+
}
|
54
|
+
|
55
|
+
return partial.ri(context, partials, indent);
|
56
|
+
},
|
57
|
+
|
58
|
+
// render a section
|
59
|
+
rs: function(context, partials, section) {
|
60
|
+
var buf = '',
|
61
|
+
tail = context[context.length - 1];
|
62
|
+
|
63
|
+
if (!isArray(tail)) {
|
64
|
+
return buf = section(context, partials);
|
65
|
+
}
|
66
|
+
|
67
|
+
for (var i = 0; i < tail.length; i++) {
|
68
|
+
context.push(tail[i]);
|
69
|
+
buf += section(context, partials);
|
70
|
+
context.pop();
|
71
|
+
}
|
72
|
+
|
73
|
+
return buf;
|
74
|
+
},
|
75
|
+
|
76
|
+
// maybe start a section
|
77
|
+
s: function(val, ctx, partials, inverted, start, end, tags) {
|
78
|
+
var pass;
|
79
|
+
|
80
|
+
if (isArray(val) && val.length === 0) {
|
81
|
+
return false;
|
82
|
+
}
|
83
|
+
|
84
|
+
if (typeof val == 'function') {
|
85
|
+
val = this.ls(val, ctx, partials, inverted, start, end, tags);
|
86
|
+
}
|
87
|
+
|
88
|
+
pass = (val === '') || !!val;
|
89
|
+
|
90
|
+
if (!inverted && pass && ctx) {
|
91
|
+
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
|
92
|
+
}
|
93
|
+
|
94
|
+
return pass;
|
95
|
+
},
|
96
|
+
|
97
|
+
// find values with dotted names
|
98
|
+
d: function(key, ctx, partials, returnFound) {
|
99
|
+
var names = key.split('.'),
|
100
|
+
val = this.f(names[0], ctx, partials, returnFound),
|
101
|
+
cx = null;
|
102
|
+
|
103
|
+
if (key === '.' && isArray(ctx[ctx.length - 2])) {
|
104
|
+
return ctx[ctx.length - 1];
|
105
|
+
}
|
106
|
+
|
107
|
+
for (var i = 1; i < names.length; i++) {
|
108
|
+
if (val && typeof val == 'object' && names[i] in val) {
|
109
|
+
cx = val;
|
110
|
+
val = val[names[i]];
|
111
|
+
} else {
|
112
|
+
val = '';
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
if (returnFound && !val) {
|
117
|
+
return false;
|
118
|
+
}
|
119
|
+
|
120
|
+
if (!returnFound && typeof val == 'function') {
|
121
|
+
ctx.push(cx);
|
122
|
+
val = this.lv(val, ctx, partials);
|
123
|
+
ctx.pop();
|
124
|
+
}
|
125
|
+
|
126
|
+
return val;
|
127
|
+
},
|
128
|
+
|
129
|
+
// find values with normal names
|
130
|
+
f: function(key, ctx, partials, returnFound) {
|
131
|
+
var val = false,
|
132
|
+
v = null,
|
133
|
+
found = false;
|
134
|
+
|
135
|
+
for (var i = ctx.length - 1; i >= 0; i--) {
|
136
|
+
v = ctx[i];
|
137
|
+
if (v && typeof v == 'object' && key in v) {
|
138
|
+
val = v[key];
|
139
|
+
found = true;
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
if (!found) {
|
145
|
+
return (returnFound) ? false : "";
|
146
|
+
}
|
147
|
+
|
148
|
+
if (!returnFound && typeof val == 'function') {
|
149
|
+
val = this.lv(val, ctx, partials);
|
150
|
+
}
|
151
|
+
|
152
|
+
return val;
|
153
|
+
},
|
154
|
+
|
155
|
+
// higher order templates
|
156
|
+
ho: function(val, cx, partials, text, tags) {
|
157
|
+
var compiler = this.c;
|
158
|
+
var t = val.call(cx, text, function(t) {
|
159
|
+
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
|
160
|
+
});
|
161
|
+
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
|
162
|
+
this.b = s;
|
163
|
+
return false;
|
164
|
+
},
|
165
|
+
|
166
|
+
// higher order template result buffer
|
167
|
+
b: '',
|
168
|
+
|
169
|
+
// lambda replace section
|
170
|
+
ls: function(val, ctx, partials, inverted, start, end, tags) {
|
171
|
+
var cx = ctx[ctx.length - 1],
|
172
|
+
t = null;
|
173
|
+
|
174
|
+
if (!inverted && this.c && val.length > 0) {
|
175
|
+
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
|
176
|
+
}
|
177
|
+
|
178
|
+
t = val.call(cx);
|
179
|
+
|
180
|
+
if (typeof t == 'function') {
|
181
|
+
if (inverted) {
|
182
|
+
return true;
|
183
|
+
} else if (this.c) {
|
184
|
+
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
return t;
|
189
|
+
},
|
190
|
+
|
191
|
+
// lambda replace variable
|
192
|
+
lv: function(val, ctx, partials) {
|
193
|
+
var cx = ctx[ctx.length - 1];
|
194
|
+
var result = val.call(cx);
|
195
|
+
if (typeof result == 'function') {
|
196
|
+
result = result.call(cx);
|
197
|
+
}
|
198
|
+
result = result.toString();
|
199
|
+
|
200
|
+
if (this.c && ~result.indexOf("{{")) {
|
201
|
+
return this.c.compile(result).render(cx, partials);
|
202
|
+
}
|
203
|
+
|
204
|
+
return result;
|
205
|
+
}
|
206
|
+
|
207
|
+
};
|
208
|
+
|
209
|
+
var rAmp = /&/g,
|
210
|
+
rLt = /</g,
|
211
|
+
rGt = />/g,
|
212
|
+
rApos =/\'/g,
|
213
|
+
rQuot = /\"/g,
|
214
|
+
hChars =/[&<>\"\']/;
|
215
|
+
|
216
|
+
function hoganEscape(str) {
|
217
|
+
str = String((str === null || str === undefined) ? '' : str);
|
218
|
+
return hChars.test(str) ?
|
219
|
+
str
|
220
|
+
.replace(rAmp,'&')
|
221
|
+
.replace(rLt,'<')
|
222
|
+
.replace(rGt,'>')
|
223
|
+
.replace(rApos,''')
|
224
|
+
.replace(rQuot, '"') :
|
225
|
+
str;
|
226
|
+
}
|
227
|
+
|
228
|
+
var isArray = Array.isArray || function(a) {
|
229
|
+
return Object.prototype.toString.call(a) === '[object Array]';
|
230
|
+
};
|
231
|
+
|
232
|
+
})(typeof exports !== 'undefined' ? exports : Hogan);
|
233
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2011 Twitter, Inc.
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
* you may not use this file except in compliance with the License.
|
5
|
+
* You may obtain a copy of the License at
|
6
|
+
*
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
* See the License for the specific language governing permissions and
|
13
|
+
* limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var Hogan = require(__dirname + '/../lib/hogan.js');
|
17
|
+
var fs = require('fs');
|
18
|
+
var path = require('path');
|
19
|
+
|
20
|
+
// Substitute variables in the homepage with values from package.json
|
21
|
+
var homeTemplatePath = __dirname + '/../build/gh-pages/index.html.mustache';
|
22
|
+
var contextPath = __dirname + '/../dist/nodejs/package.json';
|
23
|
+
|
24
|
+
var homepage = fs.readFileSync(homeTemplatePath).toString();
|
25
|
+
var context = JSON.parse(fs.readFileSync(contextPath).toString());
|
26
|
+
|
27
|
+
var template = Hogan.compile(homepage);
|
28
|
+
|
29
|
+
fs.writeFileSync(path.dirname(homeTemplatePath) + '/index.html',
|
30
|
+
template.render(context));
|
31
|
+
|
32
|
+
fs.unlinkSync(homeTemplatePath);
|
@@ -2151,7 +2151,7 @@ table th[class*="span"],
|
|
2151
2151
|
*margin-right: .3em;
|
2152
2152
|
line-height: 14px;
|
2153
2153
|
vertical-align: text-top;
|
2154
|
-
background-image: url("
|
2154
|
+
background-image: url("/assets/glyphicons-halflings.png");
|
2155
2155
|
background-position: 14px 14px;
|
2156
2156
|
background-repeat: no-repeat;
|
2157
2157
|
}
|
@@ -2171,7 +2171,7 @@ table th[class*="span"],
|
|
2171
2171
|
.dropdown-menu > .active > a > [class*=" icon-"],
|
2172
2172
|
.dropdown-submenu:hover > a > [class^="icon-"],
|
2173
2173
|
.dropdown-submenu:hover > a > [class*=" icon-"] {
|
2174
|
-
background-image: url("
|
2174
|
+
background-image: url("/assets/glyphicons-halflings-white.png");
|
2175
2175
|
}
|
2176
2176
|
|
2177
2177
|
.icon-glass {
|