From 8bd8a8badbf992347a0883a537cce414432c867e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 9 Apr 2020 23:14:42 +0800 Subject: [PATCH] doc: add in-doc search from read the docs readthedocs-sphinx-search features better user experience than the builtin search offered by sphinx Signed-off-by: Kefu Chai --- admin/doc-read-the-docs.txt | 1 + doc/conf.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/admin/doc-read-the-docs.txt b/admin/doc-read-the-docs.txt index bcc77ccffb0a3..b65cc4638491a 100644 --- a/admin/doc-read-the-docs.txt +++ b/admin/doc-read-the-docs.txt @@ -1 +1,2 @@ plantweb +git+https://github.com/readthedocs/readthedocs-sphinx-search@master diff --git a/doc/conf.py b/doc/conf.py index 92d5329e7f159..ee3dec12025c4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -58,6 +58,7 @@ extensions = [ 'edit_on_github', 'ceph_releases', ] + ditaa = shutil.which("ditaa") if ditaa is not None: extensions += ['sphinxcontrib.ditaa'] @@ -67,6 +68,10 @@ else: 'engine': 'ditaa' } +build_with_rtd = os.environ.get('READTHEDOCS') == 'True' +if build_with_rtd: + extensions += ['sphinx_search.extension'] + todo_include_todos = True top_level = os.path.dirname( @@ -122,7 +127,7 @@ class Mock(object): sys.modules['ceph_module'] = Mock() -if os.environ.get('READTHEDOCS') == 'True': +if build_with_rtd: exclude_patterns += ['**/api/*', '**/api.rst'] autodoc_mock_imports = ['cephfs', -- 2.39.5