Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix generation of epub (sphinx bug) #3749

Open
wants to merge 4 commits into
base: develop2
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,23 @@ def copy_legacy_redirects(app, docname): # Sphinx expects two arguments

def setup(app):
app.connect('build-finished', copy_legacy_redirects)


def monkeypatch_method(cls, fname=None):
def decorator(func):
local_fname = fname
if local_fname is None:
local_fname = func.__name__
setattr(func, "orig", getattr(cls, local_fname, None))
setattr(cls, local_fname, func)
return func
return decorator

import sphinx.application


@monkeypatch_method(sphinx.application.Sphinx)
def add_node(self, node, override=False, **kwds):
if 'html' in kwds and 'epub' not in kwds:
kwds['epub'] = kwds['html']
return add_node.orig(self, node, override, **kwds)
memsharded marked this conversation as resolved.
Show resolved Hide resolved