XML-escape quotes in quoted values.
This commit is contained in:
parent
a7748e6392
commit
afad11d3fe
@ -7,9 +7,10 @@ tree.Quoted = function Quoted(str, content) {
|
||||
};
|
||||
tree.Quoted.prototype = {
|
||||
toString: function(quotes) {
|
||||
return (quotes === true) ? "'" + this.value + "'" : this.value;
|
||||
var xmlvalue = this.value.replace(/\'/g, ''');
|
||||
return (quotes === true) ? "'" + xmlvalue + "'" : this.value;
|
||||
},
|
||||
eval: function() {
|
||||
'eval': function() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ tree.Rule = function Rule(name, value, index, filename) {
|
||||
|
||||
tree.Rule.prototype.clone = function() {
|
||||
var clone = Object.create(tree.Rule.prototype);
|
||||
clone.name = this.name
|
||||
clone.name = this.name;
|
||||
clone.value = this.value;
|
||||
clone.index = this.index;
|
||||
clone.instance = this.instance;
|
||||
@ -53,7 +53,7 @@ tree.Rule.prototype.toXML = function(env, content) {
|
||||
', a valid ' +
|
||||
(tree.Reference.selector(this.name).validate ||
|
||||
tree.Reference.selector(this.name).type) +
|
||||
' is expected. ' + this.value +
|
||||
' is expected. ' + this.value +
|
||||
' was given.',
|
||||
index: this.index,
|
||||
type: 'syntax',
|
||||
@ -79,9 +79,9 @@ tree.Rule.prototype.toXML = function(env, content) {
|
||||
/**
|
||||
* TODO: Rule eval chain should add fontsets to env.frames
|
||||
*/
|
||||
tree.Rule.prototype.eval = function(context) {
|
||||
tree.Rule.prototype['eval'] = function(context) {
|
||||
return new tree.Rule(this.name,
|
||||
this.value.eval(context),
|
||||
this.value['eval'](context),
|
||||
this.index,
|
||||
this.filename);
|
||||
};
|
||||
@ -95,7 +95,7 @@ tree.Shorthand.prototype = {
|
||||
toString: function(env) {
|
||||
return this.a.toString(env) + '/' + this.b.toString(env);
|
||||
},
|
||||
eval: function() { return this }
|
||||
'eval': function() { return this; }
|
||||
};
|
||||
|
||||
})(require('../tree'));
|
||||
|
15
test/rendering/filterquote.mml
Normal file
15
test/rendering/filterquote.mml
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Stylesheet": [
|
||||
"filterquote.mss"
|
||||
],
|
||||
"Layer": [{
|
||||
"name": "world",
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Datasource": {
|
||||
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||
"type": "shape"
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
3
test/rendering/filterquote.mss
Normal file
3
test/rendering/filterquote.mss
Normal file
@ -0,0 +1,3 @@
|
||||
#world[name2=" Sa'ad"] {
|
||||
polygon-fill:#fff;
|
||||
}
|
21
test/rendering/filterquote.result
Normal file
21
test/rendering/filterquote.result
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE Map[]>
|
||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
|
||||
|
||||
<Style name="world" filter-mode="first">
|
||||
<Rule>
|
||||
<Filter>([name2] = ' Sa'ad')</Filter>
|
||||
<PolygonSymbolizer fill="#ffffff" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="world"
|
||||
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
<StyleName>world</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
</Map>
|
Loading…
Reference in New Issue
Block a user