Picking up some itsthisjutin ideas
This commit is contained in:
@@ -65,6 +65,22 @@ class ChapterXPathIndexer {
|
||||
*/
|
||||
static bool tryExtractSpineIndexFromXPath(const std::string& xpath, int& outSpineIndex);
|
||||
|
||||
/**
|
||||
* Find the full-ancestry XPath for the Nth direct-body-child <p> element.
|
||||
*
|
||||
* Counts only <p> elements that are direct children of <body>, matching the semantics
|
||||
* of the section paragraph LUT built by ChapterHtmlSlimParser.
|
||||
*
|
||||
* @param epub Loaded EPUB instance
|
||||
* @param spineIndex Spine item index to parse
|
||||
* @param paragraphIndex 1-based paragraph index (from section LUT or XPath p[N])
|
||||
* @param seekHint Optional XHTML byte offset to start scanning from (0 = from beginning).
|
||||
* Pass Section::getXhtmlByteOffsetForPage() to avoid scanning the whole file.
|
||||
* @return Full-ancestry XPath like "/body/DocFragment[N]/body/div[1]/p[3]", or empty on failure
|
||||
*/
|
||||
static std::string findXPathForParagraph(const std::shared_ptr<Epub>& epub, int spineIndex, uint16_t paragraphIndex,
|
||||
uint32_t seekHint = 0, uint16_t startParagraphCount = 0);
|
||||
|
||||
/**
|
||||
* Extract the paragraph index from a KOReader XPath.
|
||||
* Looks for the first /p[N] segment after /body/ and returns N (1-based).
|
||||
|
||||
Reference in New Issue
Block a user