From c93a91fa5cfa585e3a0b4e0af359ca707e748139 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 23:48:47 +0200 Subject: [PATCH] Test to add custom searchbox.html --- docs/requirements.txt | 2 +- docs/source/_templates/searchbox.html | 24 ++++++++++++++++++++++++ docs/source/conf.py | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 docs/source/_templates/searchbox.html diff --git a/docs/requirements.txt b/docs/requirements.txt index be6a44fcf8..d3a7c837c5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,7 +2,7 @@ sphinx==2.4.4 sphinx-multiversion==0.1.1 -# lunr==0.5.6 +sphinxontrib-lunrsearch==0.3 # recommonmark custom branch with evennia-specific fixes git+https://github.com/evennia/recommonmark.git@evennia-mods#egg=recommonmark diff --git a/docs/source/_templates/searchbox.html b/docs/source/_templates/searchbox.html new file mode 100644 index 0000000000..62fef56c69 --- /dev/null +++ b/docs/source/_templates/searchbox.html @@ -0,0 +1,24 @@ + +{# The script searchindex.js contains the code Search.setIndex(...) where + the content is an object built from IndexBuilder.freeze(). So we need to + setup the Search.setIndex function beforehand just to store the data. + This should all be finished when onload fires, and at that point the code in + searchbox.js will pull the data out of Search.store and build the actual + index and callbacks. + #} + + + diff --git a/docs/source/conf.py b/docs/source/conf.py index 6218568e49..ed8886139c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -10,6 +10,7 @@ from os.path import sep, abspath, dirname, join as pathjoin, exists import recommonmark from recommonmark.transform import AutoStructify from sphinx.util.osutil import cd +from sphinx.search import IndexBuilder _no_autodoc = os.environ.get("NOAUTODOC") @@ -62,7 +63,7 @@ extensions = [ "sphinx.ext.napoleon", "sphinx.ext.autosectionlabel", "sphinx.ext.viewcode", - # "sphinxcontrib.lunrsearch", + "sphinxcontrib.lunrsearch", ] # make sure sectionlabel references can be used as path/to/file:heading