/// <summary> /// Transforms this template into a final string representation, having merged in any /// values to be replaced within the template text. /// </summary> /// <param name="values">The values that are to be merged into the template.</param> /// <returns>A final representation of the template, with the values having been injected.</returns> public override string Merge(TemplateValues values) { var engine = CreateEngine(); var context = CreateContext(values); return(this.Evaluate(context, engine)); }
private static VelocityContext CreateContext(TemplateValues values) { var context = new VelocityContext(); foreach (var item in values) { context.Put(item.Key, item.Value); } return(context); }