Compare commits

...

14 Commits

@ -673,7 +673,7 @@ carto.Parser = function Parser(env) {
zoom: function() {
save();
var op, val;
if ($(/^\[zoom/g) &&
if ($(/^\[\s*zoom/g) &&
(op = $(this.entities.comparison)) &&
(val = $(/^\d+/)) &&
$(']')) {

@ -128,8 +128,8 @@ tree.Definition.prototype.symbolizersToXML = function(env, symbolizers, zoom) {
}
if (selfclosing) {
xml += '/>\n';
} else {
if (tagcontent.indexOf('<Format') != -1) {
} else if (tagcontent) {
if (tagcontent.indexOf('<') != -1) {
xml += '>' + tagcontent + '</' + name + '>\n';
} else {
xml += '><![CDATA[' + tagcontent + ']]></' + name + '>\n';

@ -1,6 +1,13 @@
(function(tree) {
tree.Filter = function Filter(key, op, val, index, filename) {
// See https://github.com/mapbox/carto/issues/180
// TODO: use mapnik-reference for these conversion ?
if ( key == "mapnik-geometry-type" ) {
key = "mapnik::geometry_type"
}
if (key.is) {
this.key = key.value;
this._key = key;

@ -7,7 +7,12 @@ tree.Quoted = function Quoted(content) {
tree.Quoted.prototype = {
toString: function(quotes) {
var xmlvalue = this.value.replace(/\'/g, '&apos;');
var xmlvalue = this.value
.replace(/&/g, '&amp;')
.replace(/\'/g, '\\\'')
.replace(/\"/g, '&quot;')
.replace(/</g, '&lt;')
.replace(/\>/g, '&gt;');
return (quotes === true) ? "'" + xmlvalue + "'" : this.value;
},

@ -1,6 +1,6 @@
{
"name": "carto",
"version": "0.9.3",
"version": "0.9.3-cdb6",
"description": "Mapnik Stylesheet Compiler",
"url": "https://github.com/mapbox/carto",
"repositories": [{
@ -36,7 +36,7 @@
},
"dependencies": {
"underscore": "~1.3.3",
"mapnik-reference": "~5.0.0",
"mapnik-reference": "git://github.com/CartoDB/mapnik-reference.git#cdb-5.0",
"xml2js": "~0.1.13"
},
"devDependencies": {

@ -0,0 +1,11 @@
Since we can't put comments in the package.json file
this file fills that gap.
Dependencies needing comments:
"mapnik-reference"
We use our own fork because we need advertisement of "marker-multi-policy"
which is only in the reference of mapnik-2.1.1. Can be reverted to upstream
once this pull request is released:
https://github.com/mapnik/mapnik-reference/pull/41

@ -0,0 +1,4 @@
#t {
text-name: invalid;
text-face-name: "Dejagnu";
}

@ -0,0 +1 @@
issue297.mss:2:2 Invalid value for text-name, the type expression is expected. invalid (of type keyword) was given.

@ -0,0 +1,23 @@
var assert = require('assert');
var tree = require('../lib/carto/tree.js');
require('../lib/carto/tree/quoted');
describe('Quoted', function() {
describe('basic functionality', function() {
it('should be constructed', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.is, 'string');
});
it('should produce normal output', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.toString(), "Tom's & \"<quoted>\"");
});
it('should produce xml-friendly output', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.toString(true), "'Tom\\'s &amp; &quot;&lt;quoted&gt;&quot;'");
});
});
});

@ -5,7 +5,7 @@
<Style name="world" filter-mode="first">
<Rule>
<Filter>([name2] = ' Sa&apos;ad')</Filter>
<Filter>([name2] = ' Sa\'ad')</Filter>
<PolygonSymbolizer fill="#ffffff" />
</Rule>
</Style>

Loading…
Cancel
Save