private string RenderContentForExtension(string path, string content, string extension, DocumentFile document, string documentContent, LayoutFile layout) { var data = new CaseInsensitiveExpando(); data["Site"] = this.Site.GetAsDynamic(); data["Document"] = document.GetAsDynamic(documentContent); data["Layout"] = layout == null ? null : layout.GetAsDynamic(); data["Books"] = this.Site.Books == null ? null : this.Site.Books.Select(b => b.GetAsDynamic(document)).ToList(); var engine = this.Engines[extension]; return(engine.Render(path, content, data)); }