Package: ebookmaker
EbookmakerEbookmaker is the tool used for format conversion at Project Gutenberg.
It builds HTML5, EPUB2, EPUB3 and Kindle files (including KF8) from HTML.
It builds builds thes formats and PDF files from reST sources.If you are preparing HTML for use with Ebookmaker, theUsage Notesmay be of interest.PrerequisitesPython3 >= 3.7Needed only for Kindle generationCalibre (https://calibre-ebook.com/) (needed to make  Kindle files)may need to install Calibre's ebook-convert command line toolhttps://manual.calibre-ebook.com/generated/en/cli-index.htmlNeeded only for validationEpubCheck (for EPUB vaidalition) To use EPUBCheck validation, first download and install EPUBCheck fromhttps://www.w3.org/publishing/epubcheck/. If the command to invoke it isjava -jar /Applications/epubcheck-4.2.6/epubcheck.jar, then add this line to ~/.ebookmaker or /etc/ebookmaker.conf:epub_validator: java -jar /Applications/epubcheck-4.2.6/epubcheck.jarthen turn on validation by adding--validateto Ebookmaker's command line invocation or by setting validate to true in ~/.ebookmakerthe W3C "Nu" validator (for HTML5 validation)https://validator.github.io/validator/add this line to ~/.ebookmaker or /etc/ebookmaker.conf:html_validator: [something for your install]/vnu-runtime-image/bin/vnuthen turn on validation by adding--validateto Ebookmaker's command line invocation or by setting validate to true in ~/.ebookmakeron MacOS, you may need to create security exceptions. On my system, I had to dosudo xattr -r -d com.apple.quarantine /Users/eric/vnu-runtime-image/libNeeded only for cover generationCairohttps://www.cairographics.org/download/Noto Sans and Noto Sans CJK:CentOS or RedHat:yum install google-noto-sans-cjk-fonts; yum install google-noto-sans-fontsUbuntu:apt-get install fonts-noto-cjk fonts-notoNeeded only for conversion from RSTLibertinus Serif and Libertinus Sanshttps://github.com/alerque/libertinusFor Linux,Download the latest releasehttps://github.com/alerque/libertinus/releases/latestunzip, put .otf files into ~/.fontsupdate font catalogfc-cache -f -vDejaVu Sans Monohttps://dejavu-fonts.github.io/TexLive (to build PDF from TeX and rst)Tested with Python 3.8Install(master branch, editable install)pipenv install ebookmakerUse the ebookmaker.conf file to pass a path to your kindlegen, tex, and groff programs
if they're not in your PATH. Edit the ebookmaker.conf and copy it to /etc/ebookmaker.conf to
reset the paths.
Copy ebookmaker.conf to ~/.ebookmaker to override settings in /etc/ebookmaker.conf or to set default
command line options.Sample invocation(From the directory where you ranpipenv install)pipenv shellebookmaker -v -v --make=epub.images --output-dir=/Documents/pg /Documents/library/58669/58669-h/58669-h.htmorpipenv run ebookmaker -v -v --make=epub.images --output-dir=/Documents/pg /Documents/library/58669/58669-h/58669-h.htmnew to pipenv?Install pipenv  (might bepip install --user pipenv, depending on your default python)$ pip3 install --user pipenvThe default install location is${HOME}/.local/bin, so add this to your login shell's ${PATH} if needed.Change directories to where you want to have your ebookmaker environment. Then, to initialize a python 3 virtual environment, do$ pipenv --threeWhenever you want to enter this environment, move to this directory and do:$ pipenv shellInstall the gutenberg modules:$ pipenv install ebookmakerCheck your install:$ ebookmaker --versionEbookMaker 0.12.0Since you're in the shell, you can navigate to a book's directory and convert it:$ ebookmaker -v -v --make=epub.images --ebook 10001 --title "The Luck of the Kid" --author "Ridgwell Cullum" luck-kid.htmlUpdate$ cd ebookmakerto wherever you ran$ pipenv install ebookmakerthen:$ pipenv update ebookmakerTestInstall, as above.$ cd ebookmakerto wherever you ran$ pip install ebookmakerthen:$ git checkout master$ pipenv install -e .$ python setup.py testTravis-CI will run tests on branches committed in the gutenbergtools orgNotes running Ebookmaker on Windows Machine (adapted from @windymilla)Install Python 3.7+ from python.org. Install Kindlegen. Add it to the path.Add system environment variable: Right-click "My Computer", then Properties, then Advanced, then Environment variables, then New. Call the variable PYTHON_HOME, and set it to the Python folder.Edit the Path variable and add to the end of it;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\Check by starting a new command window and typingpython. It should run your version of Python. Quit python with^Z& Enter.In command window, typepip3 install --user pipenv. Script may warn it has put scripts into a folder such asC:\Users\myname\AppData\Roaming\Python\Python37\Scripts, and to add this to the Path environment variable. Do this – don't forget the semicolon before the new folder name! (Possibly might work instead to just copy the newly installed files from where they were installed into your main python scripts folder, i.e.%PYTHON_HOME%\Scripts?)Close old command window and start a new (to get the new path)Create a folder for ebookmaker, e.g.C:\DP\ebookmakerIn command window, go to the new folderTypepipenv install ebookmaker– takes a while to install. It will also create a "virtual environment", with a new folder, something likeC:\Users\myname\.virtualenvs\ebookmaker-cgaQuYhi(Optional - only if you need ebookmaker to create a book cover for you because you are not providing one)
Download GTK+ to get Cairo. Precompiled Win32 binaries are here:http://ftp.gnome.org/pub/gnome/binaries... _win32.zip
Unzip this to a folder, e.g.C:\DP\gtkand addC:\DP\gtk\binto the Path environment variable.
Exit command window and start a new one to get new path
Go to the ebookmaker folder,C:\DP\ebookmakerTypepipenv run python ebookmaker --versionto check ebookmaker version. If this doesn't work (it should, but didn't work for us) try:Look inC:\Users\myname\.virtualenvs\and find the name of your virtualenv - it should be something likeebookmaker-cgaQuYhiTypepipenv run python C:\Users\myname\.virtualenvs\<name of virtualenv>\Scripts\ebookmaker --versionto check ebookmaker version.(Should not happen now Cairo is optional) If there's error like like no "cairo" or "cairo-2" found, check if your libcairo and libcairo-2 path exist. If they do, edit dlopen ininit.py in cairocffi package. Return the path found by ctypes.util.find_library directly instead of calling ffi.dlopen(path).If folder/file name contains space, pathnames muse be enclosed in", like--output-dir="C:\your foldername". If pathname is quoted, it MUST NOT end with trailing\or error will be raised. If running bat file from within Guiguts, this means you should use$d.rather than$d(i.e. a dot after $d so quoted pathname will end in\."rather than\") when passing it as a value for the output-dir argument.Example run_ebookmaker.bat file for use with Guiguts:
cd C:\DP\ebookmaker
pipenv run python C:\Users\myname.virtualenvs\ebookmaker-cgaQuYhi\Scripts\ebookmaker -v --make=epub.images --make=kindle.images --output-dir=%1 --title=%2 %3Corresponding "external program" setup within Guiguts:c:\dp\ebookmaker\run_ebookmaker.bat $d. $f $d$f$e