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; if (null == PageParameters || !PageParameters.TryGetValue("tags", out tagsInput)) { tagsInput = 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); }
protected virtual string GetContentsOfFile(string tags) { // Preprocess file content FileInfo docFile = new FileInfo(this.FullPath); TagProcessor tagProcessor = new TagProcessor(tags, Parent.SourceFolderPath); return(tagProcessor.Preprocess(docFile)); }
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); }
protected virtual string GetContentsOfFile(string tags) { // Preprocess file content FileInfo docFile = new FileInfo(this.FullPath); TagProcessor tagProcessor = new TagProcessor(tags, Parent.SourceFolderPath); return tagProcessor.Preprocess(docFile); }