Generates a template directory that you can use to build a custom epub file.
Usage: epubbery /path/to/new/book (if the directory does not exist, it will be created)
Go to the new directory and modify the file config.yml
Run epubbery from within the new directory.
Text files will be html-ized using textile (via the RedCloth gem). Check the templates directory for files you may want to customize (such as stylesheet.css or the .liquid html files).
Any line at the top of a text file that matches a single word followed by a colon, followed by any text, will become a meta tag-like variable for that “chapter”. For example, if you have:
Date: 1999 Subhead: Party Time
Then your chapter will have a “meta” hash with those attributes:
chapter.meta['date'] == '1999' chapter.meta['subhead'] == 'Party Time'
Additionally, there are a couple of special meta tags that will be used for functional purposes:
Name: _string_ - will always be availble as chapter.name Position: _number_ - will be set to chapter.number and used in sorting Number: _number_ - will be set to chapter.number and used in sorting Chapter: _number_ - will be set to chapter.number and used in sorting Template: see below
You’ll find a few liquid templates in the OEBPS directory of your project. Feel free to edit these as desired using liquid syntax: www.liquidmarkup.org/ By default, all text files will use the chapter.html.liquid template. You can override this default in config.yml, as well as on a file-by-file basis (by using the special meta tag “Template: whatever”).
Any meta tags as described previously will be available in the liquid templates.
Helper functions for chapters:
name number_or_name number_as_word name_or_number word_count html
epubbery can be used in a ruby application instead of on the command line. You need to create a Book object, filled with Chapter objects, and then an Epub object.
After you’ve created an epub file, you can easily convert it to PDF. Here are a couple of hints:
using Calibre (calibre-ebook.com/):
ebook-convert epub_folder/file_name.epub .pdf --custom-size=5x8 --base-font-size=12 --margin-top=54 --margin-left=54 --margin-bottom=54 --margin-right=54
using wkhtmltopdf (code.google.com/p/wkhtmltopdf/):
wkhtmltopdf --page-width 5in --page-height 8in -L 0.5in -R 0.5in -B 0.5in -T 0.25in --footer-center '[page]' --footer-spacing 2 --print-media-type --footer-font-name TexGyreTermes --footer-font-size 9 epub_folder/OEBPS/*.html mybook.pdf
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright © 2010-2012 Jason LaPier. See LICENSE.txt for further details.