Turn a text file into an epub chapter
Project description
ebukafy
The ebukafy utility will convert a plain text file into a nicely
formatted html file to be used as a chapter in an epub.
Usage
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...
Options
-
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". If the text only has one section, just make this something random that won't appear in the text.
NOTE: If you want to change these two separators, make sure to use ANSI
C like strings. These are used like so: $'string'. For example: if you
want to use ebukafy with \n\n as the paragraph-separator and
\n\n\n as the section-separator, you would call it like so:
ebukafy -p $'\n\n' -s $'\n\n\n' filename...
-h: print out usage statement
Args
After these options, include as many files as you want to ebukafy.
Output
The output of this utility will be a folder called ebukafy_index
filled with files named index_n.html, with n starting at 1 and
incrementing for each filename you include when calling ebukafy.
These are the nicely formatted html files that you can use in your
epub. 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 thestylesheet_additions.cssfile in this repo (or in theebukafy_indexfolder created byebukafyafter 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 isindex_1.html, second file isindex_2.html, etc.). Into each file, you put the html created byebukafy.
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
epub 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 theebukafy_index
folder created by ebukafy after you run it) and add its contents to
the stylesheet.css of the EPUB.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ebukafy-0.0.2.tar.gz.
File metadata
- Download URL: ebukafy-0.0.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f88ddb1d97dbcda33af975d6ae53034a11bc023964f57911d91b16574742906
|
|
| MD5 |
7a494db4c4b812a7cd4d7a699686eedd
|
|
| BLAKE2b-256 |
0a26e404ecd6c0217b7082be75ec41200361be780f187079e4c2d9b5028e5fa0
|
File details
Details for the file ebukafy-0.0.2-py3-none-any.whl.
File metadata
- Download URL: ebukafy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a30a88d0fa25b585bb555c627f0f976ea3db739dd4531275cd626d43099751
|
|
| MD5 |
14b6987013278a6209d197e01f9df112
|
|
| BLAKE2b-256 |
f4a4b064b518e409f70a07b2e9c9b4b444456977c5751ad5504d9dbc7af5675c
|