From af56be339f8c9660747794cc6755384154602535 Mon Sep 17 00:00:00 2001 From: Richard Barton Date: Wed, 16 Sep 2020 08:18:08 +0100 Subject: [PATCH] [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 --- flang/docs/conf.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flang/docs/conf.py b/flang/docs/conf.py index 851b233767a91..197721a4e4c80 100644 --- a/flang/docs/conf.py +++ b/flang/docs/conf.py @@ -50,6 +50,17 @@ # 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