public FinaliseContext( ScaffoldContext scaffoldContext, List <MarkupContext> markupContexts, Dictionary <string, HtmlContext> html ) { ScaffoldContext = scaffoldContext; MarkupContexts = markupContexts; HtmlContexts = html; }
public MarkupContext(ScaffoldContext scaffoldContext, string markdownPath, string markdownContent, string htmlUrl, string htmlContentTemplate) { Markdown = new MarkdownProperties(); Html = new HtmlProperties(); Image = new ImageProperties(); ScaffoldContext = scaffoldContext; Title = ""; Slug = ""; Tags = new List <TagItem>(); PostedDate = DateTime.MinValue; Markdown.Path = markdownPath; Markdown.Content = markdownContent; Html.Url.RelativeUrl = htmlUrl; Html.Path = Path.ChangeExtension(markdownPath, ".html"); Html.Content = htmlContentTemplate; }
public async Task <FinaliseContext> NewFinaliseContextAsync( ScaffoldContext scaffoldContext, List <MarkupContext> markupContexts ) { var htmlContextsTask = Directory.GetFiles ( scaffoldContext.SiteRoot, "*.html", new EnumerationOptions { RecurseSubdirectories = true } ) .Select(path => { Func <string, Task <HtmlContext> > GetHtmlContext = async(string path) => new HtmlContext { Path = path, Url = scaffoldContext.ConvertPathToUrl(path), Content = await File.ReadAllTextAsync(path) }; return(GetHtmlContext(path)); } ) .ToList() ; var htmlContexts = await Task.WhenAll(htmlContextsTask); var htmlContextsDict = htmlContexts.ToDictionary(c => c.Url); return(new FinaliseContext(scaffoldContext, markupContexts, htmlContextsDict)); }
public ContextFactory(Config config) { _config = config; _scaffoldContext = new ScaffoldContextFactory().NewScaffoldContext(config); }