Permit keywords as strings. Fixes #193
This commit is contained in:
parent
4b7fc5fb57
commit
1d9b5d93ca
@ -136,9 +136,17 @@ tree.Reference.validValue = function(env, selector, value) {
|
||||
if (!tree.Reference.selector(selector)) {
|
||||
return false;
|
||||
} else if (value.value[0].is == 'keyword') {
|
||||
if (typeof tree.Reference.selector(selector).type === 'object') {
|
||||
return tree.Reference
|
||||
.selector(selector).type
|
||||
.indexOf(value.value[0].value) !== -1;
|
||||
// Lax permissions for single strings. If you provide a keyword
|
||||
// aka unquoted string to a property that is a string, it'll be fine.
|
||||
} else if (tree.Reference.selector(selector).type === 'string') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (value.value[0].is == 'undefined') {
|
||||
// caught earlier in the chain - ignore here so that
|
||||
// error is not overridden
|
||||
|
14
test/rendering/noquote_font.mml
Normal file
14
test/rendering/noquote_font.mml
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"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": [
|
||||
"noquote_font.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"
|
||||
}
|
||||
}]
|
||||
}
|
4
test/rendering/noquote_font.mss
Normal file
4
test/rendering/noquote_font.mss
Normal file
@ -0,0 +1,4 @@
|
||||
#world {
|
||||
text-name: 'foo';
|
||||
text-face-name: Helvetica;
|
||||
}
|
20
test/rendering/noquote_font.result
Normal file
20
test/rendering/noquote_font.result
Normal file
@ -0,0 +1,20 @@
|
||||
<?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" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||
|
||||
|
||||
<Style name="world" filter-mode="first" >
|
||||
<Rule>
|
||||
<TextSymbolizer face-name="Helvetica" ><![CDATA[foo]]></TextSymbolizer>
|
||||
</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