stylus-source 0.19.2 → 0.19.3
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.
- data/VERSION +1 -1
- data/vendor/History.md +7 -0
- data/vendor/lib/lexer.js +29 -27
- data/vendor/lib/stylus.js +1 -1
- data/vendor/lib/visitor/evaluator.js +16 -5
- data/vendor/package.json +1 -1
- data/vendor/test/cases/eol-escape.css +11 -0
- data/vendor/test/cases/eol-escape.styl +27 -0
- data/vendor/test/cases/regression.460.css +13 -0
- data/vendor/test/cases/regression.460.styl +18 -0
- data/vendor/testing/test.css +4 -8
- data/vendor/testing/test.js +1 -0
- data/vendor/testing/test.styl +4 -2
- metadata +6 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.19.
|
|
1
|
+
0.19.3
|
data/vendor/History.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
0.19.3 / 2011-11-17
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
* Added "include css" setting (need docs) to literally include imported css. Closes #448
|
|
6
|
+
* Added EOL escape. Related to #195
|
|
7
|
+
* Fixed tab support in lexical analysis (trailing colors etc). Closes #460
|
|
8
|
+
|
|
2
9
|
0.19.2 / 2011-11-09
|
|
3
10
|
==================
|
|
4
11
|
|
data/vendor/lib/lexer.js
CHANGED
|
@@ -53,7 +53,7 @@ var units = [
|
|
|
53
53
|
* Unit RegExp.
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
-
var unit = new RegExp('^(-)?(\\d+\\.\\d+|\\d+|\\.\\d+)(' + units + ')? *');
|
|
56
|
+
var unit = new RegExp('^(-)?(\\d+\\.\\d+|\\d+|\\.\\d+)(' + units + ')?[ \\t]*');
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Initialize a new `Lexer` with the given `str` and `options`.
|
|
@@ -65,11 +65,13 @@ var unit = new RegExp('^(-)?(\\d+\\.\\d+|\\d+|\\.\\d+)(' + units + ')? *');
|
|
|
65
65
|
|
|
66
66
|
var Lexer = module.exports = function Lexer(str, options) {
|
|
67
67
|
options = options || {};
|
|
68
|
-
this.str = str.replace(/\r\n?/g, '\n');
|
|
69
68
|
this.stash = [];
|
|
70
69
|
this.indentStack = [];
|
|
71
70
|
this.indentRe = null;
|
|
72
71
|
this.lineno = 1;
|
|
72
|
+
this.str = str
|
|
73
|
+
.replace(/\r\n?/g, '\n')
|
|
74
|
+
.replace(/\\ *\n/g, ' ');
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
/**
|
|
@@ -228,12 +230,12 @@ Lexer.prototype = {
|
|
|
228
230
|
},
|
|
229
231
|
|
|
230
232
|
/**
|
|
231
|
-
* ';'
|
|
233
|
+
* ';' [ \t]*
|
|
232
234
|
*/
|
|
233
235
|
|
|
234
236
|
sep: function() {
|
|
235
237
|
var captures;
|
|
236
|
-
if (captures = /^; */.exec(this.str)) {
|
|
238
|
+
if (captures = /^;[ \t]*/.exec(this.str)) {
|
|
237
239
|
this.skip(captures);
|
|
238
240
|
return new Token(';');
|
|
239
241
|
}
|
|
@@ -245,7 +247,7 @@ Lexer.prototype = {
|
|
|
245
247
|
|
|
246
248
|
space: function() {
|
|
247
249
|
var captures;
|
|
248
|
-
if (captures = /^( +)/.exec(this.str)) {
|
|
250
|
+
if (captures = /^([ \t]+)/.exec(this.str)) {
|
|
249
251
|
this.skip(captures);
|
|
250
252
|
return new Token('space');
|
|
251
253
|
}
|
|
@@ -257,7 +259,7 @@ Lexer.prototype = {
|
|
|
257
259
|
|
|
258
260
|
escaped: function() {
|
|
259
261
|
var captures;
|
|
260
|
-
if (captures = /^\\(.) */.exec(this.str)) {
|
|
262
|
+
if (captures = /^\\(.)[ \t]*/.exec(this.str)) {
|
|
261
263
|
var c = captures[1];
|
|
262
264
|
this.skip(captures);
|
|
263
265
|
return new Token('ident', new nodes.Literal(c));
|
|
@@ -271,7 +273,7 @@ Lexer.prototype = {
|
|
|
271
273
|
literal: function() {
|
|
272
274
|
// HACK attack !!!
|
|
273
275
|
var captures;
|
|
274
|
-
if (captures = /^@css *\{/.exec(this.str)) {
|
|
276
|
+
if (captures = /^@css[ \t]*\{/.exec(this.str)) {
|
|
275
277
|
this.skip(captures);
|
|
276
278
|
var c
|
|
277
279
|
, braces = 1
|
|
@@ -296,7 +298,7 @@ Lexer.prototype = {
|
|
|
296
298
|
|
|
297
299
|
important: function() {
|
|
298
300
|
var captures;
|
|
299
|
-
if (captures = /^!important */.exec(this.str)) {
|
|
301
|
+
if (captures = /^!important[ \t]*/.exec(this.str)) {
|
|
300
302
|
this.skip(captures);
|
|
301
303
|
return new Token('ident', new nodes.Literal('!important'));
|
|
302
304
|
}
|
|
@@ -321,7 +323,7 @@ Lexer.prototype = {
|
|
|
321
323
|
|
|
322
324
|
paren: function() {
|
|
323
325
|
var captures;
|
|
324
|
-
if (captures = /^([()]) */.exec(this.str)) {
|
|
326
|
+
if (captures = /^([()])[ \t]*/.exec(this.str)) {
|
|
325
327
|
var paren = captures[1];
|
|
326
328
|
this.skip(captures);
|
|
327
329
|
if (')' == paren) this.isURL = false;
|
|
@@ -335,7 +337,7 @@ Lexer.prototype = {
|
|
|
335
337
|
|
|
336
338
|
null: function() {
|
|
337
339
|
var captures;
|
|
338
|
-
if (captures = /^(null)\b */.exec(this.str)) {
|
|
340
|
+
if (captures = /^(null)\b[ \t]*/.exec(this.str)) {
|
|
339
341
|
this.skip(captures);
|
|
340
342
|
return new Token('null', nodes.null);
|
|
341
343
|
}
|
|
@@ -352,7 +354,7 @@ Lexer.prototype = {
|
|
|
352
354
|
|
|
353
355
|
keyword: function() {
|
|
354
356
|
var captures;
|
|
355
|
-
if (captures = /^(return|if|else|unless|for|in)\b */.exec(this.str)) {
|
|
357
|
+
if (captures = /^(return|if|else|unless|for|in)\b[ \t]*/.exec(this.str)) {
|
|
356
358
|
var keyword = captures[1];
|
|
357
359
|
this.skip(captures);
|
|
358
360
|
return new Token(keyword, keyword);
|
|
@@ -372,7 +374,7 @@ Lexer.prototype = {
|
|
|
372
374
|
|
|
373
375
|
namedop: function() {
|
|
374
376
|
var captures;
|
|
375
|
-
if (captures = /^(not|and|or|is a|is defined|isnt|is not|is)\b( *)/.exec(this.str)) {
|
|
377
|
+
if (captures = /^(not|and|or|is a|is defined|isnt|is not|is)\b([ \t]*)/.exec(this.str)) {
|
|
376
378
|
var op = captures[1];
|
|
377
379
|
this.skip(captures);
|
|
378
380
|
op = alias[op] || op;
|
|
@@ -420,7 +422,7 @@ Lexer.prototype = {
|
|
|
420
422
|
|
|
421
423
|
op: function() {
|
|
422
424
|
var captures;
|
|
423
|
-
if (captures = /^([.]{2,3}|&&|\|\||[!<>=?:]=|\*\*|[-+*\/%]=?|[,=?:!~<>&\[\]])( *)/.exec(this.str)) {
|
|
425
|
+
if (captures = /^([.]{2,3}|&&|\|\||[!<>=?:]=|\*\*|[-+*\/%]=?|[,=?:!~<>&\[\]])([ \t]*)/.exec(this.str)) {
|
|
424
426
|
var op = captures[1];
|
|
425
427
|
this.skip(captures);
|
|
426
428
|
op = alias[op] || op;
|
|
@@ -436,7 +438,7 @@ Lexer.prototype = {
|
|
|
436
438
|
|
|
437
439
|
media: function() {
|
|
438
440
|
var captures;
|
|
439
|
-
if (captures = /^@media *([^\/{\n]+)/.exec(this.str)) {
|
|
441
|
+
if (captures = /^@media[ \t]*([^\/{\n]+)/.exec(this.str)) {
|
|
440
442
|
this.skip(captures);
|
|
441
443
|
return new Token('media', captures[1].trim());
|
|
442
444
|
}
|
|
@@ -448,7 +450,7 @@ Lexer.prototype = {
|
|
|
448
450
|
|
|
449
451
|
scope: function() {
|
|
450
452
|
var captures;
|
|
451
|
-
if (captures = /^@scope *([^\/{\n]+)/.exec(this.str)) {
|
|
453
|
+
if (captures = /^@scope[ \t]*([^\/{\n]+)/.exec(this.str)) {
|
|
452
454
|
this.skip(captures);
|
|
453
455
|
return new Token('scope', captures[1].trim());
|
|
454
456
|
}
|
|
@@ -460,7 +462,7 @@ Lexer.prototype = {
|
|
|
460
462
|
|
|
461
463
|
atrule: function() {
|
|
462
464
|
var captures;
|
|
463
|
-
if (captures = /^@(import|(?:-(\w+)-)?keyframes|charset|font-face|page) */.exec(this.str)) {
|
|
465
|
+
if (captures = /^@(import|(?:-(\w+)-)?keyframes|charset|font-face|page)[ \t]*/.exec(this.str)) {
|
|
464
466
|
this.skip(captures);
|
|
465
467
|
var vendor = captures[2]
|
|
466
468
|
, type = captures[1];
|
|
@@ -506,7 +508,7 @@ Lexer.prototype = {
|
|
|
506
508
|
|
|
507
509
|
boolean: function() {
|
|
508
510
|
var captures;
|
|
509
|
-
if (captures = /^(true|false)\b( *)/.exec(this.str)) {
|
|
511
|
+
if (captures = /^(true|false)\b([ \t]*)/.exec(this.str)) {
|
|
510
512
|
var val = nodes.Boolean('true' == captures[1]);
|
|
511
513
|
this.skip(captures);
|
|
512
514
|
var tok = new Token('boolean', val);
|
|
@@ -521,7 +523,7 @@ Lexer.prototype = {
|
|
|
521
523
|
|
|
522
524
|
function: function() {
|
|
523
525
|
var captures;
|
|
524
|
-
if (captures = /^(-?[a-zA-Z$][-\w\d$]*)\(( *)/.exec(this.str)) {
|
|
526
|
+
if (captures = /^(-?[a-zA-Z$][-\w\d$]*)\(([ \t]*)/.exec(this.str)) {
|
|
525
527
|
var name = captures[1];
|
|
526
528
|
this.skip(captures);
|
|
527
529
|
this.isURL = 'url' == name;
|
|
@@ -560,12 +562,12 @@ Lexer.prototype = {
|
|
|
560
562
|
// figure out if we are using tabs or spaces
|
|
561
563
|
} else {
|
|
562
564
|
// try tabs
|
|
563
|
-
re = /^\n([\t]*) */;
|
|
565
|
+
re = /^\n([\t]*)[ \t]*/;
|
|
564
566
|
captures = re.exec(this.str);
|
|
565
567
|
|
|
566
568
|
// nope, try spaces
|
|
567
569
|
if (captures && !captures[1].length) {
|
|
568
|
-
re = /^\n( *)/;
|
|
570
|
+
re = /^\n([ \t]*)/;
|
|
569
571
|
captures = re.exec(this.str);
|
|
570
572
|
}
|
|
571
573
|
|
|
@@ -633,7 +635,7 @@ Lexer.prototype = {
|
|
|
633
635
|
|
|
634
636
|
string: function() {
|
|
635
637
|
var captures;
|
|
636
|
-
if (captures = /^("[^"]*"|'[^']*') */.exec(this.str)) {
|
|
638
|
+
if (captures = /^("[^"]*"|'[^']*')[ \t]*/.exec(this.str)) {
|
|
637
639
|
var str = captures[1]
|
|
638
640
|
, quote = captures[0][0];
|
|
639
641
|
this.skip(captures);
|
|
@@ -661,7 +663,7 @@ Lexer.prototype = {
|
|
|
661
663
|
|
|
662
664
|
n: function() {
|
|
663
665
|
var captures;
|
|
664
|
-
if (captures = /^#([a-fA-F0-9]{1}) */.exec(this.str)) {
|
|
666
|
+
if (captures = /^#([a-fA-F0-9]{1})[ \t]*/.exec(this.str)) {
|
|
665
667
|
this.skip(captures);
|
|
666
668
|
var n = parseInt(captures[1] + captures[1], 16)
|
|
667
669
|
, color = new nodes.RGBA(n, n, n, 1);
|
|
@@ -676,7 +678,7 @@ Lexer.prototype = {
|
|
|
676
678
|
|
|
677
679
|
nn: function() {
|
|
678
680
|
var captures;
|
|
679
|
-
if (captures = /^#([a-fA-F0-9]{2}) */.exec(this.str)) {
|
|
681
|
+
if (captures = /^#([a-fA-F0-9]{2})[ \t]*/.exec(this.str)) {
|
|
680
682
|
this.skip(captures);
|
|
681
683
|
var n = parseInt(captures[1], 16)
|
|
682
684
|
, color = new nodes.RGBA(n, n, n, 1);
|
|
@@ -691,7 +693,7 @@ Lexer.prototype = {
|
|
|
691
693
|
|
|
692
694
|
rgb: function() {
|
|
693
695
|
var captures;
|
|
694
|
-
if (captures = /^#([a-fA-F0-9]{3}) */.exec(this.str)) {
|
|
696
|
+
if (captures = /^#([a-fA-F0-9]{3})[ \t]*/.exec(this.str)) {
|
|
695
697
|
this.skip(captures);
|
|
696
698
|
var rgb = captures[1]
|
|
697
699
|
, r = parseInt(rgb[0] + rgb[0], 16)
|
|
@@ -709,7 +711,7 @@ Lexer.prototype = {
|
|
|
709
711
|
|
|
710
712
|
rgba: function() {
|
|
711
713
|
var captures;
|
|
712
|
-
if (captures = /^#([a-fA-F0-9]{4}) */.exec(this.str)) {
|
|
714
|
+
if (captures = /^#([a-fA-F0-9]{4})[ \t]*/.exec(this.str)) {
|
|
713
715
|
this.skip(captures);
|
|
714
716
|
var rgb = captures[1]
|
|
715
717
|
, r = parseInt(rgb[0] + rgb[0], 16)
|
|
@@ -728,7 +730,7 @@ Lexer.prototype = {
|
|
|
728
730
|
|
|
729
731
|
rrggbb: function() {
|
|
730
732
|
var captures;
|
|
731
|
-
if (captures = /^#([a-fA-F0-9]{6}) */.exec(this.str)) {
|
|
733
|
+
if (captures = /^#([a-fA-F0-9]{6})[ \t]*/.exec(this.str)) {
|
|
732
734
|
this.skip(captures);
|
|
733
735
|
var rgb = captures[1]
|
|
734
736
|
, r = parseInt(rgb.substr(0, 2), 16)
|
|
@@ -746,7 +748,7 @@ Lexer.prototype = {
|
|
|
746
748
|
|
|
747
749
|
rrggbbaa: function() {
|
|
748
750
|
var captures;
|
|
749
|
-
if (captures = /^#([a-fA-F0-9]{8}) */.exec(this.str)) {
|
|
751
|
+
if (captures = /^#([a-fA-F0-9]{8})[ \t]*/.exec(this.str)) {
|
|
750
752
|
this.skip(captures);
|
|
751
753
|
var rgb = captures[1]
|
|
752
754
|
, r = parseInt(rgb.substr(0, 2), 16)
|
data/vendor/lib/stylus.js
CHANGED
|
@@ -43,6 +43,7 @@ var Evaluator = module.exports = function Evaluator(root, options) {
|
|
|
43
43
|
this.globals = options.globals || {};
|
|
44
44
|
this.paths = options.paths || [];
|
|
45
45
|
this.filename = options.filename;
|
|
46
|
+
this.includeCSS = options['include css'];
|
|
46
47
|
this.paths.push(dirname(options.filename || '.'));
|
|
47
48
|
this.stack.push(this.global = new Frame(root));
|
|
48
49
|
this.warnings = options.warn;
|
|
@@ -572,7 +573,9 @@ Evaluator.prototype.visitImport = function(imported){
|
|
|
572
573
|
var found
|
|
573
574
|
, root = this.root
|
|
574
575
|
, Parser = require('../parser')
|
|
575
|
-
, path = this.visit(imported.path).first
|
|
576
|
+
, path = this.visit(imported.path).first
|
|
577
|
+
, includeCSS = this.includeCSS
|
|
578
|
+
, literal;
|
|
576
579
|
|
|
577
580
|
this.return = _;
|
|
578
581
|
|
|
@@ -584,8 +587,13 @@ Evaluator.prototype.visitImport = function(imported){
|
|
|
584
587
|
var name = path = path.string;
|
|
585
588
|
|
|
586
589
|
// Literal
|
|
587
|
-
if (~path.indexOf('.css'))
|
|
588
|
-
|
|
590
|
+
if (~path.indexOf('.css')) {
|
|
591
|
+
literal = true;
|
|
592
|
+
if (!includeCSS) return imported;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// support optional .styl
|
|
596
|
+
if (!literal && !~path.indexOf('.styl')) path += '.styl';
|
|
589
597
|
|
|
590
598
|
// Lookup
|
|
591
599
|
found = utils.lookup(path, this.paths, this.filename);
|
|
@@ -604,8 +612,11 @@ Evaluator.prototype.visitImport = function(imported){
|
|
|
604
612
|
this.importStack.push(found);
|
|
605
613
|
nodes.filename = found;
|
|
606
614
|
|
|
607
|
-
var str = fs.readFileSync(found, 'utf8')
|
|
608
|
-
|
|
615
|
+
var str = fs.readFileSync(found, 'utf8');
|
|
616
|
+
if (literal) return new nodes.Literal(str);
|
|
617
|
+
|
|
618
|
+
// parse
|
|
619
|
+
var block = new nodes.Block
|
|
609
620
|
, parser = new Parser(str, utils.merge({ root: block }, this.options));
|
|
610
621
|
|
|
611
622
|
try {
|
data/vendor/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{ "name": "stylus"
|
|
2
2
|
, "description": "Robust, expressive, and feature-rich CSS superset"
|
|
3
|
-
, "version": "0.19.
|
|
3
|
+
, "version": "0.19.3"
|
|
4
4
|
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
|
|
5
5
|
, "keywords": ["css", "parser", "style", "stylesheets", "jade", "language"]
|
|
6
6
|
, "repository": "git://github.com/learnboost/stylus"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
list = foo \
|
|
3
|
+
bar \
|
|
4
|
+
baz
|
|
5
|
+
|
|
6
|
+
map = (one 1) \
|
|
7
|
+
(two 2) \
|
|
8
|
+
(three 3)
|
|
9
|
+
|
|
10
|
+
body
|
|
11
|
+
foo: list
|
|
12
|
+
for val, key in map
|
|
13
|
+
{val}: key
|
|
14
|
+
|
|
15
|
+
foo( \
|
|
16
|
+
a, \
|
|
17
|
+
b)
|
|
18
|
+
padding: unit(a, px) \
|
|
19
|
+
unit(b, px)
|
|
20
|
+
|
|
21
|
+
button
|
|
22
|
+
foo: 1 2
|
|
23
|
+
box-shadow: \
|
|
24
|
+
0 -2px 2px red, \
|
|
25
|
+
0 0 2px red, \
|
|
26
|
+
0 0 5px red
|
|
27
|
+
color: red
|
data/vendor/testing/test.css
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
body{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
body .tip.username-tip{position:fixed;}
|
|
6
|
-
body .tip.username-tip canvas{position:absolute}
|
|
7
|
-
body .tip.password-tip{position:fixed;}
|
|
8
|
-
body .tip.password-tip canvas{position:absolute}
|
|
1
|
+
|
|
2
|
+
body {
|
|
3
|
+
foo: bar;
|
|
4
|
+
}
|
data/vendor/testing/test.js
CHANGED
data/vendor/testing/test.styl
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stylus-source
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.19.
|
|
4
|
+
version: 0.19.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2011-11-
|
|
12
|
+
date: 2011-11-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Robust, expressive, and feature-rich CSS superset. This gem packages
|
|
15
15
|
up stylus for use with the stylus gem.
|
|
@@ -315,6 +315,8 @@ files:
|
|
|
315
315
|
- vendor/test/cases/css.selectors.styl
|
|
316
316
|
- vendor/test/cases/css.whitespace.css
|
|
317
317
|
- vendor/test/cases/css.whitespace.styl
|
|
318
|
+
- vendor/test/cases/eol-escape.css
|
|
319
|
+
- vendor/test/cases/eol-escape.styl
|
|
318
320
|
- vendor/test/cases/escape.css
|
|
319
321
|
- vendor/test/cases/escape.styl
|
|
320
322
|
- vendor/test/cases/fontface.css
|
|
@@ -557,6 +559,8 @@ files:
|
|
|
557
559
|
- vendor/test/cases/regression.440.styl
|
|
558
560
|
- vendor/test/cases/regression.458.css
|
|
559
561
|
- vendor/test/cases/regression.458.styl
|
|
562
|
+
- vendor/test/cases/regression.460.css
|
|
563
|
+
- vendor/test/cases/regression.460.styl
|
|
560
564
|
- vendor/test/cases/reset.css
|
|
561
565
|
- vendor/test/cases/reset.styl
|
|
562
566
|
- vendor/test/cases/rule.charset.css
|