public async Task SaveOutputAsync(InputDocument inputDoc, InputChapter chapter, string output) { var fileName = Path.GetFileNameWithoutExtension(inputDoc.FilePath); var path = Path.Combine(Path.GetDirectoryName(inputDoc.FilePath), $"{fileName}_chapter{chapter.ChapterNo}_output.html"); await File.WriteAllTextAsync(path, output); }
public void Formatting_links() { // Arrange var chapter = new InputChapter { Content = "test |url|title| test" }; // Act var output = _formatter.FormatPost(chapter, new List <PhotoInfo>(), false); // Verify Assert.Equal("test <http://url-title> test", output); }
public void Formatting_of_plain_text() { // Arrange var chapter = new InputChapter { Content = "test" }; // Act var output = _formatter.FormatPost(chapter, new List <PhotoInfo>(), false); // Verify Assert.Equal("test", output); }
public void Formatting_strikeouts() { // Arrange var chapter = new InputChapter { Content = "test -strickedout- test" }; // Act var output = _formatter.FormatPost(chapter, new List <PhotoInfo>(), false); // Verify Assert.Equal("test =strickedout= test", output); }
public void Formatting_blockquotes() { // Arrange var chapter = new InputChapter { Content = @"test { blockquote } test" }; // Act var output = _formatter.FormatPost(chapter, new List <PhotoInfo>(), false); // Verify Assert.Equal(@"test@ blockquote@test", output); }
public string FormatPost(InputChapter chapter, IEnumerable <PhotoInfo> photos, bool simulateLjLayout) { var content = chapter.Content; content = FormatPhotoPlaceholders(content, photos); content = FormatHyperlinks(content); content = FormatStrikeOuts(content); content = FormatBlockquotes(content); content = WrapContentWithBetterFont(content); content = InjectLjCutToPost(content); if (simulateLjLayout) { content = WrapWithLjLayout(chapter, content); } return(content); }
public void Formatting_floating_right_photo() { // Arrange var chapter = new InputChapter { Content = "test\n>>[photo1]>>\n\ntest" }; var photos = new List <PhotoInfo> { new PhotoInfo { Title = "photo1", Width = 100, Height = 120, WebUrl = "web-url", Small320Url = "small-url" } }; // Act var output = _formatter.FormatPost(chapter, photos, false); // Verify Assert.Equal("test\nfr[<web-url/small-url/120/100>]test", output); }
public void PrintSelectedChapter(InputChapter chapter) { WritePropertyLine("Chapter selected: ", chapter.Title); }