Adds support for multiple chapters. The previous version ignored any leading chapter numbers in the uri of {chapterId}/images/{image}. It now accounts for that and is working in a locally run user interface for an epub that was broken. I didn't check in the unit test over the GetBookPage method since it requires a specific file. I'll provide that in the PR description, though.

This commit is contained in:
Michael DiLeo 2025-05-13 11:28:39 -05:00
parent 8ed2fa3829
commit 4ca4723ae9
4 changed files with 134 additions and 13 deletions

View file

@ -16,5 +16,23 @@ public class PathExtensionsTests
Assert.Equal(Path.GetFullPath(expected), input.GetFullPathWithoutExtension());
}
[Theory]
[InlineData("1/cover.jpeg", "1")]
[InlineData("01/cover.jpeg", "01")]
[InlineData("01/images/cover.jpeg", "01")]
public void GetFirstSegmentSpanTests(string input, string expected)
{
Assert.Equal(expected, input.GetFirstSegmentSpan().ToString());
}
[Theory]
[InlineData("1/cover.jpeg")]
[InlineData("01/cover.jpeg")]
[InlineData("01/images/cover.jpeg")]
public void GetLastSegmentSpanTests(string input)
{
Assert.Equal("cover.jpeg", input.GetLastSegmentSpan().ToString());
}
#endregion
}