Not serving mapsymbolizer. Sort of fixes #1

This commit is contained in:
Tom MacWright 2011-01-03 16:35:52 -05:00
parent 094628e295
commit bf2ac07bde
3 changed files with 18 additions and 10 deletions

View File

@ -849,6 +849,12 @@ less.Parser = function Parser(env) {
if (s) $(this.comment);
if (selectors.length > 0 && (rules = $(this.block))) {
if (selectors.length === 1 &&
selectors[0].elements[0].value === 'Map') {
var rs = new(tree.Ruleset)(selectors, rules);
rs.is_map = true;
return rs;
}
return new(tree.Ruleset)(selectors, rules);
} else {
// Backtrack

View File

@ -161,6 +161,7 @@ tree.Ruleset.prototype = {
// a selector, or {}.
// Otherwise, only output if this ruleset has rules.
if (this.root) {
css.push('<Map bgcolor="#000000">');
css.push(rules.join(env.compress ? '' : '\n'));
} else {
if (rules.length > 0) {
@ -183,18 +184,19 @@ tree.Ruleset.prototype = {
return out;
})(symbolizers);
}
console.log(selector);
css.push('<Style>\n' +
selector +
'\n<Rule>\n' +
rules.join('\n') +
'\n</Rule>\n' +
'</Style>\n');
if (this.selectors[0].elements[0].value !== 'Map') {
css.push('<Style name="' +
selector +
'">\n<Rule>\n' +
rules.join('\n') +
'\n</Rule>\n' +
'</Style>\n');
}
}
}
css.push(rulesets);
return css.join('') + (env.compress ? '\n' : '');
return css.join('') + (env.compress ? '\n' : '') + (this.root ? '</Map>' : '');
}
};
})(require('less/tree'));

View File

@ -18,8 +18,8 @@ tree.Selector.prototype.toCSS = function (env) {
if (this._css) { return this._css }
return this._css = this.elements.map(function (f) {
return f.toCSS(env);
}).join('-');
return f.toCSS(env).trim();
}).join('--');
};
})(require('less/tree'));