[flang] Fix docs build

Apply a local fix to an issue with recommonmark's AutoStructify extension
when used with certain versions of sphinx.

See https://github.com/readthedocs/recommonmark/issues/93

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D87714
This commit is contained in:
Richard Barton 2020-09-16 08:18:08 +01:00
parent 94f7d3dba3
commit af56be339f
1 changed files with 11 additions and 0 deletions

View File

@ -50,6 +50,17 @@ else:
# Setup AutoStructify for inline .rst toctrees in index.md
from recommonmark.transform import AutoStructify
# Stolen from https://github.com/readthedocs/recommonmark/issues/93
# Monkey patch to fix recommonmark 0.4 doc reference issues.
from recommonmark.states import DummyStateMachine
orig_run_role = DummyStateMachine.run_role
def run_role(self, name, options=None, content=None):
if name == 'doc':
name = 'any'
return orig_run_role(self, name, options, content)
DummyStateMachine.run_role = run_role
def setup(app):
# Disable inline math to avoid
# https://github.com/readthedocs/recommonmark/issues/120 in Extensions.md