mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-05 14:25:17 -04:00
OPDS Enhancements, Epub fixes, and a lot more (#4035)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com> Co-authored-by: Robbie Davis <robbie@therobbiedavis.com> Co-authored-by: Fabian Pammer <fpammer@mantro.net> Co-authored-by: Vinícius Licz <vinilicz@gmail.com>
This commit is contained in:
@@ -43,11 +43,13 @@ public static partial class AnnotationHelper
|
||||
var originalText = elem.InnerText;
|
||||
|
||||
// Calculate positions and sort by start position
|
||||
var normalizedOriginalText = NormalizeWhitespace(originalText);
|
||||
|
||||
var sortedAnnotations = elementAnnotations
|
||||
.Select(a => new
|
||||
{
|
||||
Annotation = a,
|
||||
StartPos = originalText.IndexOf(a.SelectedText, StringComparison.Ordinal)
|
||||
StartPos = normalizedOriginalText.IndexOf(NormalizeWhitespace(a.SelectedText), StringComparison.Ordinal)
|
||||
})
|
||||
.Where(a => a.StartPos >= 0)
|
||||
.OrderBy(a => a.StartPos)
|
||||
@@ -79,9 +81,10 @@ public static partial class AnnotationHelper
|
||||
elem.AppendChild(HtmlNode.CreateNode(originalText.Substring(currentPos)));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
/* Swallow */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user