Tags altered to allow string number values

This commit is contained in:
Paul Grimshaw 2014-02-04 13:52:20 +00:00
parent ded9ac56aa
commit a16262d43e
5 changed files with 17 additions and 9 deletions

View File

@ -58,7 +58,7 @@ namespace Mustache {
}
if ((condition is double || condition is int) && (targetValue is double || targetValue is int) ) {
if ((condition is double || condition is int) || (targetValue is double || targetValue is int) ) {
return Convert.ToDouble(condition) == Convert.ToDouble(targetValue);
}

View File

@ -55,12 +55,12 @@ namespace Mustache {
return false;
}
if ((condition is double || condition is int) && (targetValue is double || targetValue is int)) {
try {
return Convert.ToDouble(condition) > Convert.ToDouble(targetValue);
} catch (Exception exception) {
return false;
}
return false;
}
/// <summary>

View File

@ -55,11 +55,14 @@ namespace Mustache {
return false;
}
if ((condition is double || condition is int) && (targetValue is double || targetValue is int)) {
try {
return Convert.ToDouble(condition) >= Convert.ToDouble(targetValue);
} catch (Exception exception) {
return false;
}
return false;
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace Mustache {
@ -55,12 +56,14 @@ namespace Mustache {
return false;
}
if ((condition is double || condition is int) && (targetValue is double || targetValue is int)) {
try {
return Convert.ToDouble(condition) < Convert.ToDouble(targetValue);
}
catch (Exception exception) {
return false;
}
return false;
}
/// <summary>

View File

@ -55,10 +55,12 @@ namespace Mustache {
return false;
}
if ((condition is double || condition is int) && (targetValue is double || targetValue is int)) {
try {
return Convert.ToDouble(condition) <= Convert.ToDouble(targetValue);
} catch (Exception exception) {
return false;
}
return false;
}