ukwa / ukwa-pywb

GNU General Public License v3.0
11 stars 3 forks source link

For ePub documents, show chapter and paragraph numbers when text is selected, for citation purposes. #98

Closed anjackson closed 11 months ago

anjackson commented 1 year ago

Our current solution shows the chapter and paragraph number when a section of text is highlighted in an ePub document. This is our recommended approach to citation, and must be supported by this new viewer.

The current solution looks like this:

2022-10-07-epub-citation

The new solution does not have to look the same - it's just to give the idea.

Note that this citation proposal does not expose (and does not necessarily require) an implementation of the EPUB Canonical Fragment Identifiers.

anjackson commented 1 year ago

It's perhaps worth noting that recent versions of Calibre do not behave like this. You can enter 'Reference Mode' and then the C.P number is displayed at the start of each paragraph.

anjackson commented 1 year ago

Ah, I think we missed a bit @tw4l - we also want to be able to use citations by searching for them. Apparently this works for the original user (I think it gets remembered in the session), but really we need some way for 'fresh' users to be able to search for a X.N reference and for the matching paragraph to be highlighted. (Perhaps this is something to integrate with the search functionality development milestone?)

It was also pointed out that the first number doesn't match the printed chapter number, but presumably that was the same for Calibre (someone from the Reading Room team is checking....). EDIT: UPDATE yes behaviour is the same a Calibre so that's fine!

tw4l commented 1 year ago

@anjackson Search result highlighting is now working for text string search queries (will demo Thursday), but I'm still working on highlighting entire paragraphs from a X.N reference - currently we just have the starting CFI for each paragraph, so I need to modify that so that we have a CFI range to be able to highlight the entire paragraph. This may not be ready by Thursday, but I will try to get it implemented as soon as possible after that.

anjackson commented 1 year ago

Thanks @tw4l

I've tried to tidy up the PRs a bit to make things clearer. Please let me know if I've caused any problems.