Skip to content
Browse files

preserve tags that evaluate to 0

  • Loading branch information...
1 parent 6661a29 commit 172fe5a0023de1c55205b316f74198cd96a9f6e3 @amccollum committed Oct 6, 2011
Showing with 9 additions and 3 deletions.
  1. +1 −1 lib/wings.js
  2. +1 −1 package.json
  3. +6 −0 src/test/wings-test.coffee
  4. +1 −1 src/wings/wings.coffee
View
2 lib/wings.js
@@ -17,7 +17,7 @@
return Object.prototype.toString.call(o) === '[object Array]';
});
escapeXML = function(s) {
- return (s || '').toString().replace(/&(?!\w+;)|["<>]/g, function(s) {
+ return s.toString().replace(/&(?!\w+;)|["<>]/g, function(s) {
switch (s) {
case '&':
return '&amp';
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "wings",
- "version": "0.5.4",
+ "version": "0.5.5",
"description": "Templating library that works on the server and client closely modeled on Mustache",
"keywords": ["ender", "template", "mustache", "html"],
"author": "Andrew McCollum <amccollum@gmail.com>",
View
6 src/test/wings-test.coffee
@@ -77,6 +77,12 @@ vows.add 'templates'
'should produce html': (topic) ->
equal topic, 'This should produce html: <b>bolded</b>'
+ 'a template with tags having the value 0':
+ topic: t('This is a zero: {zero}', {zero: 0})
+
+ 'should preserve the zero': (topic) ->
+ equal topic, 'This is a zero: 0'
+
'links:':
'a template with a normal link':
View
2 src/wings/wings.coffee
@@ -14,7 +14,7 @@
isArray = Array.isArray ? ((o) -> Object.prototype.toString.call(o) == '[object Array]')
escapeXML = (s) ->
- return (s or '').toString().replace /&(?!\w+;)|["<>]/g, (s) ->
+ return s.toString().replace /&(?!\w+;)|["<>]/g, (s) ->
switch s
when '&' then return '&amp'
when '"' then return '\"'

0 comments on commit 172fe5a

Please sign in to comment.
Something went wrong with that request. Please try again.