Handlebars.Net
Handlebars.Net copied to clipboard
Can't Reference Capitalized Hashtable Elements
Attempting to reference a Hashtable element with a key containing an uppercase letter will fail. Dictionaries however work fine.
Example:
using System.Collections;
using HandlebarsDotNet;
const string template = @"Hello {{ NAME }}, have a nice day.";
var compiledTemplate = Handlebars.Compile(template);
var notWorkingOutput = compiledTemplate(new Hashtable
{
{ "NAME", "bob" }
});
var workingOutput = compiledTemplate(new Dictionary<string,string>()
{
{ "NAME", "alice" }
});
Console.WriteLine(workingOutput);
Console.WriteLine(notWorkingOutput);
What happens with a HashTable element with a lowercase key?
If you use a lowercase key in the Hashtable you can reference it with any casing from the template.