Handlebars-Net/Handlebars.Net

Can't Reference Capitalized Hashtable Elements

AceCoderLaura opened this issue · 2 comments

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);
rexm commented

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.