void WriteAllArticlesPage(string writePath, TagCollection tags, string baseUrl) { var allArticles = generator.GenerateAllArticlesPage(tags.SelectMany(x => x.Value).ToList(), baseUrl); var html = markdownToHtml.Execute(allArticles, "All articles on Quality and Readability", baseUrl); filesystemRepository.WriteFile(Path.Combine(writePath, "AllArticles.md"), html); }
public IEnumerable <DocumentInfo> Execute( Configuration rootFilePath, TagCollection tags, string baseUrl, string editBaseUrl, List <FileInfo> files, ContentGenerator contentGenerator) { var top4Files = GetTop4NewestFiles(rootFilePath, files); var articleCount = tags.SelectMany(x => x.Value).Distinct().Count(); foreach (var path in files) { var fileContent = filesystemRepository.ReadAllText(path.FullName); if (DocumentParser.IsDraftFile(fileContent)) { continue; } var relativePath = path.FullName.Substring(rootFilePath.ReadBasePath.Length).Replace('\\', '/'); var editUrl = editBaseUrl + relativePath; fileContent = MutateTopXArticles(fileContent, top4Files, baseUrl); fileContent = MutateArticleHeaderUrlsTag(fileContent); fileContent = MutateSocialLinks(fileContent, baseUrl, relativePath); fileContent = MutateCommentText(fileContent, editUrl); fileContent = MutateCategoryTags(fileContent, baseUrl, contentGenerator); fileContent = MutateAllTagsLine(fileContent, tags, baseUrl, contentGenerator); fileContent = MutateBaseUrlTag(fileContent, baseUrl); fileContent = MutateGithubPageUrlTag(fileContent, editUrl); fileContent = MutateTagArticleCount(fileContent, articleCount); var title = DocumentParser.GetParsePageTitle(fileContent); yield return (new DocumentInfo { Content = fileContent, Path = Path.Combine(rootFilePath.WritePath, relativePath), Title = title }); } }