Turn a text file into an epub
ebukafy utility will convert a plain text file into a nicely
formatted html file, ready to be used in an ebook.
It is recommended that you use
ebukafy in conjunction with Calibre. If
you do, read the Use with Calibre section first.
Usage: ebukafy [-h] [-p paragraph-separator] [-s section-separator] filename...
paragraph-separator: sequence of characters that will delimit paragraphs. Default value: "\t".
section-seperator: the sequence of characters that will delimit a section (the things I'm calling 'sections' are usually delimited by an empty line in paper books. In other words, sections are the chunks bigger than paragraphs and smaller than chapters). Default value: "\n\n".
NOTE: If you want to change these two separators, make sure to include
quotes around the option arguments. For example: if you want to use
ebukafy with "\n" as the
paragraph-separator and "\n\n\n" as the
section-separator, you would call it like so:
ebukafy -p "\n" -s "\n\n\n" filename...
-h: print out usage statement
After these options, include as many files as you want to
The output of this utility will be a folder called
filled with files named
index_n.html, with n starting at 1 and
incrementing for each
filename you include when calling
These are the nicely formatted html files that you can use in your
ebook. Additionally, the folder will include a copy of
stylesheet_additions.css that you can find in this repository.
Use with Calibre
This utility is meant to be used in conjunction with Calibre.
Create an empty txt file anywhere.
In Calibre, in the upper left corner, click "Add books", which should open a file selector.
In the file selector, navigate to the empty txt file you created, and open it.
This should create a new empty book in Calibre. If you want to, you can add the metadata for the book such as the title, author, cover, etc.
In Calibre, convert the book you created to an EPUB.
After converting, select the book in the library and click "Edit book" in the top right corner.
On the left side you'll see the files that were created. Remove the one called index.html, if one exists. You probably want to keep the title page (titlepage.xhtml) since most books need a cover.
IMPORTANT: All EPUBs use a css file called stylesheet.css to give greater control over the formatting of the book.
ebukafyuses its own stylesheet to format the html. To find it, look at the
stylesheet_additions.cssfile in this repo (or in the
ebukafy_indexfolder created by
ebukafyafter you run it) and add its contents to the stylesheet.css of the EPUB. In Calibre, you can find this stylesheet in the "Edit book" editor.
At this point, the boilerplate code is set up and you need to run
ebukafy. Look at Usage section.
Click the "Add file" button in the top left of the "Edit book" editor. You should name it
index_n.htmlwhere n is a number that increments with each file you add (first file is
index_1.html, second file is
index_2.html, etc.). Into each file, you put the html created by
Use without Calibre
ebukafy generates nicely formatted html documents based on a provided
txt file. Though it is much easier to put these files into an actual
ebook with Calibre, it is not necessary if you know what you're doing.
Just make sure to read the Usage section.
IMPORTANT: All EPUBs use a css file called stylesheet.css to give
greater control over the formatting of the book.
ebukafy uses its own
stylesheet to format the html. To find it, look at the
stylesheet_additions.css file in this repo (or in the
folder created by
ebukafy after you run it) and add its contents to
the stylesheet.css of the EPUB.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size ebukafy-0.0.1-py3-none-any.whl (3.7 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size ebukafy-0.0.1.tar.gz (3.0 kB)||File type Source||Python version None||Upload date||Hashes View|