Compare commits

...

14 Commits

Author SHA1 Message Date
Sandro Santilli
9f45675496 Set version to 0.9.3-cdb6 2013-10-03 14:08:21 +02:00
Sandro Santilli
fa994557e8 Fix escaping of single quote. Closes #307, updates tests. 2013-10-03 13:46:27 +02:00
Tom MacWright
761b05b599 Correctly deal with invalid content in non-selfclosing tags. Fixes #297 2013-09-11 17:28:24 +02:00
Sandro Santilli
6745bdf634 Revert "symbolizersToXML: Do not assume tagcontent has a value"
This reverts commit c89ed510ff.

A different fix was committed upstream, and I'm going to
cherry-pick that one.
2013-09-11 17:26:45 +02:00
Sandro Santilli
8d4d1c8a50 Set version to 0.9.3-cdb5 2013-09-11 15:42:37 +02:00
Sandro Santilli
c89ed510ff symbolizersToXML: Do not assume tagcontent has a value
Fixes #297

See https://github.com/mapbox/carto/pull/207
2013-09-11 15:41:50 +02:00
Sandro Santilli
a6439e3f92 Set version to 0.9.3-cdb4 2013-09-09 11:21:52 +02:00
javi
9e8eebcd5a fixes mapbox/carto#288 2013-09-09 11:21:00 +02:00
Sandro Santilli
8b0940b2c3 Set version to 0.9.3-cdb3 2013-03-22 11:20:39 +01:00
Sandro Santilli
ebf08584d3 Quote ampersend chars in XML text. Closes #263. 2013-03-22 11:20:02 +01:00
Sandro Santilli
e9c1e3925d Set version to 0.9.3-cdb2 for the mapnik-reference requirement 2012-11-22 18:57:27 +01:00
Sandro Santilli
9043e70cf3 Require our fork of mapnik-reference to get marker-multi-policy
See https://github.com/Vizzuality/grainstore/issues/36
2012-11-22 18:21:06 +01:00
Sandro Santilli
7b6a4b7820 Set version to 0.9.3-cdb1 2012-11-02 12:23:08 +01:00
Sandro Santilli
66216f7c7d Add support for "mapnik-geometry-type" in filters
See https://github.com/mapbox/carto/issues/180
2012-11-02 11:59:14 +01:00
10 changed files with 58 additions and 7 deletions

View File

@ -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+/)) &&
$(']')) {

View File

@ -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';

View File

@ -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;

View File

@ -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;
},

View File

@ -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": {

11
package.json.README Normal file
View File

@ -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

View File

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

View File

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

23
test/quoted.test.js Normal file
View File

@ -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;'");
});
});
});

View File

@ -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>