font property parsing, mainly the 'small/12px' part.
This commit is contained in:
parent
9c0fb7174e
commit
553aaecf6a
@ -258,8 +258,6 @@ less.parser = {
|
||||
|
||||
return new(tree.URL)(value);
|
||||
},
|
||||
font: function () {
|
||||
},
|
||||
variable: function () {
|
||||
var name;
|
||||
|
||||
@ -288,6 +286,15 @@ less.parser = {
|
||||
|
||||
if (input[i] === '@' && (name = $(/(@[a-zA-Z0-9_-]+)\s*:/g))) { return name[1] }
|
||||
},
|
||||
shorthand: function () {
|
||||
var a, b;
|
||||
|
||||
if (! peek(/[@\w.-]+\/[@\w.-]+/g)) return;
|
||||
|
||||
if ((a = $(this.entity)) && $('/') && (b = $(this.entity))) {
|
||||
return new(tree.Shorthand)(a, b);
|
||||
}
|
||||
},
|
||||
mixin: {
|
||||
call: function () {
|
||||
var elements = [], e, c, args;
|
||||
@ -428,6 +435,8 @@ less.parser = {
|
||||
if ((name[0] != '@') && (match = peek(/([^@+\/*(;{}-]*);[\s\n]*/g))) {
|
||||
i += match[0].length;
|
||||
return new(tree.Rule)(name, match[1]);
|
||||
} else if ((name === "font") && (value = $(this.font)) && $(this.end)) {
|
||||
return new(tree.Rule)(name, value);
|
||||
} else if ((value = $(this.value)) && ($(';') || peek('}'))) {
|
||||
return new(tree.Rule)(name, value);
|
||||
}
|
||||
@ -453,6 +462,22 @@ less.parser = {
|
||||
}
|
||||
}
|
||||
},
|
||||
font: function () {
|
||||
var value = [], expression = [], weight, shorthand, font, e;
|
||||
|
||||
while (e = $(this.shorthand) || $(this.entity)) {
|
||||
expression.push(e);
|
||||
}
|
||||
value.push(new(tree.Expression)(expression));
|
||||
|
||||
if ($(',')) {
|
||||
while (e = $(this.expression)) {
|
||||
value.push(e);
|
||||
if (! $(',')) { break }
|
||||
}
|
||||
}
|
||||
return new(tree.Value)(value, $(this.important));
|
||||
},
|
||||
value: function () {
|
||||
var e, expressions = [], important;
|
||||
|
||||
@ -460,12 +485,15 @@ less.parser = {
|
||||
expressions.push(e);
|
||||
if (! $(',')) { break }
|
||||
}
|
||||
important = $(/!\s*important/g);
|
||||
important = $(this.important);
|
||||
|
||||
if (expressions.length > 0) {
|
||||
return new(tree.Value)(expressions, important);
|
||||
}
|
||||
},
|
||||
important: function () {
|
||||
return $(/!\s*important/g);
|
||||
},
|
||||
sub: function () {
|
||||
var e;
|
||||
|
||||
|
@ -35,3 +35,13 @@ tree.Value.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
tree.Shorthand = function Shorthand(a, b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
};
|
||||
|
||||
tree.Shorthand.prototype = {
|
||||
toCSS: function (env) {
|
||||
return this.a.toCSS(env) + "/" + this.b.toCSS(env);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user