EpubCheck

Différence entre les versions 3 et version actuelle

Résumé : EpubCheck is a tool to validate EPUB files.

Pas de diff disponible.

EpubCheck is a tool to validate EPUB files. It can detect many types of errors in EPUB. OCF container structure, OPF and OPS mark-up, and internal reference consistency are checked. EpubCheck can be run as a standalone command-line tool or used as a Java library.

Validation/création d'un fichier epub

Décompresser le fichier .epub

  $ unzip test.epub -d test
  $ ls -1 test/*
  test/ch001.xhtml
  test/content.opf
  test/mimetype
  test/nav.xhtml
  test/stylesheet.css
  test/title_page.xhtml
  test/toc.ncx
  test/META-INF:
  com.apple.ibooks.display-options.xml
  container.xml

Apporter les modifications nécesssaires et, si le résultat est valide, effectuer

 $ epubcheck ./test -mode exp -save

Il est indispensable de préciser le répertoire avec le point initial ! Faute de quoi:

  java.lang.RuntimeException: The path specified for the archive is invalid

Reconstruction d'un epub avec zip

Cf. http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/index.html?ca=drs-

Listing 11. Bundling the EPUB into a valid epub+zip file
 $ zip -0Xq  my-book.epub mimetype
 $ zip -Xr9Dq my-book.epub *
In the first command, you create the new ZIP archive and add the mimetype file with no compression. In the second, you add the remaining items. The flags -X and -D minimize extraneous information in the .zip file; -r will recursively include the contents of META-INF and OEBPS directories.