pullentity-client 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.DS_Store +0 -0
- data/.gitignore +47 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/pullentity +5 -0
- data/lib/.DS_Store +0 -0
- data/lib/pullentity-client/.DS_Store +0 -0
- data/lib/pullentity-client/builder/middleman.rb +14 -0
- data/lib/pullentity-client/cli.rb +85 -0
- data/lib/pullentity-client/generate/auth.rb +173 -0
- data/lib/pullentity-client/generate/exporter.rb +107 -0
- data/lib/pullentity-client/generate/project.rb +99 -0
- data/lib/pullentity-client/generate/view.rb +47 -0
- data/lib/pullentity-client/helpers.rb +146 -0
- data/lib/pullentity-client/logger.rb +14 -0
- data/lib/pullentity-client/templates/.DS_Store +0 -0
- data/lib/pullentity-client/templates/app/.DS_Store +0 -0
- data/lib/pullentity-client/templates/app/assets/.DS_Store +0 -0
- data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.svg +255 -0
- data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/lib/pullentity-client/templates/app/assets/images/.DS_Store +0 -0
- data/lib/pullentity-client/templates/app/assets/images/favicon.ico +0 -0
- data/lib/pullentity-client/templates/app/assets/javascripts/application.js.erb +4 -0
- data/lib/pullentity-client/templates/app/assets/javascripts/mustache.js +535 -0
- data/lib/pullentity-client/templates/app/assets/stylesheets/application.css.scss +1 -0
- data/lib/pullentity-client/templates/app/assets/stylesheets/customtheme.css.scss +1 -0
- data/lib/pullentity-client/templates/app/index.html.haml +15 -0
- data/lib/pullentity-client/templates/app/views/.DS_Store +0 -0
- data/lib/pullentity-client/templates/app/views/list.haml +11 -0
- data/lib/pullentity-client/templates/app/views/shared/body.haml +26 -0
- data/lib/pullentity-client/templates/app/views/shared/css.haml +48 -0
- data/lib/pullentity-client/templates/app/views/shared/head.haml +19 -0
- data/lib/pullentity-client/templates/app/views/shared/js.haml +43 -0
- data/lib/pullentity-client/templates/app/views/themes/home.haml +21 -0
- data/lib/pullentity-client/templates/app/views/themes/theme1.haml +21 -0
- data/lib/pullentity-client/templates/defaults/Gemfile.erb +8 -0
- data/lib/pullentity-client/templates/defaults/LICENSE.erb +1 -0
- data/lib/pullentity-client/templates/defaults/Readme.mkd.erb +1 -0
- data/lib/pullentity-client/templates/defaults/build.yml.erb +2 -0
- data/lib/pullentity-client/templates/defaults/config.erb +23 -0
- data/lib/pullentity-client/templates/defaults/gitignore.erb +2 -0
- data/lib/pullentity-client/templates/defaults/layout.haml.erb +13 -0
- data/lib/pullentity-client/templates/defaults/pullentity.yml.erb +5 -0
- data/lib/pullentity-client/templates/defaults/test-data.js.erb +87 -0
- data/lib/pullentity-client/templates/rakefile +0 -0
- data/lib/pullentity-client/templates/specs/app_spec.coffee.erb +3 -0
- data/lib/pullentity-client/utils.rb +81 -0
- data/lib/pullentity-client/version.rb +5 -0
- data/lib/pullentity-client.rb +39 -0
- data/pullentity-client.gemspec +39 -0
- data/spec/cli/command_spec.rb +90 -0
- data/spec/pullentity-client/builder/middleman_spec.rb +22 -0
- data/spec/pullentity-client/generate/exporter_spec.rb +53 -0
- data/spec/pullentity-client/generate/project_spec.rb +90 -0
- data/spec/pullentity-client/logger_spec.rb +25 -0
- data/spec/pullentity-client/utils_spec.rb +94 -0
- data/spec/spec_helper.rb +42 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +255 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/images/.DS_Store +0 -0
- data/vendor/assets/images/pullentity/.DS_Store +0 -0
- data/vendor/assets/javascripts/pullentity/.DS_Store +0 -0
- data/vendor/assets/javascripts/pullentity.js +0 -0
- data/vendor/assets/stylesheets/.DS_Store +0 -0
- data/vendor/assets/stylesheets/pullentity/themes/default.css.scss +0 -0
- data/vendor/assets/stylesheets/pullentity.css.scss +1 -0
- metadata +335 -0
@@ -0,0 +1,535 @@
|
|
1
|
+
/*!
|
2
|
+
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
3
|
+
* http://github.com/janl/mustache.js
|
4
|
+
*/
|
5
|
+
|
6
|
+
/*global define: false*/
|
7
|
+
|
8
|
+
(function (root, factory) {
|
9
|
+
if (typeof exports === "object" && exports) {
|
10
|
+
module.exports = factory; // CommonJS
|
11
|
+
} else if (typeof define === "function" && define.amd) {
|
12
|
+
define(factory); // AMD
|
13
|
+
} else {
|
14
|
+
root.Mustache = factory; // <script>
|
15
|
+
}
|
16
|
+
}(this, (function () {
|
17
|
+
|
18
|
+
var exports = {};
|
19
|
+
|
20
|
+
exports.name = "mustache.js";
|
21
|
+
exports.version = "0.7.2";
|
22
|
+
exports.tags = ["{{", "}}"];
|
23
|
+
|
24
|
+
exports.Scanner = Scanner;
|
25
|
+
exports.Context = Context;
|
26
|
+
exports.Writer = Writer;
|
27
|
+
|
28
|
+
var whiteRe = /\s*/;
|
29
|
+
var spaceRe = /\s+/;
|
30
|
+
var nonSpaceRe = /\S/;
|
31
|
+
var eqRe = /\s*=/;
|
32
|
+
var curlyRe = /\s*\}/;
|
33
|
+
var tagRe = /#|\^|\/|>|\{|&|=|!/;
|
34
|
+
|
35
|
+
var _test = RegExp.prototype.test;
|
36
|
+
var _toString = Object.prototype.toString;
|
37
|
+
|
38
|
+
// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
|
39
|
+
// See https://github.com/janl/mustache.js/issues/189
|
40
|
+
function testRe(re, string) {
|
41
|
+
return _test.call(re, string);
|
42
|
+
}
|
43
|
+
|
44
|
+
function isWhitespace(string) {
|
45
|
+
return !testRe(nonSpaceRe, string);
|
46
|
+
}
|
47
|
+
|
48
|
+
var isArray = Array.isArray || function (obj) {
|
49
|
+
return _toString.call(obj) === '[object Array]';
|
50
|
+
};
|
51
|
+
|
52
|
+
function escapeRe(string) {
|
53
|
+
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
54
|
+
}
|
55
|
+
|
56
|
+
var entityMap = {
|
57
|
+
"&": "&",
|
58
|
+
"<": "<",
|
59
|
+
">": ">",
|
60
|
+
'"': '"',
|
61
|
+
"'": ''',
|
62
|
+
"/": '/'
|
63
|
+
};
|
64
|
+
|
65
|
+
function escapeHtml(string) {
|
66
|
+
return String(string).replace(/[&<>"'\/]/g, function (s) {
|
67
|
+
return entityMap[s];
|
68
|
+
});
|
69
|
+
}
|
70
|
+
|
71
|
+
// Export the escaping function so that the user may override it.
|
72
|
+
// See https://github.com/janl/mustache.js/issues/244
|
73
|
+
exports.escape = escapeHtml;
|
74
|
+
|
75
|
+
function Scanner(string) {
|
76
|
+
this.string = string;
|
77
|
+
this.tail = string;
|
78
|
+
this.pos = 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Returns `true` if the tail is empty (end of string).
|
83
|
+
*/
|
84
|
+
Scanner.prototype.eos = function () {
|
85
|
+
return this.tail === "";
|
86
|
+
};
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Tries to match the given regular expression at the current position.
|
90
|
+
* Returns the matched text if it can match, the empty string otherwise.
|
91
|
+
*/
|
92
|
+
Scanner.prototype.scan = function (re) {
|
93
|
+
var match = this.tail.match(re);
|
94
|
+
|
95
|
+
if (match && match.index === 0) {
|
96
|
+
this.tail = this.tail.substring(match[0].length);
|
97
|
+
this.pos += match[0].length;
|
98
|
+
return match[0];
|
99
|
+
}
|
100
|
+
|
101
|
+
return "";
|
102
|
+
};
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Skips all text until the given regular expression can be matched. Returns
|
106
|
+
* the skipped string, which is the entire tail if no match can be made.
|
107
|
+
*/
|
108
|
+
Scanner.prototype.scanUntil = function (re) {
|
109
|
+
var match, pos = this.tail.search(re);
|
110
|
+
|
111
|
+
switch (pos) {
|
112
|
+
case -1:
|
113
|
+
match = this.tail;
|
114
|
+
this.pos += this.tail.length;
|
115
|
+
this.tail = "";
|
116
|
+
break;
|
117
|
+
case 0:
|
118
|
+
match = "";
|
119
|
+
break;
|
120
|
+
default:
|
121
|
+
match = this.tail.substring(0, pos);
|
122
|
+
this.tail = this.tail.substring(pos);
|
123
|
+
this.pos += pos;
|
124
|
+
}
|
125
|
+
|
126
|
+
return match;
|
127
|
+
};
|
128
|
+
|
129
|
+
function Context(view, parent) {
|
130
|
+
this.view = view;
|
131
|
+
this.parent = parent;
|
132
|
+
this._cache = {};
|
133
|
+
}
|
134
|
+
|
135
|
+
Context.make = function (view) {
|
136
|
+
return (view instanceof Context) ? view : new Context(view);
|
137
|
+
};
|
138
|
+
|
139
|
+
Context.prototype.push = function (view) {
|
140
|
+
return new Context(view, this);
|
141
|
+
};
|
142
|
+
|
143
|
+
Context.prototype.lookup = function (name) {
|
144
|
+
var value = this._cache[name];
|
145
|
+
|
146
|
+
if (!value) {
|
147
|
+
if (name == '.') {
|
148
|
+
value = this.view;
|
149
|
+
} else {
|
150
|
+
var context = this;
|
151
|
+
|
152
|
+
while (context) {
|
153
|
+
if (name.indexOf('.') > 0) {
|
154
|
+
value = context.view;
|
155
|
+
var names = name.split('.'), i = 0;
|
156
|
+
while (value && i < names.length) {
|
157
|
+
value = value[names[i++]];
|
158
|
+
}
|
159
|
+
} else {
|
160
|
+
value = context.view[name];
|
161
|
+
}
|
162
|
+
|
163
|
+
if (value != null) break;
|
164
|
+
|
165
|
+
context = context.parent;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
this._cache[name] = value;
|
170
|
+
}
|
171
|
+
|
172
|
+
if (typeof value === 'function') value = value.call(this.view);
|
173
|
+
|
174
|
+
return value;
|
175
|
+
};
|
176
|
+
|
177
|
+
function Writer() {
|
178
|
+
this.clearCache();
|
179
|
+
}
|
180
|
+
|
181
|
+
Writer.prototype.clearCache = function () {
|
182
|
+
this._cache = {};
|
183
|
+
this._partialCache = {};
|
184
|
+
};
|
185
|
+
|
186
|
+
Writer.prototype.compile = function (template, tags) {
|
187
|
+
var fn = this._cache[template];
|
188
|
+
|
189
|
+
if (!fn) {
|
190
|
+
var tokens = exports.parse(template, tags);
|
191
|
+
fn = this._cache[template] = this.compileTokens(tokens, template);
|
192
|
+
}
|
193
|
+
|
194
|
+
return fn;
|
195
|
+
};
|
196
|
+
|
197
|
+
Writer.prototype.compilePartial = function (name, template, tags) {
|
198
|
+
var fn = this.compile(template, tags);
|
199
|
+
this._partialCache[name] = fn;
|
200
|
+
return fn;
|
201
|
+
};
|
202
|
+
|
203
|
+
Writer.prototype.getPartial = function (name) {
|
204
|
+
if (!(name in this._partialCache) && this._loadPartial) {
|
205
|
+
this.compilePartial(name, this._loadPartial(name));
|
206
|
+
}
|
207
|
+
|
208
|
+
return this._partialCache[name];
|
209
|
+
};
|
210
|
+
|
211
|
+
Writer.prototype.compileTokens = function (tokens, template) {
|
212
|
+
var self = this;
|
213
|
+
return function (view, partials) {
|
214
|
+
if (partials) {
|
215
|
+
if (typeof partials === 'function') {
|
216
|
+
self._loadPartial = partials;
|
217
|
+
} else {
|
218
|
+
for (var name in partials) {
|
219
|
+
self.compilePartial(name, partials[name]);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
return renderTokens(tokens, self, Context.make(view), template);
|
225
|
+
};
|
226
|
+
};
|
227
|
+
|
228
|
+
Writer.prototype.render = function (template, view, partials) {
|
229
|
+
return this.compile(template)(view, partials);
|
230
|
+
};
|
231
|
+
|
232
|
+
/**
|
233
|
+
* Low-level function that renders the given `tokens` using the given `writer`
|
234
|
+
* and `context`. The `template` string is only needed for templates that use
|
235
|
+
* higher-order sections to extract the portion of the original template that
|
236
|
+
* was contained in that section.
|
237
|
+
*/
|
238
|
+
function renderTokens(tokens, writer, context, template) {
|
239
|
+
var buffer = '';
|
240
|
+
|
241
|
+
var token, tokenValue, value;
|
242
|
+
for (var i = 0, len = tokens.length; i < len; ++i) {
|
243
|
+
token = tokens[i];
|
244
|
+
tokenValue = token[1];
|
245
|
+
|
246
|
+
switch (token[0]) {
|
247
|
+
case '#':
|
248
|
+
value = context.lookup(tokenValue);
|
249
|
+
|
250
|
+
if (typeof value === 'object') {
|
251
|
+
if (isArray(value)) {
|
252
|
+
for (var j = 0, jlen = value.length; j < jlen; ++j) {
|
253
|
+
buffer += renderTokens(token[4], writer, context.push(value[j]), template);
|
254
|
+
}
|
255
|
+
} else if (value) {
|
256
|
+
buffer += renderTokens(token[4], writer, context.push(value), template);
|
257
|
+
}
|
258
|
+
} else if (typeof value === 'function') {
|
259
|
+
var text = template == null ? null : template.slice(token[3], token[5]);
|
260
|
+
value = value.call(context.view, text, function (template) {
|
261
|
+
return writer.render(template, context);
|
262
|
+
});
|
263
|
+
if (value != null) buffer += value;
|
264
|
+
} else if (value) {
|
265
|
+
buffer += renderTokens(token[4], writer, context, template);
|
266
|
+
}
|
267
|
+
|
268
|
+
break;
|
269
|
+
case '^':
|
270
|
+
value = context.lookup(tokenValue);
|
271
|
+
|
272
|
+
// Use JavaScript's definition of falsy. Include empty arrays.
|
273
|
+
// See https://github.com/janl/mustache.js/issues/186
|
274
|
+
if (!value || (isArray(value) && value.length === 0)) {
|
275
|
+
buffer += renderTokens(token[4], writer, context, template);
|
276
|
+
}
|
277
|
+
|
278
|
+
break;
|
279
|
+
case '>':
|
280
|
+
value = writer.getPartial(tokenValue);
|
281
|
+
if (typeof value === 'function') buffer += value(context);
|
282
|
+
break;
|
283
|
+
case '&':
|
284
|
+
value = context.lookup(tokenValue);
|
285
|
+
if (value != null) buffer += value;
|
286
|
+
break;
|
287
|
+
case 'name':
|
288
|
+
value = context.lookup(tokenValue);
|
289
|
+
if (value != null) buffer += exports.escape(value);
|
290
|
+
break;
|
291
|
+
case 'text':
|
292
|
+
buffer += tokenValue;
|
293
|
+
break;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
return buffer;
|
298
|
+
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* Forms the given array of `tokens` into a nested tree structure where
|
302
|
+
* tokens that represent a section have two additional items: 1) an array of
|
303
|
+
* all tokens that appear in that section and 2) the index in the original
|
304
|
+
* template that represents the end of that section.
|
305
|
+
*/
|
306
|
+
function nestTokens(tokens) {
|
307
|
+
var tree = [];
|
308
|
+
var collector = tree;
|
309
|
+
var sections = [];
|
310
|
+
|
311
|
+
var token;
|
312
|
+
for (var i = 0, len = tokens.length; i < len; ++i) {
|
313
|
+
token = tokens[i];
|
314
|
+
switch (token[0]) {
|
315
|
+
case '#':
|
316
|
+
case '^':
|
317
|
+
sections.push(token);
|
318
|
+
collector.push(token);
|
319
|
+
collector = token[4] = [];
|
320
|
+
break;
|
321
|
+
case '/':
|
322
|
+
var section = sections.pop();
|
323
|
+
section[5] = token[2];
|
324
|
+
collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;
|
325
|
+
break;
|
326
|
+
default:
|
327
|
+
collector.push(token);
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
return tree;
|
332
|
+
}
|
333
|
+
|
334
|
+
/**
|
335
|
+
* Combines the values of consecutive text tokens in the given `tokens` array
|
336
|
+
* to a single token.
|
337
|
+
*/
|
338
|
+
function squashTokens(tokens) {
|
339
|
+
var squashedTokens = [];
|
340
|
+
|
341
|
+
var token, lastToken;
|
342
|
+
for (var i = 0, len = tokens.length; i < len; ++i) {
|
343
|
+
token = tokens[i];
|
344
|
+
if (token) {
|
345
|
+
if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
|
346
|
+
lastToken[1] += token[1];
|
347
|
+
lastToken[3] = token[3];
|
348
|
+
} else {
|
349
|
+
lastToken = token;
|
350
|
+
squashedTokens.push(token);
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
return squashedTokens;
|
356
|
+
}
|
357
|
+
|
358
|
+
function escapeTags(tags) {
|
359
|
+
return [
|
360
|
+
new RegExp(escapeRe(tags[0]) + "\\s*"),
|
361
|
+
new RegExp("\\s*" + escapeRe(tags[1]))
|
362
|
+
];
|
363
|
+
}
|
364
|
+
|
365
|
+
/**
|
366
|
+
* Breaks up the given `template` string into a tree of token objects. If
|
367
|
+
* `tags` is given here it must be an array with two string values: the
|
368
|
+
* opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
|
369
|
+
* course, the default is to use mustaches (i.e. Mustache.tags).
|
370
|
+
*/
|
371
|
+
exports.parse = function (template, tags) {
|
372
|
+
template = template || '';
|
373
|
+
tags = tags || exports.tags;
|
374
|
+
|
375
|
+
if (typeof tags === 'string') tags = tags.split(spaceRe);
|
376
|
+
if (tags.length !== 2) throw new Error('Invalid tags: ' + tags.join(', '));
|
377
|
+
|
378
|
+
var tagRes = escapeTags(tags);
|
379
|
+
var scanner = new Scanner(template);
|
380
|
+
|
381
|
+
var sections = []; // Stack to hold section tokens
|
382
|
+
var tokens = []; // Buffer to hold the tokens
|
383
|
+
var spaces = []; // Indices of whitespace tokens on the current line
|
384
|
+
var hasTag = false; // Is there a {{tag}} on the current line?
|
385
|
+
var nonSpace = false; // Is there a non-space char on the current line?
|
386
|
+
|
387
|
+
// Strips all whitespace tokens array for the current line
|
388
|
+
// if there was a {{#tag}} on it and otherwise only space.
|
389
|
+
function stripSpace() {
|
390
|
+
if (hasTag && !nonSpace) {
|
391
|
+
while (spaces.length) {
|
392
|
+
delete tokens[spaces.pop()];
|
393
|
+
}
|
394
|
+
} else {
|
395
|
+
spaces = [];
|
396
|
+
}
|
397
|
+
|
398
|
+
hasTag = false;
|
399
|
+
nonSpace = false;
|
400
|
+
}
|
401
|
+
|
402
|
+
var start, type, value, chr, token;
|
403
|
+
while (!scanner.eos()) {
|
404
|
+
start = scanner.pos;
|
405
|
+
|
406
|
+
// Match any text between tags.
|
407
|
+
value = scanner.scanUntil(tagRes[0]);
|
408
|
+
if (value) {
|
409
|
+
for (var i = 0, len = value.length; i < len; ++i) {
|
410
|
+
chr = value.charAt(i);
|
411
|
+
|
412
|
+
if (isWhitespace(chr)) {
|
413
|
+
spaces.push(tokens.length);
|
414
|
+
} else {
|
415
|
+
nonSpace = true;
|
416
|
+
}
|
417
|
+
|
418
|
+
tokens.push(['text', chr, start, start + 1]);
|
419
|
+
start += 1;
|
420
|
+
|
421
|
+
// Check for whitespace on the current line.
|
422
|
+
if (chr == '\n') stripSpace();
|
423
|
+
}
|
424
|
+
}
|
425
|
+
|
426
|
+
// Match the opening tag.
|
427
|
+
if (!scanner.scan(tagRes[0])) break;
|
428
|
+
hasTag = true;
|
429
|
+
|
430
|
+
// Get the tag type.
|
431
|
+
type = scanner.scan(tagRe) || 'name';
|
432
|
+
scanner.scan(whiteRe);
|
433
|
+
|
434
|
+
// Get the tag value.
|
435
|
+
if (type === '=') {
|
436
|
+
value = scanner.scanUntil(eqRe);
|
437
|
+
scanner.scan(eqRe);
|
438
|
+
scanner.scanUntil(tagRes[1]);
|
439
|
+
} else if (type === '{') {
|
440
|
+
value = scanner.scanUntil(new RegExp('\\s*' + escapeRe('}' + tags[1])));
|
441
|
+
scanner.scan(curlyRe);
|
442
|
+
scanner.scanUntil(tagRes[1]);
|
443
|
+
type = '&';
|
444
|
+
} else {
|
445
|
+
value = scanner.scanUntil(tagRes[1]);
|
446
|
+
}
|
447
|
+
|
448
|
+
// Match the closing tag.
|
449
|
+
if (!scanner.scan(tagRes[1])) throw new Error('Unclosed tag at ' + scanner.pos);
|
450
|
+
|
451
|
+
token = [type, value, start, scanner.pos];
|
452
|
+
tokens.push(token);
|
453
|
+
|
454
|
+
if (type === '#' || type === '^') {
|
455
|
+
sections.push(token);
|
456
|
+
} else if (type === '/') {
|
457
|
+
// Check section nesting.
|
458
|
+
if (sections.length === 0) throw new Error('Unopened section "' + value + '" at ' + start);
|
459
|
+
var openSection = sections.pop();
|
460
|
+
if (openSection[1] !== value) throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
|
461
|
+
} else if (type === 'name' || type === '{' || type === '&') {
|
462
|
+
nonSpace = true;
|
463
|
+
} else if (type === '=') {
|
464
|
+
// Set the tags for the next time around.
|
465
|
+
tags = value.split(spaceRe);
|
466
|
+
if (tags.length !== 2) throw new Error('Invalid tags at ' + start + ': ' + tags.join(', '));
|
467
|
+
tagRes = escapeTags(tags);
|
468
|
+
}
|
469
|
+
}
|
470
|
+
|
471
|
+
// Make sure there are no open sections when we're done.
|
472
|
+
var openSection = sections.pop();
|
473
|
+
if (openSection) throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
|
474
|
+
|
475
|
+
tokens = squashTokens(tokens);
|
476
|
+
|
477
|
+
return nestTokens(tokens);
|
478
|
+
};
|
479
|
+
|
480
|
+
// All Mustache.* functions use this writer.
|
481
|
+
var _writer = new Writer();
|
482
|
+
|
483
|
+
/**
|
484
|
+
* Clears all cached templates and partials in the default writer.
|
485
|
+
*/
|
486
|
+
exports.clearCache = function () {
|
487
|
+
return _writer.clearCache();
|
488
|
+
};
|
489
|
+
|
490
|
+
/**
|
491
|
+
* Compiles the given `template` to a reusable function using the default
|
492
|
+
* writer.
|
493
|
+
*/
|
494
|
+
exports.compile = function (template, tags) {
|
495
|
+
return _writer.compile(template, tags);
|
496
|
+
};
|
497
|
+
|
498
|
+
/**
|
499
|
+
* Compiles the partial with the given `name` and `template` to a reusable
|
500
|
+
* function using the default writer.
|
501
|
+
*/
|
502
|
+
exports.compilePartial = function (name, template, tags) {
|
503
|
+
return _writer.compilePartial(name, template, tags);
|
504
|
+
};
|
505
|
+
|
506
|
+
/**
|
507
|
+
* Compiles the given array of tokens (the output of a parse) to a reusable
|
508
|
+
* function using the default writer.
|
509
|
+
*/
|
510
|
+
exports.compileTokens = function (tokens, template) {
|
511
|
+
return _writer.compileTokens(tokens, template);
|
512
|
+
};
|
513
|
+
|
514
|
+
/**
|
515
|
+
* Renders the `template` with the given `view` and `partials` using the
|
516
|
+
* default writer.
|
517
|
+
*/
|
518
|
+
exports.render = function (template, view, partials) {
|
519
|
+
return _writer.render(template, view, partials);
|
520
|
+
};
|
521
|
+
|
522
|
+
// This is here for backwards compatibility with 0.4.x.
|
523
|
+
exports.to_html = function (template, view, partials, send) {
|
524
|
+
var result = exports.render(template, view, partials);
|
525
|
+
|
526
|
+
if (typeof send === "function") {
|
527
|
+
send(result);
|
528
|
+
} else {
|
529
|
+
return result;
|
530
|
+
}
|
531
|
+
};
|
532
|
+
|
533
|
+
return exports;
|
534
|
+
|
535
|
+
}())));
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'pullentity';
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "compass";
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
= content_for :principal do
|
4
|
+
|
5
|
+
- theme_list = Dir.foreach(Dir.pwd + ("/source/views/themes") ).grep(/.haml/)
|
6
|
+
|
7
|
+
- theme_list.each do |o|
|
8
|
+
- theme_name = o.gsub(".haml", "")
|
9
|
+
%div{ id: "#{theme_name}", style: "display:none"}
|
10
|
+
= partial "views/themes/#{theme_name}"
|
11
|
+
|
12
|
+
%div{ id: "list", style: "display:none"}
|
13
|
+
= partial "views/list"
|
14
|
+
|
15
|
+
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
%script{ type: "template/text", id: "layout"}
|
2
|
+
|
3
|
+
.container-fluid
|
4
|
+
.page-header
|
5
|
+
%h1
|
6
|
+
%a.pjax{:href => "{{site_link}}"} Hello, welcom to {{site.name}}
|
7
|
+
.row-fluid
|
8
|
+
%ul#menu
|
9
|
+
{{#sections}}
|
10
|
+
{{#show_in_menu}}
|
11
|
+
%li
|
12
|
+
%a.pjax{:href => "{{public_url}}"} {{title}}
|
13
|
+
{{/show_in_menu}}
|
14
|
+
{{/sections}}
|
15
|
+
.row-fluid{"data-pjax-container" => ""}
|
16
|
+
/ Don't remove this line
|
17
|
+
#loadScripts
|
18
|
+
%pre Content should...
|
19
|
+
#yield-scripts
|
20
|
+
= yield_content(:principal)
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
{{{loader}}}
|
25
|
+
|
26
|
+
{{{facebook_comments}}}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
:css
|
2
|
+
@import url(http://fonts.googleapis.com/css?family=Oxygen|Oleo+Script&subset=latin,latin-ext);
|
3
|
+
|
4
|
+
h1{
|
5
|
+
font-family: "Oxygen", Helvetica, Arial;
|
6
|
+
}
|
7
|
+
.page-header h1 {
|
8
|
+
font-size: 5em;
|
9
|
+
font-weight: lighter;
|
10
|
+
line-height: 1;
|
11
|
+
font-family: "Oleo Script", Helvetica, Arial;
|
12
|
+
}
|
13
|
+
h2{
|
14
|
+
font-family: "Oxygen", Helvetica, Arial;
|
15
|
+
font-weight: lighter;
|
16
|
+
}
|
17
|
+
#loader{
|
18
|
+
position: fixed;
|
19
|
+
right: 28px;
|
20
|
+
top: 33px;
|
21
|
+
display:none;
|
22
|
+
}
|
23
|
+
#menu{
|
24
|
+
float: left;
|
25
|
+
list-style: none outside none;
|
26
|
+
margin: 0 0 7px;
|
27
|
+
}
|
28
|
+
#menu li{
|
29
|
+
float:left;
|
30
|
+
margin:5px;
|
31
|
+
}
|
32
|
+
|
33
|
+
#menu li a{
|
34
|
+
color: #888888;
|
35
|
+
font-size: 16px;
|
36
|
+
|
37
|
+
font-family: "Oxygen", Helvetica, Arial;
|
38
|
+
font-weight: lighter;
|
39
|
+
}
|
40
|
+
|
41
|
+
/*GALLERY*/
|
42
|
+
|
43
|
+
.nav { margin: 5px 0 }
|
44
|
+
#nav a, #s7 strong { margin: 0 5px; padding: 3px 5px; border: 1px solid #ccc; background: #fc0; text-decoration: none }
|
45
|
+
#nav a.activeSlide { background: #ea0 }
|
46
|
+
#nav a:focus { outline: none; }
|
47
|
+
#output { text-align: left; }
|
48
|
+
#nav { text-align: left; margin: 3px }
|
@@ -0,0 +1,19 @@
|
|
1
|
+
%title Pullentity Site
|
2
|
+
%meta{:content => "", :name => "description"}
|
3
|
+
%meta{:content => "t", :name => "keywords"}
|
4
|
+
%meta{:content => "INDEX,FOLLOW", :name => "ROBOTS"}
|
5
|
+
|
6
|
+
%link{:href => "http://twitter.github.com/bootstrap/assets/css/bootstrap.css", :rel => "stylesheet"}
|
7
|
+
%script{:src => "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"}
|
8
|
+
%script{:src => "http://twitter.github.com/bootstrap/assets/js/bootstrap-carousel.js"}
|
9
|
+
%script{:src => "https://raw.github.com/desandro/masonry/master/jquery.masonry.min.js"}
|
10
|
+
%script{:src => "http://malsup.github.com/jquery.cycle.all.js"}
|
11
|
+
%script{:src => "https://raw.github.com/defunkt/jquery-pjax/master/jquery.pjax.js"}
|
12
|
+
%script{:src => "https://raw.github.com/brandonaaron/livequery/master/jquery.livequery.js"}
|
13
|
+
|
14
|
+
= javascript_include_tag "application"
|
15
|
+
|
16
|
+
= javascript_include_tag "test-data"
|
17
|
+
|
18
|
+
= yield_content(:application_js)
|
19
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
:javascript
|
2
|
+
$(function() {
|
3
|
+
|
4
|
+
$.pjax.defaults.timeout = 5000;
|
5
|
+
$('a.pjax').pjax('[data-pjax-container]');
|
6
|
+
|
7
|
+
function onAfter(curr, next, opts) {
|
8
|
+
var index = opts.currSlide;
|
9
|
+
//$('#prev')[index == 0 ? 'hide' : 'show']();
|
10
|
+
//$('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
|
11
|
+
}
|
12
|
+
function onBefore(curr, next, opts) {
|
13
|
+
$("#num").html("("+ (opts.currSlide + 1) + " of " + opts.slideCount + ")");
|
14
|
+
}
|
15
|
+
$('#slideshow')
|
16
|
+
.livequery(function(){
|
17
|
+
$(this).cycle({
|
18
|
+
fx: 'fade',
|
19
|
+
prev: '#prev',
|
20
|
+
next: '#next',
|
21
|
+
after: onAfter,
|
22
|
+
before: onBefore,
|
23
|
+
timeout: 0
|
24
|
+
});
|
25
|
+
});
|
26
|
+
|
27
|
+
$('#myCarousel')
|
28
|
+
.livequery(function(){
|
29
|
+
$(this).find(".item").first().addClass('active');
|
30
|
+
$(this).carousel();
|
31
|
+
});
|
32
|
+
|
33
|
+
$.ajaxSetup({
|
34
|
+
dataType: "script",
|
35
|
+
beforeSend: function() {
|
36
|
+
return $("#loader").fadeIn();
|
37
|
+
},
|
38
|
+
complete: function() {
|
39
|
+
return $("#loader").fadeOut();
|
40
|
+
}
|
41
|
+
});
|
42
|
+
|
43
|
+
});
|