/// <summary>
        /// Create a <see cref="TemplateGroupString"/> from a template definition string.
        /// </summary>
        /// <param name="context">The error listener attached to the currently running cmdlet.</param>
        /// <param name="templateDefinition">The template source to use.</param>
        /// <returns>The defined template.</returns>
        internal static TemplateGroupInfo CreateFromTemplateDefinition(
            Cmdlet context,
            string templateDefinition)
        {
            var group = new TemplateGroupString(string.Empty);

            Bind(group, context);
            group.DefineTemplate(Strings.DefaultTemplateName, templateDefinition);
            group.GetInstanceOf(Strings.DefaultTemplateName).impl.HasFormalArgs = false;
            return(new TemplateGroupInfo(group));
        }
        public string Parse(string templateKey, IDictionary <string, object> model)
        {
            var group = new TemplateGroupString("group", "delimiters \"$\", \"$\"\r\nt(x) ::= \" $ x $ \"");

            var renderer = new AdvancedRenderer();

            group.RegisterRenderer(typeof(DateTimeOffset), renderer);
            group.RegisterRenderer(typeof(DateTime), renderer);
            group.RegisterRenderer(typeof(double), renderer);
            group.RegisterRenderer(typeof(decimal), renderer);

            var templateContent = _templateProvider.GetContentsFor(templateKey, model);

            group.DefineTemplate("template", templateContent, new[] { "Model" });

            var stringTemplate = group.GetInstanceOf("template");

            stringTemplate.Add("Model", model);

            return(stringTemplate.Render());
        }