Test to add custom searchbox.html

This commit is contained in:
Griatch 2020-05-18 23:48:47 +02:00
parent 77303e677a
commit c93a91fa5c
3 changed files with 27 additions and 2 deletions

View file

@ -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

View file

@ -0,0 +1,24 @@
<script type="text/javascript">
var Search = {
store : null,
setIndex : function (data) {
this.store = data.store;
},
};
</script>
{# 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.
#}
<script src="{{ pathto('searchindex.js', 1) }}" type="text/javascript"></script>
<form class="search" action="" method="get" autocomplete="new-password">
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
<input type="hidden" id="ls_lunrsearch-highlight" value="{{ lunrsearch_highlight }}" />
<input type="text" class="search-field" id="ls_search-field" name="q" placeholder="Search API" />
<ul class="results" id="ls_search-results"></ul>
</form>

View file

@ -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