mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
Add support for unicode descriptors. Fixes #1107
This commit is contained in:
@@ -89,7 +89,7 @@ var less = {
|
||||
'call', 'url', 'alpha', 'import',
|
||||
'mixin', 'comment', 'anonymous', 'value',
|
||||
'javascript', 'assignment', 'condition', 'paren',
|
||||
'media', 'ratio'
|
||||
'media', 'ratio', 'unicode-descriptor'
|
||||
].forEach(function (n) {
|
||||
require('./tree/' + n);
|
||||
});
|
||||
|
||||
@@ -631,7 +631,8 @@ less.Parser = function Parser(env) {
|
||||
return $(this.entities.ratio) ||
|
||||
$(this.entities.dimension) ||
|
||||
$(this.entities.color) ||
|
||||
$(this.entities.quoted);
|
||||
$(this.entities.quoted) ||
|
||||
$(this.entities.unicodeDescriptor);
|
||||
},
|
||||
|
||||
// Assignments are argument entities for calls.
|
||||
@@ -734,6 +735,19 @@ less.Parser = function Parser(env) {
|
||||
return new(tree.Ratio)(value[1]);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// A unicode descriptor, as is used in unicode-range
|
||||
//
|
||||
// U+0?? or U+00A1-00A9
|
||||
//
|
||||
unicodeDescriptor: function () {
|
||||
var ud;
|
||||
|
||||
if (ud = $(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/)) {
|
||||
return new(tree.UnicodeDescriptor)(ud[0]);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// JavaScript code to be evaluated
|
||||
@@ -962,7 +976,7 @@ less.Parser = function Parser(env) {
|
||||
//
|
||||
entity: function () {
|
||||
return $(this.entities.literal) || $(this.entities.variable) || $(this.entities.url) ||
|
||||
$(this.entities.call) || $(this.entities.keyword) || $(this.entities.javascript) ||
|
||||
$(this.entities.call) || $(this.entities.keyword) ||$(this.entities.javascript) ||
|
||||
$(this.comment);
|
||||
},
|
||||
|
||||
@@ -1073,9 +1087,6 @@ less.Parser = function Parser(env) {
|
||||
|
||||
if (elements.length > 0) { return new(tree.Selector)(elements) }
|
||||
},
|
||||
tag: function () {
|
||||
return $(/^[A-Za-z][A-Za-z-]*[0-9]?/) || $('*');
|
||||
},
|
||||
attribute: function () {
|
||||
var attr = '', key, val, op;
|
||||
|
||||
|
||||
13
lib/less/tree/unicode-descriptor.js
Normal file
13
lib/less/tree/unicode-descriptor.js
Normal file
@@ -0,0 +1,13 @@
|
||||
(function (tree) {
|
||||
|
||||
tree.UnicodeDescriptor = function (value) {
|
||||
this.value = value;
|
||||
};
|
||||
tree.UnicodeDescriptor.prototype = {
|
||||
toCSS: function (env) {
|
||||
return this.value;
|
||||
},
|
||||
eval: function () { return this }
|
||||
};
|
||||
|
||||
})(require('../tree'));
|
||||
@@ -6,6 +6,7 @@
|
||||
@font-face {
|
||||
font-family: Headline;
|
||||
src: local(Futura-Medium), url(fonts.svg#MyGeometricModern) format("svg");
|
||||
unicode-range: U+??????, U+0???, U+0-7F, U+A5;
|
||||
}
|
||||
.other {
|
||||
-moz-transform: translate(0, 11em) rotate(-90deg);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
font-family: Headline;
|
||||
src: local(Futura-Medium),
|
||||
url(fonts.svg#MyGeometricModern) format("svg");
|
||||
unicode-range: U+??????, U+0???, U+0-7F, U+A5;
|
||||
}
|
||||
.other {
|
||||
-moz-transform: translate(0, 11em) rotate(-90deg);
|
||||
|
||||
Reference in New Issue
Block a user