public RazorRenderer(MarkdownTransformer markdownTransformer, Logger logger) { this.markdownTransformer = markdownTransformer; this.logger = logger; this.compiler = new RazorCompiler(); this.compiler.NamespaceImports.Add("System.Linq"); this.compiler.NamespaceImports.Add("Gatsby"); this.includes = new Dictionary<string, Include>(); this.layouts = new Dictionary<string, Layout>(); }
internal override void Run( Config config, MarkdownTransformer markdownTransformer, string relativePath, RazorRenderer razorRenderer, Site site) { base.Run(config, markdownTransformer, relativePath, razorRenderer, site); if (!string.IsNullOrEmpty(config.ExcerptSeparator)) { if (this.Content.Contains(config.ExcerptSeparator)) { this.Excerpt = this.Content.Substring(0, this.Content.IndexOf(config.ExcerptSeparator)); } else { this.Excerpt = this.Content; } } }
internal virtual void Run( Config config, MarkdownTransformer markdownTransformer, string relativePath, RazorRenderer razorRenderer, Site site) { if (this.Content != null) throw new InvalidOperationException("Template has already been run."); this.RelativePath = relativePath; this.InitGatsbyRazorTemplate(razorRenderer, site); try { this.Content = this.ExecuteTemplate(); } catch (Exception ex) { } if (this.IsMarkdown) this.Content = markdownTransformer.Transform(this.Content); }