j***@public.gmane.org
2012-01-13 21:34:48 UTC
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 68 by bharbu...-***@public.gmane.org: HTML formatter doesn't work for
numeric values
http://code.google.com/p/json-template/issues/detail?id=68
What steps will reproduce the problem?
1. Put a JSON numeric value in the variables to use.
2. Use the {{{'html'}}} formatter.
What is the expected output? What do you see instead?
This will produce a {{{TypeError}}} exception, since it tries to call
{{{replace}}} on the value. Turning the number into a string would be more
meaningful.
What version of the product are you using? On what operating system?
The latest at this time:
http://code.google.com/p/json-template/source/browse/javascript/json-template.js?r=baeee0fc6efadd5b02d3b967ffccefb4e3e92219
Please provide any additional information below.
There is an example here: http://jsfiddle.net/vUhG5/
The following fails:
{{{
var testData = {
var_a: '10001',
var_b: 10002
};
var t = jsontemplate.fromString('var_a={var_a} and var_b={var_b}', {
default_formatter: 'html' });
var txt = t.expand(testData);
}}}
The error is within function {{{HtmlEscape}}}, at line 55: {{{var_b}}} is
not a string and doesn't have a {{{replace}}} method.
Doing {{{s.toString().replace(...)....}}} instead of {{{s.replace(...)}}}
should fix the problem.
The same issue applies to {{{HtmlTagEscape}}} just below, of course.
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 68 by bharbu...-***@public.gmane.org: HTML formatter doesn't work for
numeric values
http://code.google.com/p/json-template/issues/detail?id=68
What steps will reproduce the problem?
1. Put a JSON numeric value in the variables to use.
2. Use the {{{'html'}}} formatter.
What is the expected output? What do you see instead?
This will produce a {{{TypeError}}} exception, since it tries to call
{{{replace}}} on the value. Turning the number into a string would be more
meaningful.
What version of the product are you using? On what operating system?
The latest at this time:
http://code.google.com/p/json-template/source/browse/javascript/json-template.js?r=baeee0fc6efadd5b02d3b967ffccefb4e3e92219
Please provide any additional information below.
There is an example here: http://jsfiddle.net/vUhG5/
The following fails:
{{{
var testData = {
var_a: '10001',
var_b: 10002
};
var t = jsontemplate.fromString('var_a={var_a} and var_b={var_b}', {
default_formatter: 'html' });
var txt = t.expand(testData);
}}}
The error is within function {{{HtmlEscape}}}, at line 55: {{{var_b}}} is
not a string and doesn't have a {{{replace}}} method.
Doing {{{s.toString().replace(...)....}}} instead of {{{s.replace(...)}}}
should fix the problem.
The same issue applies to {{{HtmlTagEscape}}} just below, of course.
--
You received this message because you are subscribed to the Google Groups "JSON Template" group.
To post to this group, send email to json-template-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to json-template+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/json-template?hl=en.
You received this message because you are subscribed to the Google Groups "JSON Template" group.
To post to this group, send email to json-template-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to json-template+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/json-template?hl=en.