From 142be2a21274edd310de92949d2e5f9ad04a0f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Sat, 23 Jan 2016 10:51:55 +0100 Subject: [PATCH] Fix #293 Smelly code, but I don't have time to refactor Pretzel entirely for now. --- src/Pretzel.Logic/Templating/Razor/RazorSiteEngine.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Pretzel.Logic/Templating/Razor/RazorSiteEngine.cs b/src/Pretzel.Logic/Templating/Razor/RazorSiteEngine.cs index cc4110ed0..1fe8b1cc9 100644 --- a/src/Pretzel.Logic/Templating/Razor/RazorSiteEngine.cs +++ b/src/Pretzel.Logic/Templating/Razor/RazorSiteEngine.cs @@ -35,7 +35,7 @@ protected override void PreProcess() { _allTags.AddRange(Tags); } - + if (TagFactories != null) { _allTags.AddRange(TagFactories.Select(factory => @@ -66,9 +66,14 @@ protected override string RenderTemplate(string content, PageContext pageData) content = Regex.Replace(content, "

(@model .*?)

", "$1"); + var pageContent = pageData.Content; + pageData.Content = pageData.FullContent; + try { - return Engine.Razor.RunCompile(content, pageData.Page.File, typeof(PageContext), pageData); + content = Engine.Razor.RunCompile(content, pageData.Page.File, typeof(PageContext), pageData); + pageData.Content = pageContent; + return content; } catch (Exception e) {