本文整理匯總了C#中ServiceStack.WebHost.Endpoints.Support.Markdown.MarkdownPage.Compile方法的典型用法代碼示例。如果您正苦於以下問題:C# MarkdownPage.Compile方法的具體用法?C# MarkdownPage.Compile怎麽用?C# MarkdownPage.Compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ServiceStack.WebHost.Endpoints.Support.Markdown.MarkdownPage
的用法示例。
在下文中一共展示了MarkdownPage.Compile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Does_handle_foreach_when_enumerable_is_empty_first_time
public void Does_handle_foreach_when_enumerable_is_empty_first_time()
{
var content = (string)dynamicListPageContent.Clone();
var markdownPage = new MarkdownPage(new MarkdownFormat(), dynamicListPagePath, "", content);
markdownPage.Compile();
var model = new Person { Links = new List<Link>() };
var scopeArgs = new Dictionary<string, object> { { "Model", model } };
markdownPage.RenderToHtml(scopeArgs); // First time the list is empty
var expected = "A new list item";
model.Links.Add(new Link { Name = expected } );
var html = markdownPage.RenderToHtml(scopeArgs); // Second time the list has 1 item
Console.WriteLine(html);
Assert.That(html, Contains.Substring(expected));
}
示例2: AddPage
public void AddPage(MarkdownPage page)
{
try
{
page.Compile();
AddViewPage(page);
}
catch (Exception ex)
{
Log.Error("AddViewPage() page.Prepare(): " + ex.Message, ex);
}
try
{
var templatePath = page.Template;
if (page.Template == null) return;
if (MasterPageTemplates.ContainsKey(templatePath)) return;
var templateFile = VirtualPathProvider.GetFile(templatePath);
var templateContents = GetPageContents(templateFile);
AddTemplate(templatePath, templateContents);
}
catch (Exception ex)
{
Log.Error("Error compiling template " + page.Template + ": " + ex.Message, ex);
}
}
示例3: AddPage
public void AddPage(MarkdownPage page)
{
try
{
Log.InfoFormat("Compiling {0}...", page.FilePath);
page.Compile();
AddViewPage(page);
}
catch (Exception ex)
{
Log.Error("AddViewPage() page.Prepare(): " + ex.Message, ex);
}
try
{
var templatePath = page.Template;
if (page.Template == null) return;
if (MasterPageTemplates.ContainsKey(templatePath)) return;
//AddTemplate(templatePath, File.ReadAllText(templatePath));
var templateFile = VirtualPathProvider.GetFile(templatePath);
var templateContents = templateFile.ReadAllText();
AddTemplate(templatePath, templateContents);
}
catch (Exception ex)
{
Log.Error("Error compiling template " + page.Template + ": " + ex.Message, ex);
}
}