using System.Collections.Generic;
public static void Main()
RunTemplate("With OptIn:", false);
RunTemplate("Without OptIn:", true);
private static void RunTemplate(string message, bool includeOptIn)
Console.WriteLine(message);
var templateData = new Dictionary<string,object>();
templateData["location"] = new Dictionary<string,object>(){
{ "computed_name" , "<LOCATION NAME>"}
templateData["waitlist"] = new Dictionary<string,object>(){
{ "start_date", DateTime.Now},
{ "start_time", DateTime.Now},
templateData["consumer"] = new Dictionary<string,object>(){
{ "include_opt_out_text", "true" }
var compiler = new FormatCompiler();
Generator generator = compiler.Compile(Template2);
generator.KeyNotFound += (sender, args) =>
string result = generator.Render(templateData);
Console.WriteLine(result);
Console.WriteLine("--------");
private const string Template = "A spot for {{waitlist.class_name}} at {{waitlist.start_time:t}} on {{waitlist.class_date:d}} at {{location.computed_name}} may be available. Reply 1 to claim.{{#if consumer.include_opt_out_text}}{{#newline}}Text \"STOP\" to opt out. Message and data rates may apply.{{/if}}";
private const string Template2 ="Uma vaga para {{waitlist.class_name}} à HORA DA AULA em {{waitlist.start_time:t}} {{waitlist.class_date:d}} em {{location.computed_name}} pode estar disponível. Responda 1 para se inscrever.{{#if consumer.include_opt_out_text}}{{#newline}}Envia uma mensagem de texto com \"STOP\" para não receberes mensagens de texto. Podem ser aplicáveis taxas de mensagens e dados.{{/if}}";