Closed leffjesh closed 8 years ago
Hi @leffjesh - can you share the exact CSS that shows up in the style editor?
Also, can you share which TileMill version you are running?
TileMill version: 0.10.1
this style sheet errors out for me in tilemill. note there is now a different (contrived) case statement that errors out since my project has evolved. i can get the original if you want, but this one errors as well.
/* Generated by Arc2Earth Sync - TileMill Connect on 3/11/2013 5:49 PM (725764461) */
#CCSWCD_Weed_Points {
marker-opacity: 1;
marker-allow-overlap: true;
marker-placement: point;
marker-clip: false;
marker-file: url("C:\Users\jlesh\Documents\A2ESync\TileMill\Markers\6bcdfe2cd7f644959d2fcc05a8680065.svg");
.... snip ....
[commonname = "Kudzu, Japanese arrowroot"] {
marker-opacity: 1;
marker-allow-overlap: true;
marker-placement: point;
marker-clip: false;
marker-file: url("C:\Users\jlesh\Documents\A2ESync\TileMill\Markers\b0d221f33198462db3af2feb0118fd83.svg");
}
[commonname = "Purple Loosestrife's ERROR"] {
marker-opacity: 1;
marker-allow-overlap: true;
marker-placement: point;
marker-clip: false;
marker-file: url("C:\Users\jlesh\Documents\A2ESync\TileMill\Markers\b8d2a69520f34bbaa9fe4e67409db215.svg");
}
}
Thanks for the details. I've confirmed the bug in latest TileMill/Carto.
/cc @tmcw @artemp - seems like this could be handled in one of two ways:
1) Carto could work harder to find embedded single quotes and escape them on the fly or 2) Mapnik could start supporting using double quotes to wrap attribute names, not just single quotes
Looks like carto can be easily fixed:
diff --git a/lib/carto/tree/quoted.js b/lib/carto/tree/quoted.js
index 3e70d99..134cf7f 100644
--- a/lib/carto/tree/quoted.js
+++ b/lib/carto/tree/quoted.js
@@ -8,7 +8,7 @@ tree.Quoted.prototype = {
is: 'string',
toString: function(quotes) {
- var xmlvalue = this.value.replace(/\'/g, ''');
+ var xmlvalue = this.value.replace(/\'/g, "\\'");
return (quotes === true) ? "'" + xmlvalue + "'" : this.value;
},
But this would likely need to be modified to account for the user manually escaping.
Can you check if this case is fixed by https://github.com/mapbox/carto/issues/263 ?
Failed to parse expression: "([commonname] = 'Bird's-foot trefoil')" in style 'CCSWCD_Weed_Points' in Style at line 278
Using tillmill connect's style editor it creates CartoCSS that is not parse-able when copied into tilemill directly. example above. if i put a backslash in front of the tickmark (') it doesn't error out.