template variables with spaces are not replaced correctly fixed #129
This commit is contained in:
parent
ab7d603171
commit
78f69d5236
4
NEWS.md
4
NEWS.md
@ -12,6 +12,10 @@ Enhancements:
|
||||
|
||||
* Allow specifying fixed sqlapi host address (#117)
|
||||
|
||||
Bug fixes:
|
||||
* Template variables with spaces are not replaced correctly (#129)
|
||||
|
||||
|
||||
1.6.3 -- 2014-01-30
|
||||
-------------------
|
||||
|
||||
|
@ -534,7 +534,7 @@ o._replaceVars = function(str, params) {
|
||||
if ( ! params._re ) {
|
||||
params._re = {};
|
||||
for (var k in params) {
|
||||
params._re[k] = RegExp("<%= " + k + " %>", "g");
|
||||
params._re[k] = RegExp("<%=\\s*" + k + "\\s*%>", "g");
|
||||
}
|
||||
}
|
||||
for (var k in params) str = str.replace(params._re[k], params[k]);
|
||||
|
@ -343,11 +343,11 @@ suite('template_maps', function() {
|
||||
global_cartocss_version: '2.0.2',
|
||||
layers: [
|
||||
{ options: {
|
||||
sql: "select '<%= name %>' || id, g from t",
|
||||
sql: "select '<%=name %>' || id, g from t",
|
||||
cartocss: '#layer { marker-fill:<%= fill %>; }'
|
||||
} },
|
||||
{ options: {
|
||||
sql: "select fun('<%= name %>') g from x",
|
||||
sql: "select fun('<%= name%>') g from x",
|
||||
cartocss: '#layer { line-color:<%= color %>; marker-fill:<%= color %>; }'
|
||||
} },
|
||||
{ options: {
|
||||
|
Loading…
Reference in New Issue
Block a user