using Core.Exceptions; using Core.Templates; using Mustache; namespace Generator.Infrastructure.TemplateFiller; public class MustacheFiller : AbstractFiller { public MustacheFiller(ITemplate template) { Template = template; } /// public override void Fill() { var compiler = new FormatCompiler { RemoveNewLines = false }; var generator = compiler.Compile(Template?.GetText()); Render = generator.Render(Template?.GetData()); } /// public override void Write(string outputPath) { if (Render == null) throw new FillerException( "Filler Exception : No text can be written. Have you forgot to call the Fill method ?"); using StreamWriter file = new StreamWriter(outputPath); file.Write(Render); } }