Update Tokenizer.cs

This commit is contained in:
jtkech
2015-12-17 00:23:12 +01:00
parent 765f8f74a5
commit 36c5f1070f

View File

@@ -53,7 +53,9 @@ namespace Orchard.Tokens.Implementation {
var replacements = Evaluate(options.Predicate == null ? tokens : tokens.Where(options.Predicate), data);
return replacements.Aggregate(tokenset.Item1,
(current, replacement) => current.Replace((hashMode ? "#{" : "{") + replacement.Key + "}", (options.Encoding ?? ReplaceOptions.NoEncode)(replacement.Key, replacement.Value)));
(current, replacement) => replacement.Value == null ?
current : current.Replace((hashMode ? "#{" : "{") + replacement.Key + "}",
(options.Encoding ?? ReplaceOptions.NoEncode)(replacement.Key, replacement.Value)));
}
private static Tuple<string, IEnumerable<string>> Parse(string text, bool hashMode) {
@@ -111,4 +113,4 @@ namespace Orchard.Tokens.Implementation {
}
}
}
}