This system is designed to store e-books in plain text format and to generate readable html, pdf and other formats from it automatically. In order to accomplish this, the text files need to be formatted appropriately. The aim of this system is to ensure that the text is readable by itself and that other formats build on the text document and add appropriate features.
Since the books are stored in UTF-8 encoded text, this is suitable only for straight text. There is no provision for anything more than the most simple formatting. It is possible, therefore that some books might require preprocessing and might lose some formatting.
The following programs and libraries must be installed for proper functioning of this system:
- python
- calibre (needed for mobibook and ePub)
On Ubuntu these may be installed by running
# Run this on the command line
$ sudo apt-get install python calibre
All books to be built must be in UTF-8 encoded text and placed in the mkd/
folder. The books should be formatted in
markdown.
See their syntax page
to see how to format your books. You can also follow the example readme.mkd
in the mkd
folder.
Each book must contain on it's last line some metadata about the book in JSON
format. The minimum metadata required is title
and author
. In order to
prevent the metadata from appearing in the ebooks, it should be placed in an
html comment.
The possible metadata tags are:
author-sort
:: String to be used when sorting by author.authors
:: Ampersand separated list of authors.comments
:: Comments about the books contents.isbn
:: ISBN of the published book.pubdate
:: Date of original publication.publisher
:: Publisher of the book.rating
:: Critical rating of the book (between 1 and 5).series
:: The name of the series to which the book belongs.series-index
:: The position of the book in the series.tags
:: Tags that describe the book (possibly for searching in the future).title
:: The title of the book.title-sort
:: The title of the book to be used for sorting.
For example, the last line of "The Adventures of Sherlock Holmes" would look like:
<!--{ "author-sort": "Arthur Conan Doyle", "authors": "Sir Arthur Conan +
Doyle", "isbn": "987-0140621006", "pubdate": "1994-07-28", "publisher": +
"Penguin Popular Classics", "series": "Sherlock Holmes Short Stories", +
"series-index": "1", "title": "The Adventures of Sherlock Holmes" }-->
Each book may have a cover in the cover
folder with the same basename and a
jpg
extension.
Run the python script make.py
to generate all the formats from the markdown
source.
# Run this on the command line
$ python make.py
This will take each markdown file in the mkd
folder and convert it into all
available formats. Like any build system, if the target's modification date
is after that of the source, it is skipped. You can force a book to be
regenerated by changing it's modification date using the touch
command.
# Run this on the command line
$ touch "mkd/file to be regenerated.mkd"