-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot interpolate columns with "." in name #303
Comments
I think we might need to get rid of Mustache as escaping also won't work. In addition other template languages also won't support it as We can use handlebars, but for it you need to explicitly enclose the column-name in quotes if it has a dot or any special character that conflicts with handlebars syntax. // Change this object to change your values
var obj = {
ID: "Alice's Adventures in Wonderland \t what is this",
"this.is": "some name"
};
var handlebars = require("handlebars");
console.log(handlebars.compile('{{ID}} - {{"this.is"}}')(obj)); We can switch back to the old string replacement. Which I am sure supports it, but it won't have the encode and other escaping stuff. |
#escape has been used in real deployments.. So we need to be careful about
turning off features.
…On Wed, Dec 14, 2016 at 5:16 PM, Chirag Sanghvi ***@***.***> wrote:
I think we might need to get rid of Mustache as escaping also won't work.
In addition other template languages also won't support it as . in
javascript is a property of an object.
We can use handlebars, but for it you need to explicitly enclose the
column-name in quotes.
// Change this object to change your valuesvar obj = {
ID: "Alice's Adventures in Wonderland \t what is this",
"this.is": "some name"
};console.log(mustache.render('{{ID}} - {{"this.is"}}', obj));
var handlebars = require("handlebars");console.log(handlebars.compile('{{ID}} - {{"this.is"}}')(obj));
We can switch back to the old string replacement. Which I am sure supports
it, but it won't have the encode and other escaping stuff.
https://runkit.com/chiragsanghvi/57b4b5f94c7bbd13004b43f6
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZUDD6iqY4aFiXIDt4pGBcdreeKZMRGks5rIJT4gaJpZM4LNksV>
.[image: Web Bug from
https://github.com/notifications/beacon/AAZUDDgwM3LD7IKw78doB6LdRkJSYNcOks5rIJT4gaJpZM4LNksV.gif]
{"api_version":"1.0","publisher":{"api_key":"
05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":
{"external_key":"github/informatics-isi-edu/ermrestjs"
,"title":"informatics-isi-edu/ermrestjs","subtitle":"GitHub
repository","main_image_url":"https://cloud.githubusercontent.com/assets/
143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","
avatar_image_url":"https://cloud.githubusercontent.com/
assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png
","action":{"name":"Open in GitHub","url":"https://github.
com/informatics-isi-edu/ermrestjs"}},"updates":{"
***@***.*** in #303: I think we
might need to get rid of Mustache as escaping also won't work. In addition
other template languages also won't support it as `.` in javascript is a
property of an object. \r\n\r\nWe can use handlebars, but for it you need
to explicitly enclose the column-name in quotes. \r\n\r\n```js\r\n// Change
this object to change your values\r\nvar obj = {\r\n ID: \"Alice's
Adventures in Wonderland \\t what is this\",\r\n \"this.is\": \"some
name\"\r\n};\r\nconsole.log(mustache.render('{{ID}} - {{\"this.is\"}}',
obj));\r\n\r\nvar handlebars = require(\"handlebars\");\r\
nconsole.log(handlebars.compile('{{ID}} - {{\"this.is\"}}')(obj));\r\n```\r\n\r\nWe
can switch back to the old string replacement. Which I am sure supports it,
but it won't have the encode and other escaping stuff.\r\n\r\n\r\nhttps://
runkit.com/chiragsanghvi/57b4b5f94c7bbd13004b43f6"}],"action":{"name":"View
Issue","url":"#303#
issuecomment-267208163"}}}
|
@karlcz can you please describe the workaround here.. |
@hongsudt it's the second option I described in the original issue. Mangle column names when producing the environment object passed to the mustache interpreter, i.e. replace Then, the DBA can mangle the names the same way in order to be able to use guards or interpolation based on that column. Don't worry about collisions. If a DBA uses column names that differ only in |
I need to be able to interpolate all columns even if they have names that mustache does not like, e.g. with a
.
character (or any other that mustache might disallow).The text was updated successfully, but these errors were encountered: