-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readium cfi and epubjs cfi #1358
Comments
Can anyone please help me on this ? |
EPUB CFI is an open standard, it should be implemented identically by Readium, EPUB.js, etc. |
in other words, cross-exchange of EPUB CFI expressions should work out-of-the-box. If you encounter problems then it's likely a bug in either of the CFI implementations you are relying on. |
It seems that the CFI implementation in Epub.js is bugged : #470. Additionally, Epub.js doesn't seem to handle escaping with |
What about this implementation? https://github.com/fread-ink/epub-cfi-resolver |
It seems to have one serious bug, namely fread-ink/epub-cfi-resolver#14, that is, it always has a leading By the way, Calibre also has the exact same issue (or at least the CFI it uses for storing annotations and bookmarks has this bug; I'm not sure if/how it uses CFIs in other places). See johnfactotum/foliate#849. There's also another Calibre bug described in the comments (johnfactotum/foliate#849 (comment)) but I haven't really investigate the cause of that one. |
Good list, Daniel. There's also the old sample prototype implementation from epub-specs: https://github.com/w3c/epub-specs/blob/20140228/src/samples/cfi/epubcfi.js It would a good idea to make a test file containing some common edge cases. But below is my quick assessment based purely on looking at the codebases of each project. ParsingAs noted in epub-cfi-resolver's readme, escaped characters in assertions can trip up parsers that try to match
GeneratingI couldn't find where Bibi is generating CFI. There are mainly two issues when generating. The first issue is still related to escaping characters in assertions.
The second issue is the treatment of character data (adjacent text nodes should be treated as a single chunk, etc.).
Applying/locatingThe main problem is again with character data.
|
For the sake of completeness, here's Calibre's implementation: https://github.com/kovidgoyal/calibre/blob/master/src/pyj/read_book/cfi.pyj. It's written in a Python-like language called RapydScript that transpiles to JavaScript. It says that it's based on Peter Sorotkin's code (which is the sample implementation linked in my comment above). Also of interest is this project: https://github.com/valeriangalliat/kobo-highlights-to-calibre, which contains a description of some quirks of the CFI implementations in Kobo and Calibre. |
Thanks John, very useful. Also see: w3c/epubcheck#150 (comment) |
I am developing applications using epubjs ,but data is in readium cfi . Can we convert readium cfi of same to epubjs cfi
The text was updated successfully, but these errors were encountered: