View Single Post
Old Yesterday, 01:27 AM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,874
Karma: 24222221
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Kayadelenium View Post
1. One diff per fix, or one per file?
For plugin integration one diff per file would be ideal. If that's too much work to implement, one diff per change is also fine.
It should only be output if --dry-run is selected.
The idea is that a plugin could run epubsana in --dry-run mode, parse the json output and update only the files where problems were found instead of replacing all files.
It doesn't have to be unified diff. Any standard diff format that will allow Python based Calibre or Sigil plugins to update a text file is fine.

Quote:
Originally Posted by Kayadelenium View Post
One case has no text diff at all: the PKG-006 fix re-packages the container
All packaging problems can be ignored because both Sigil and Calibre Editor will repair epubs with packaging problems when the file is saved again.

Quote:
Originally Posted by Kayadelenium View Post
3. Large diffs — cap them
I personally would prefer all diffs, unless the diff output is close to the original file size.

Speaking of the diff output. It might even be easier to process the fixes that epubsana found if you embedded the complete fixed file as a base64 encoded zip file in the JSON output. (I realize that this is not very efficient. Maybe some other kind of compressed file format that is compatible with json would work better.)

Then a plugin could simply retrieve all updated files from the json file and replace the original text with the changed text.
Doitsu is offline   Reply With Quote