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
    
  • Install Sphinx

    epub2sphinx can generate ReST files without Sphinx, but Sphinx is used to build the HTML files if --build or --serve flags are used.

    pip3 install sphinx
    

Usage

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

  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 from the EPUB for the HTML output
  --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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epub2sphinx-0.0.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epub2sphinx-0.0.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file epub2sphinx-0.0.1.tar.gz.

File metadata

  • Download URL: epub2sphinx-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epub2sphinx-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fb1679f5eeb8490affea34728524a29ad816e145de7ae0bf38e6ff0d8c2eedf0
MD5 3048bc62e07c997ff1f01de3e27ebf41
BLAKE2b-256 4462ca252b077f52fb32cb10ad9a83af279c6e21697a3b9cdba53d72ebbf6490

See more details on using hashes here.

File details

Details for the file epub2sphinx-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: epub2sphinx-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epub2sphinx-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f49180495e1ee4251d95764aa86bb6e23a5a6e05566cf399a550ce29c47de96a
MD5 2c09b57049faa6906b07bc03727b167a
BLAKE2b-256 1e61b6695c420c9c3adf2187240c3814fb35af86a96fa06282dd04f7eecf7b17

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

This release

0.0.1 This release

2 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