diff --git a/internal/sync/locators.go b/internal/sync/locators.go index 28acdda..c371226 100644 --- a/internal/sync/locators.go +++ b/internal/sync/locators.go @@ -58,6 +58,13 @@ func cachedConverter(epubPath string) *CFIConverter { return c } +// SectionPercentageCached resolves the spine-section percentage of a CRE +// xpointer through the shared bounded converter cache, so per-annotation +// lookups parse the EPUB once per book instead of once per annotation. +func SectionPercentageCached(epubPath, xpointer string) float64 { + return cachedConverter(epubPath).SectionPercentage(xpointer) +} + func ConvertToCanonical( source LocatorSource, devicePos string,