pug-rails 2.0.3 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +32 -13
- data/Appraisals +33 -11
- data/Gemfile +6 -6
- data/Gemfile.lock +70 -67
- data/{vendor/assets/javascripts/pug/LICENCE → LICENSE} +7 -5
- data/README.md +5 -5
- data/Rakefile +3 -8
- data/gemfiles/{rails_3.gemfile → rails_3.1.gemfile} +2 -2
- data/gemfiles/{rails_3.gemfile.lock → rails_3.1.gemfile.lock} +11 -11
- data/gemfiles/rails_3.2.gemfile +9 -0
- data/gemfiles/rails_3.2.gemfile.lock +124 -0
- data/gemfiles/rails_4.1_with_sprockets_2.gemfile +9 -0
- data/gemfiles/rails_4.1_with_sprockets_2.gemfile.lock +140 -0
- data/gemfiles/{rails_4_with_sprockets_3.gemfile → rails_4.1_with_sprockets_3.gemfile} +2 -2
- data/gemfiles/{rails_4_with_sprockets_3.gemfile.lock → rails_4.1_with_sprockets_3.gemfile.lock} +46 -48
- data/gemfiles/rails_4.2_with_sprockets_2.gemfile +9 -0
- data/gemfiles/rails_4.2_with_sprockets_2.gemfile.lock +140 -0
- data/gemfiles/{rails_4_with_sprockets_2.gemfile → rails_4.2_with_sprockets_3.gemfile} +2 -2
- data/gemfiles/{rails_4_with_sprockets_2.gemfile.lock → rails_4.2_with_sprockets_3.gemfile.lock} +46 -48
- data/gemfiles/{rails_5.gemfile → rails_5.0.gemfile} +2 -2
- data/gemfiles/{rails_5.gemfile.lock → rails_5.0.gemfile.lock} +59 -59
- data/gemfiles/rails_5.1.gemfile +9 -0
- data/gemfiles/rails_5.1.gemfile.lock +142 -0
- data/lib/jade-rails/railtie.rb +14 -14
- data/lib/jade-rails/sprockets/transformer.rb +28 -4
- data/lib/pug-rails.rb +8 -23
- data/lib/pug-rails/railtie.rb +14 -14
- data/lib/pug-rails/sprockets/transformer.rb +28 -4
- data/lib/pug-rails/version.rb +1 -0
- data/pug-rails.gemspec +18 -16
- data/test/fixtures/javascripts/{application.js → application-1.js} +0 -0
- data/test/fixtures/javascripts/application-1.js.expected +10 -0
- data/test/fixtures/javascripts/application-2.js +2 -0
- data/test/test-helper.rb +62 -0
- data/test/test-pug-rails.rb +21 -76
- metadata +33 -21
- data/vendor/assets/javascripts/jade/LICENCE +0 -22
- data/vendor/assets/javascripts/jade/runtime.js +0 -252
- data/vendor/assets/javascripts/pug/runtime.js +0 -259
@@ -1,259 +0,0 @@
|
|
1
|
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pug = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
var pug_has_own_property = Object.prototype.hasOwnProperty;
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Merge two attribute objects giving precedence
|
8
|
-
* to values in object `b`. Classes are special-cased
|
9
|
-
* allowing for arrays and merging/joining appropriately
|
10
|
-
* resulting in a string.
|
11
|
-
*
|
12
|
-
* @param {Object} a
|
13
|
-
* @param {Object} b
|
14
|
-
* @return {Object} a
|
15
|
-
* @api private
|
16
|
-
*/
|
17
|
-
|
18
|
-
exports.merge = pug_merge;
|
19
|
-
function pug_merge(a, b) {
|
20
|
-
if (arguments.length === 1) {
|
21
|
-
var attrs = a[0];
|
22
|
-
for (var i = 1; i < a.length; i++) {
|
23
|
-
attrs = pug_merge(attrs, a[i]);
|
24
|
-
}
|
25
|
-
return attrs;
|
26
|
-
}
|
27
|
-
|
28
|
-
for (var key in b) {
|
29
|
-
if (key === 'class') {
|
30
|
-
var valA = a[key] || [];
|
31
|
-
a[key] = (Array.isArray(valA) ? valA : [valA]).concat(b[key] || []);
|
32
|
-
} else if (key === 'style') {
|
33
|
-
var valA = pug_style(a[key]);
|
34
|
-
var valB = pug_style(b[key]);
|
35
|
-
a[key] = valA + (valA && valB && ';') + valB;
|
36
|
-
} else {
|
37
|
-
a[key] = b[key];
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
return a;
|
42
|
-
};
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Process array, object, or string as a string of classes delimited by a space.
|
46
|
-
*
|
47
|
-
* If `val` is an array, all members of it and its subarrays are counted as
|
48
|
-
* classes. If `escaping` is an array, then whether or not the item in `val` is
|
49
|
-
* escaped depends on the corresponding item in `escaping`. If `escaping` is
|
50
|
-
* not an array, no escaping is done.
|
51
|
-
*
|
52
|
-
* If `val` is an object, all the keys whose value is truthy are counted as
|
53
|
-
* classes. No escaping is done.
|
54
|
-
*
|
55
|
-
* If `val` is a string, it is counted as a class. No escaping is done.
|
56
|
-
*
|
57
|
-
* @param {(Array.<string>|Object.<string, boolean>|string)} val
|
58
|
-
* @param {?Array.<string>} escaping
|
59
|
-
* @return {String}
|
60
|
-
*/
|
61
|
-
exports.classes = pug_classes;
|
62
|
-
function pug_classes_array(val, escaping) {
|
63
|
-
var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping);
|
64
|
-
for (var i = 0; i < val.length; i++) {
|
65
|
-
className = pug_classes(val[i]);
|
66
|
-
if (!className) continue;
|
67
|
-
escapeEnabled && escaping[i] && (className = pug_escape(className));
|
68
|
-
classString = classString + padding + className;
|
69
|
-
padding = ' ';
|
70
|
-
}
|
71
|
-
return classString;
|
72
|
-
}
|
73
|
-
function pug_classes_object(val) {
|
74
|
-
var classString = '', padding = '';
|
75
|
-
for (var key in val) {
|
76
|
-
if (key && val[key] && pug_has_own_property.call(val, key)) {
|
77
|
-
classString = classString + padding + key;
|
78
|
-
padding = ' ';
|
79
|
-
}
|
80
|
-
}
|
81
|
-
return classString;
|
82
|
-
}
|
83
|
-
function pug_classes(val, escaping) {
|
84
|
-
if (Array.isArray(val)) {
|
85
|
-
return pug_classes_array(val, escaping);
|
86
|
-
} else if (val && typeof val === 'object') {
|
87
|
-
return pug_classes_object(val);
|
88
|
-
} else {
|
89
|
-
return val || '';
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Convert object or string to a string of CSS styles delimited by a semicolon.
|
95
|
-
*
|
96
|
-
* @param {(Object.<string, string>|string)} val
|
97
|
-
* @return {String}
|
98
|
-
*/
|
99
|
-
|
100
|
-
exports.style = pug_style;
|
101
|
-
function pug_style(val) {
|
102
|
-
if (!val) return '';
|
103
|
-
if (typeof val === 'object') {
|
104
|
-
var out = '', delim = '';
|
105
|
-
for (var style in val) {
|
106
|
-
/* istanbul ignore else */
|
107
|
-
if (pug_has_own_property.call(val, style)) {
|
108
|
-
out = out + delim + style + ':' + val[style];
|
109
|
-
delim = ';';
|
110
|
-
}
|
111
|
-
}
|
112
|
-
return out;
|
113
|
-
} else {
|
114
|
-
val = '' + val;
|
115
|
-
if (val[val.length - 1] === ';') return val.slice(0, -1);
|
116
|
-
return val;
|
117
|
-
}
|
118
|
-
};
|
119
|
-
|
120
|
-
/**
|
121
|
-
* Render the given attribute.
|
122
|
-
*
|
123
|
-
* @param {String} key
|
124
|
-
* @param {String} val
|
125
|
-
* @param {Boolean} escaped
|
126
|
-
* @param {Boolean} terse
|
127
|
-
* @return {String}
|
128
|
-
*/
|
129
|
-
exports.attr = pug_attr;
|
130
|
-
function pug_attr(key, val, escaped, terse) {
|
131
|
-
if (val === false || val == null || !val && (key === 'class' || key === 'style')) {
|
132
|
-
return '';
|
133
|
-
}
|
134
|
-
if (val === true) {
|
135
|
-
return ' ' + (terse ? key : key + '="' + key + '"');
|
136
|
-
}
|
137
|
-
if (typeof val.toJSON === 'function') {
|
138
|
-
val = val.toJSON();
|
139
|
-
}
|
140
|
-
if (typeof val !== 'string') {
|
141
|
-
val = JSON.stringify(val);
|
142
|
-
if (!escaped && val.indexOf('"') !== -1) {
|
143
|
-
return ' ' + key + '=\'' + val.replace(/'/g, ''') + '\'';
|
144
|
-
}
|
145
|
-
}
|
146
|
-
if (escaped) val = pug_escape(val);
|
147
|
-
return ' ' + key + '="' + val + '"';
|
148
|
-
};
|
149
|
-
|
150
|
-
/**
|
151
|
-
* Render the given attributes object.
|
152
|
-
*
|
153
|
-
* @param {Object} obj
|
154
|
-
* @param {Object} terse whether to use HTML5 terse boolean attributes
|
155
|
-
* @return {String}
|
156
|
-
*/
|
157
|
-
exports.attrs = pug_attrs;
|
158
|
-
function pug_attrs(obj, terse){
|
159
|
-
var attrs = '';
|
160
|
-
|
161
|
-
for (var key in obj) {
|
162
|
-
if (pug_has_own_property.call(obj, key)) {
|
163
|
-
var val = obj[key];
|
164
|
-
|
165
|
-
if ('class' === key) {
|
166
|
-
val = pug_classes(val);
|
167
|
-
attrs = pug_attr(key, val, false, terse) + attrs;
|
168
|
-
continue;
|
169
|
-
}
|
170
|
-
if ('style' === key) {
|
171
|
-
val = pug_style(val);
|
172
|
-
}
|
173
|
-
attrs += pug_attr(key, val, false, terse);
|
174
|
-
}
|
175
|
-
}
|
176
|
-
|
177
|
-
return attrs;
|
178
|
-
};
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Escape the given string of `html`.
|
182
|
-
*
|
183
|
-
* @param {String} html
|
184
|
-
* @return {String}
|
185
|
-
* @api private
|
186
|
-
*/
|
187
|
-
|
188
|
-
var pug_match_html = /["&<>]/;
|
189
|
-
exports.escape = pug_escape;
|
190
|
-
function pug_escape(_html){
|
191
|
-
var html = '' + _html;
|
192
|
-
var regexResult = pug_match_html.exec(html);
|
193
|
-
if (!regexResult) return _html;
|
194
|
-
|
195
|
-
var result = '';
|
196
|
-
var i, lastIndex, escape;
|
197
|
-
for (i = regexResult.index, lastIndex = 0; i < html.length; i++) {
|
198
|
-
switch (html.charCodeAt(i)) {
|
199
|
-
case 34: escape = '"'; break;
|
200
|
-
case 38: escape = '&'; break;
|
201
|
-
case 60: escape = '<'; break;
|
202
|
-
case 62: escape = '>'; break;
|
203
|
-
default: continue;
|
204
|
-
}
|
205
|
-
if (lastIndex !== i) result += html.substring(lastIndex, i);
|
206
|
-
lastIndex = i + 1;
|
207
|
-
result += escape;
|
208
|
-
}
|
209
|
-
if (lastIndex !== i) return result + html.substring(lastIndex, i);
|
210
|
-
else return result;
|
211
|
-
};
|
212
|
-
|
213
|
-
/**
|
214
|
-
* Re-throw the given `err` in context to the
|
215
|
-
* the pug in `filename` at the given `lineno`.
|
216
|
-
*
|
217
|
-
* @param {Error} err
|
218
|
-
* @param {String} filename
|
219
|
-
* @param {String} lineno
|
220
|
-
* @param {String} str original source
|
221
|
-
* @api private
|
222
|
-
*/
|
223
|
-
|
224
|
-
exports.rethrow = pug_rethrow;
|
225
|
-
function pug_rethrow(err, filename, lineno, str){
|
226
|
-
if (!(err instanceof Error)) throw err;
|
227
|
-
if ((typeof window != 'undefined' || !filename) && !str) {
|
228
|
-
err.message += ' on line ' + lineno;
|
229
|
-
throw err;
|
230
|
-
}
|
231
|
-
try {
|
232
|
-
str = str || require('fs').readFileSync(filename, 'utf8')
|
233
|
-
} catch (ex) {
|
234
|
-
pug_rethrow(err, null, lineno)
|
235
|
-
}
|
236
|
-
var context = 3
|
237
|
-
, lines = str.split('\n')
|
238
|
-
, start = Math.max(lineno - context, 0)
|
239
|
-
, end = Math.min(lines.length, lineno + context);
|
240
|
-
|
241
|
-
// Error context
|
242
|
-
var context = lines.slice(start, end).map(function(line, i){
|
243
|
-
var curr = i + start + 1;
|
244
|
-
return (curr == lineno ? ' > ' : ' ')
|
245
|
-
+ curr
|
246
|
-
+ '| '
|
247
|
-
+ line;
|
248
|
-
}).join('\n');
|
249
|
-
|
250
|
-
// Alter exception message
|
251
|
-
err.path = filename;
|
252
|
-
err.message = (filename || 'Pug') + ':' + lineno
|
253
|
-
+ '\n' + context + '\n\n' + err.message;
|
254
|
-
throw err;
|
255
|
-
};
|
256
|
-
},{"fs":2}],2:[function(require,module,exports){
|
257
|
-
|
258
|
-
},{}]},{},[1])(1)
|
259
|
-
});
|