Пример #1
0
 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);
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
 public void PrintSelectedChapter(InputChapter chapter)
 {
     WritePropertyLine("Chapter selected: ", chapter.Title);
 }