From f5ed4a8916e22048d79cad7948b699e3e493c121 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 (cherry picked from commit 8bd8a8badbf992347a0883a537cce414432c867e) --- 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 74d8417046ec1..5c58d4bc60a55 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -51,6 +51,7 @@ extensions = [ 'breathe', 'edit_on_github', ] + ditaa = shutil.which("ditaa") if ditaa is not None: extensions += ['sphinxcontrib.ditaa'] @@ -60,6 +61,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( @@ -115,7 +120,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