Thread: CFI Parser
View Single Post
Old 01-13-2019, 10:34 AM   #1
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,220
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
CFI Parser

Hi, @Kovid.

I want to modify ACE Plugin so it can output the results directly on the Editor. This way the user could click on the line and go directly to where the error is (like EPUBCheck Plugin).

But, there is one thing on the way: ACE uses a non-standard EPUBCFI output. The starting point is not the spine. It uses CFI references only inside the file, like this:

Code:
toc.xhtml#epubcfi(/4[idParaDest-e]/2/4[toc])
Doc.xhtml#epubcfi(/4[idParaDest-b]/2/2/4[tit]/4)
The idea was to use your CFI Parser, but I am having trouble to deal with this difference.

I thought maybe I could inject the first part of the reference, before passing it to parser.py, making it whole again. Like this:

Spine item to ref:
Code:
	<spine toc="ncx">
		<itemref idref="Cover"/>
		<itemref idref="Doc"/>
		<itemref idref="Doc-1"/>
		<itemref idref="Doc-2"/>
		<itemref idref="Doc-3"/>
		<itemref idref="toc"/>
		..
		<itemref idref="Doc-38"/>
		<itemref idref="Doc-39"/>
	</spine>
Injected ref:
Code:
epubcfi(6/12!//4[idParaDest-e]/2/4[toc])
This is just an idea, but I don't know how to parse the spine, anyway. ... maybe using bs4.

Can you help me with that? If I could make the CFI reference to work with your parser, then I will work on the rest of the code to achieve the goal of clickable references.

Last edited by thiago.eec; 01-13-2019 at 06:43 PM.
thiago.eec is offline   Reply With Quote