Creates an *.opf file for your ePub 3.0 e-book by scanning through OPS and its children.
- Clone the repository.
- Check that ruby is installed (tested on v2.0.0 and higher).
ruby -v
- Check that the
container.xmlfile located inMETA-INFdirectory has a full-path specified:
<rootfile full-path="OPS/content.opf" media-type="application/oebps-package+xml" />
mvthegenerate_opf.rbfile into your ePub'sOPSdirectory.cdinto yourOPSdirectory.- Run the program with the command:
ruby generate_opf.rb
rmthegenerate_opf.rbfile fromOPSdirectory.- Reorder spine items if desired e-book order is not in file-name ascending order.
- Package up ePub and check for errors using ePub Checker.
- Folder structure must be in ePub 3.0 format.
- All e-book content files must exist within
OPSand its children. - All text files to be added to spine must be
*.xhtmland exist in or down one directory relative toOPS:
/OPS/Text/page_0001.xhtmlis supported./OPS/page_0001.xhtmlis supported./OPS/Chapters/Texts/page_0001.xhtmlis not supported./OPS/page_0001.htmlis not supported.
- Naming convention of table of content files should be:
toc.xhtmlis preferred; a file following*toc.xhtmlnaming convention is supported.toc.ncxis optional fallback and not required for ePub 3.0 validation.
- Files with extensions not listed below will not be added to the OPF file.
- Additional rendition settings are not generated.
- Images: jpeg, jpg, png, gif, svg
- Fonts: eot, woff, ttf, otf
- JavaScript: js
- Video: m4v, mp4, mov
- Audio: mp3, m4a
- Text: html, xhtml
- TOC: ncx, xhtml
Generate OPF is released under the MIT License.
Please report an issue if you run into any bugs or have feature requests.