Code Monkey home page Code Monkey logo

epub2sphinx's People

Contributors

allwin12 avatar allwinraju avatar arvindpz avatar aswinchand97 avatar nifey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

arvindpz

epub2sphinx's Issues

Copy fonts and Don't copy ncx files

Fonts are not getting copied. We also need to avoid copying any other files that we don't need like the ncx file and creating empty folders.

We can change --include-custom-css to --include-custom-style to copy both CSS stylesheets and font files together i.e. either copy both stylesheets and fonts or none of them.

Index page is empty

We add genindex to the index.rst but the HTML page is empty.

We can find out why that is happening and fix it or remove genindex since most sphinx themes have a table of contents.

Hi, this seems like a good idea, but...

Any help would be great, as I am a writer who likes to host my own ebooks and Vellum (vellum.pub) generates very
nice epub files and would be an easy way to make static html files. Thanks.

I'm on a Mac in the terminal and after doing the following and restarting:

  1. brew install pandoc ... no errors
  2. python3 setup.py install ... no errors

... but I get this error everytime:
...............................
iMac ~ % epub2sphinx --version
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/bin/epub2sphinx", line 33, in
sys.exit(load_entry_point('epub2sphinx==0.0.3', 'console_scripts', 'epub2sphinx')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/bin/epub2sphinx", line 25, in importlib_load_entry_point
return next(matches).load()
^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/init.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/epub2sphinx-0.0.3-py3.11.egg/cli.py", line 1, in
import click
ModuleNotFoundError: No module named 'click'
...............................

iMac info:
Intel, Ventura 13.2.1

iMac ~ % brew -v
Homebrew 4.0.10

iMac ~ % python3 --version
Python 3.11.1

... other python github projects are working just fine, so what am I missing, thoughts?

Speed improvement

Right now, the tool is bottlenecked especially by the generate rst stage.
Some possible approaches to improve speed of conversion:

  • Check if unzipping the epub and directly accessing the html files is faster than obtaining it through ebooklib.
  • Check if we can execute subprocesses for pandoc conversion in parallel

Handle --serve failing when the port is already used

Right now, if the port 8000 is already being used, the tool prints a stack trace.

We can instead catch that exception and try a different port number instead or just print that the port is unavailable.

We can also add an optional argument for the user to specify a port to serve on if --serve is used.

Enable overwriting output directory

As of now, the tool aborts with an error message if the output directory already exists.
Instead of aborting we can ask the user if it is okay to overwrite the directory and then delete the directory if the user says yes.

We can also add a --overwrite flag for the user to explicitly tell that overwriting the output directory is okay.

Plugin system for different publishers

Right now we have hardcoded some HTML transformation like removing epub:type, converting image tag to img tag, etc.
Different epub creators have different structure, like title page, TOC, about page, etc.

It would be nice to have some hooks similar to plugins of Ebooklib to allow doing some extra modifications specific to an epub creator. Eg: Books from project gutenberg have a notice at the beginning and end. This hook can allow moving the notice to a different chapter.

Switch to a templating library

Instead of implementing our own templating using regex, we can use an existing templating library like jinja.

  • Implement templating for all files that we modify and copy
  • Convert files in templates directory to use jinja
  • Convert index.rst to use templates

Ops tasks

  • Add documentation
  • Publish documentation to Read the docs
  • Inline documentation for functions
  • Add contributing guidelines and issue template
  • Add tests
  • Add CI to check with different python versions and newer versions of dependencies
  • Publish to PyPI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.