Skip to content

Commit

Permalink
Turn off the inliner for PEP and RST references
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 20, 2022
1 parent 2b6cc3c commit fb18a0c
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pep_sphinx_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,8 @@
from sphinx.application import Sphinx

# Monkeypatch sphinx.environment.default_settings as Sphinx doesn't allow custom settings or Readers
# These settings should go in docutils.conf, but are overridden here for now so as not to affect
# pep2html.py
environment.default_settings |= {
"pep_references": True,
"rfc_references": True,
"pep_base_url": "",
"pep_file_url_template": "",
"_disable_config": True, # disable using docutils.conf whilst running both PEP generators
}

# TODO replace all inlined PEP and RFC strings with marked-up roles, disable pep_references and rfc_references and remove this monkey-patch
states.Inliner.pep_reference = lambda s, m, _l: [nodes.reference("", m.group(0), refuri=s.document.settings.pep_url.format(int(m.group("pepnum2"))))]
# This disables reading configuration from docutils.conf so as not to affect pep2html.py
environment.default_settings["_disable_config"] = True


def _depart_maths():
Expand Down

0 comments on commit fb18a0c

Please sign in to comment.