Skip to main content

epub2sphinx

epub2sphinx is a tool to convert epub files to ReST for Sphinx.

It uses Pandoc for converting HTML data inside epub files into ReST.

It creates a directory structure similar to what sphinx-quickstart generates by default.

Built during FOSSHack 21 to solve this issue.

Installation

  • Install pandoc

    # On Ubuntu
    sudo apt-get install pandoc
    # On Arch Linux
    pacman -S pandoc
    

    For installing on other platforms, look here.

  • Install epub2sphinx

    python setup.py install
    

Usage

Usage: epub2sphinx <epub_file_name> [-o <output_directory_path>] [-t <sphinx_theme_name>] [-s|--server|-b|--build] [-c]

  This tool helps you to convert your epub files into sphinx format for a better reading experience.
  Kindly provide the epub file as the argument to this command.

Options:
  -o, --output-directory PATH  The name of the output directory where the ReST file will be generated.
                               Kindly make sure that the given directory is not existing already.
  -t, --theme TEXT             The name of the sphinx theme.You can check for the available themes at:
                               <https://www.sphinx-doc.org/en/master/usage/theming.html#builtin-themes>
  -b, --build                  Build HTML from the generated ReST files using Sphinx.
                               Sphinx has to be installed for this to work.
  -s, --serve                  Build HTML using Sphinx and Serve the files on localhost.
                               Sphinx has to be installed for this to work.
  -c, --include-custom-css     Include the custom CSS and Fonts from the EPUB for the HTML output
  -p, --port INTEGER           The port number on which the files will be served after conversion
  --overwrite                  Overwrite the output directory if present already
  --version                    Show the version and exit.
  --help                       Show this message and exit.

Example

epub2sphinx -o out_dir -t classic my_book.epub

# To generate HTML files using Sphinx
cd out_dir
make html

Usecase

epub2sphinx can be used to convert public domain or CC-licensed epub files into static web pages that allows people to read them online. This will be useful for sites like Project Gutenberg or FreeTamilEbooks. Eventhough Project Gutenberg has an option to read online, it is very plain. Using Sphinx allows us to make use of any default or custom sphinx theme to make it look better.

Screenshots of comparison

Project Gutenberg online read vs Sphinx generated output

image

image

Contributing

Contributions are welcome. Fork the repo and Create a PR with your changes. If you are working on any of the existing issues, please add a comment on the issue to avoid duplicated effort.

GitHub GitHub issues GitHub forks GitHub Repo stars GitHub watchers

Metadata

Release files for epub2sphinx 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epub2sphinx 0.0.3
File Size Uploaded
epub2sphinx-0.0.3.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for epub2sphinx 0.0.3
File Interpreter ABI Platform
epub2sphinx-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / epub2sphinx-0.0.3.tar.gz

Download URL epub2sphinx-0.0.3.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3b10aa51cfb9329dc688767497d379f00066405ef4bc859f9aaa89902a41a951
BLAKE2b-256 checksum
How to use checksums
ed9b478ceda6b219afab58e764b14a5cbc9ae262c65c550c1971d72f6829fcf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / epub2sphinx-0.0.3-py3-none-any.whl

Download URL epub2sphinx-0.0.3-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df3710840e508329bc5381e69d8317a463874f9fcb474e6162babff7fe6830a3
BLAKE2b-256 checksum
How to use checksums
f3b9ce00d266d4c6866c3ca450ec42c4cd882ad4e164524c15f1a1b7ad46f6ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release history Release notifications | RSS feed

0.0.5

2 release files

0.0.4

2 release files

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page