protected override async Task PublishFileToDestinationAsync(FileInfo sourceFile, DirectoryInfo destinationRoot, DocFile page, IssueLogger issues) { this.LogMessage(new ValidationMessage(sourceFile.Name, "Publishing file to HTML")); var destinationPath = this.GetPublishedFilePath(sourceFile, destinationRoot, HtmlOutputExtension); // Create a tag processor string tagsInput; if (null == PageParameters || !PageParameters.TryGetValue("tags", out tagsInput)) { tagsInput = string.Empty; } var markdownSource = page.ReadAndPreprocessFileContents(tagsInput, issues); var converter = this.GetMarkdownConverter(); var html = converter.Transform(markdownSource); // Post-process the resulting HTML for any remaining tags TagProcessor tagProcessor = new TagProcessor(tagsInput, page.Parent.SourceFolderPath, LogMessage); html = tagProcessor.PostProcess(html, sourceFile, converter); var pageData = page.Annotation ?? new PageAnnotation(); if (string.IsNullOrEmpty(pageData.Title)) { pageData.Title = (from b in page.OriginalMarkdownBlocks where b.BlockType == BlockType.h1 select b.Content).FirstOrDefault(); } page.Annotation = pageData; await this.WriteHtmlDocumentAsync(html, page, destinationPath, destinationRoot.FullName); }
protected override async Task PublishFileToDestinationAsync(FileInfo sourceFile, DirectoryInfo destinationRoot, DocFile page) { this.LogMessage(new ValidationMessage(sourceFile.Name, "Publishing file to HTML")); var destinationPath = this.GetPublishedFilePath(sourceFile, destinationRoot, HtmlOutputExtension); // Create a tag processor string tagsInput = PageParameters.ValueForKey<string>("tags", StringComparison.OrdinalIgnoreCase) ?? string.Empty; TagProcessor tagProcessor = new TagProcessor(tagsInput, page.Parent.SourceFolderPath, LogMessage); var converter = this.GetMarkdownConverter(); var html = converter.Transform(tagProcessor.Preprocess(sourceFile)); html = await tagProcessor.PostProcess(html, sourceFile, converter); var pageData = page.Annotation ?? new PageAnnotation(); if (string.IsNullOrEmpty(pageData.Title)) { pageData.Title = (from b in converter.Blocks where b.BlockType == BlockType.h1 select b.Content).FirstOrDefault(); } page.Annotation = pageData; await this.WriteHtmlDocumentAsync(html, page, destinationPath, destinationRoot.FullName); }