Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 2 additions & 27 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,10 @@
import os
import sys

import sphinx
from m2r import MdInclude
from m2r2 import MdInclude
from recommonmark.transform import AutoStructify


def monkeypatch(cls):
"""decorator to monkey-patch methods"""

def decorator(f):
method = f.__name__
old_method = getattr(cls, method)
setattr(
cls,
method,
lambda self, *args, **kwargs: f(old_method, self, *args, **kwargs),
)

return decorator


# workaround until https://github.com/miyakogi/m2r/pull/55 is merged
@monkeypatch(sphinx.registry.SphinxComponentRegistry)
def add_source_parser(_old_add_source_parser, self, *args, **kwargs):
# signature is (parser: Type[Parser], **kwargs), but m2r expects
# the removed (str, parser: Type[Parser], **kwargs).
if isinstance(args[0], str):
args = args[1:]
return _old_add_source_parser(self, *args, **kwargs)


sys.path.insert(0, os.path.abspath(".."))

autoclass_content = "both"
Expand Down Expand Up @@ -113,4 +87,5 @@ def setup(app):
app.add_config_value("m2r_parse_relative_links", False, "env")
app.add_config_value("m2r_anonymous_references", False, "env")
app.add_config_value("m2r_disable_inline_math", False, "env")
app.add_config_value("m2r_use_mermaid", False, "env")
app.add_directive("mdinclude", MdInclude)
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pybind11
astropy
numpy
recommonmark
m2r
m2r2
scipy
sphinx-rtd-theme
git+https://github.com/telegraphic/pygedm