diff --git a/docs/requirements.txt b/docs/requirements.txt index db3bc09e4c..be6a44fcf8 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 +# lunr==0.5.6 # recommonmark custom branch with evennia-specific fixes git+https://github.com/evennia/recommonmark.git@evennia-mods#egg=recommonmark diff --git a/docs/source/_static/js/lunr/search.js b/docs/source/_static/js/lunr/search.js deleted file mode 100644 index 124809e12b..0000000000 --- a/docs/source/_static/js/lunr/search.js +++ /dev/null @@ -1,95 +0,0 @@ -// -// Using the pre-generated index file, set up a dynamic -// search mechanims that returns quick suggestions of the -// best matches you start to enter. -// - -var lunrIndex, - $results, - documents; - -function initLunr() { - // retrieve the index file - $.getJSON("_static/js/lunr/search_index.json") - .done(function(index) { - - lunrIndex = lunr.Index.load(index) - - // documents = index; - - // lunrIndex = lunr(function(){ - // this.ref('url') - // this.field('body') - - // this.field("title", { - // boost: 10 - // }); - - // documents.forEach(function(doc) { - // try { - // this.add(doc) - // } catch (e) {} - // }, this) - // }) - }) - .fail(function(jqxhr, textStatus, error) { - var err = textStatus + ", " + error; - console.error("Error getting Lunr index file:", err); - }); -} - -function search(query) { - return lunrIndex.search(query).map(function(result) { - return documents.filter(function(page) { - try { - console.log(page) - return page.href === result.ref; - } catch (e) { - console.log('Error in search. ' + e) - } - })[0]; - }); -} - -function renderResults(results) { - if (!results.length) { - return; - } - - // show first ten results - results.slice(0, 10).forEach(function(result) { - var $result = $("
  • "); - - $result.append($("", { - href: result.url, - text: "ยป " + result.title - })); - - $results.append($result); - }); -} - -function initUI() { - $results = $("#lunrsearchresults"); - - $("#lunrsearch").keyup(function(){ - // empty previous results - $results.empty(); - - // trigger search when at least two chars provided. - var query = $(this).val(); - if (query.length < 2) { - return; - } - - var results = search(query); - - renderResults(results); - }); -} - -initLunr(); - -$(document).ready(function(){ - initUI(); -}); diff --git a/docs/source/_templates/searchbox.html b/docs/source/_templates/searchbox.html deleted file mode 100644 index 5dd5fab1a0..0000000000 --- a/docs/source/_templates/searchbox.html +++ /dev/null @@ -1,31 +0,0 @@ -{# - basic/searchbox.html - ~~~~~~~~~~~~~~~~~~~~ - - Variant for lunrJS search - -#} -{%- if pagename != "search" and builder != "singlehtml" %} - - -{%- endif %} - -{# - - Lunr indexed quick search - -#} -

    - - - - - diff --git a/docs/source/conf.py b/docs/source/conf.py index eb3773fc1f..6218568e49 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -61,7 +61,8 @@ extensions = [ "sphinx_multiversion", "sphinx.ext.napoleon", "sphinx.ext.autosectionlabel", - "sphinx.ext.viewcode" + "sphinx.ext.viewcode", + # "sphinxcontrib.lunrsearch", ] # make sure sectionlabel references can be used as path/to/file:heading