From 9ba65ab37437adfced3e20cb990c548a37c57079 Mon Sep 17 00:00:00 2001 From: dojutsu-user Date: Sat, 19 Oct 2019 19:30:05 +0530 Subject: [PATCH 1/4] Change _source to source --- sphinx_search/static/js/rtd_sphinx_search.js | 14 +++++++------- sphinx_search/static/js/rtd_sphinx_search.min.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sphinx_search/static/js/rtd_sphinx_search.js b/sphinx_search/static/js/rtd_sphinx_search.js index c2d5e88..df28d27 100644 --- a/sphinx_search/static/js/rtd_sphinx_search.js +++ b/sphinx_search/static/js/rtd_sphinx_search.js @@ -178,7 +178,7 @@ const get_section_html = (sectionData, page_link) => { \
'; - let section_subheading = sectionData._source.title; + let section_subheading = sectionData.source.title; let highlight = sectionData.highlight; if (getHighlightListData(highlight, "sections.title")) { section_subheading = getHighlightListData( @@ -188,7 +188,7 @@ const get_section_html = (sectionData, page_link) => { } let section_content = [ - sectionData._source.content.substring(0, MAX_SUBSTRING_LIMIT) + " ..." + sectionData.source.content.substring(0, MAX_SUBSTRING_LIMIT) + " ..." ]; if (getHighlightListData(highlight, "sections.content")) { @@ -206,7 +206,7 @@ const get_section_html = (sectionData, page_link) => { } } - let section_link = `${page_link}#${sectionData._source.id}`; + let section_link = `${page_link}#${sectionData.source.id}`; let section_id = "hit__" + COUNT; @@ -258,11 +258,11 @@ const get_domain_html = (domainData, page_link) => { \
'; - let domain_link = `${page_link}#${domainData._source.anchor}`; - let domain_role_name = domainData._source.role_name; - let domain_name = domainData._source.name; + let domain_link = `${page_link}#${domainData.source.anchor}`; + let domain_role_name = domainData.source.role_name; + let domain_name = domainData.source.name; let domain_docstrings = - domainData._source.docstrings.substr(0, MAX_SUBSTRING_LIMIT) + " ..."; + domainData.source.docstrings.substr(0, MAX_SUBSTRING_LIMIT) + " ..."; // take values from highlighted fields (if present) if (domainData.highlight !== undefined && domainData.highlight !== null) { diff --git a/sphinx_search/static/js/rtd_sphinx_search.min.js b/sphinx_search/static/js/rtd_sphinx_search.min.js index 114dc6d..b4fad77 100644 --- a/sphinx_search/static/js/rtd_sphinx_search.min.js +++ b/sphinx_search/static/js/rtd_sphinx_search.min.js @@ -1 +1 @@ -"use strict";var MAX_SUGGESTIONS=50,MAX_SECTION_RESULTS=3,MAX_SUBSTRING_LIMIT=100,SEARCH_MODAL_OPENED="opened",SEARCH_MODAL_CLOSED="closed",SEARCH_MODAL_STATE=SEARCH_MODAL_CLOSED,TOTAL_PAGE_RESULTS=0,SEARCH_QUERY="",COUNT=0,debounce=function(r,n){function e(){var e=this,t=arguments;clearTimeout(i),i=setTimeout(function(){return r.apply(e,t)},n)}var i;return e.cancel=function(){clearTimeout(i),i=null},e},convertObjToUrlParams=function(t){for(var e=Object.keys(t).map(function(e){if(_is_string(e))return e+"="+encodeURI(t[e])}),r=[],n=0;n
<%= section_subheading %> <% for (var i = 0; i < section_content.length; ++i) { %>

<%= section_content[i] %>

<% } %>

',{section_link:s,section_id:c,section_subheading:r,section_content:i})},getHighlightListData=function(e,t){return!!_is_array(e[t])&&e[t]},get_domain_html=function(e,t){var r="".concat(t,"#").concat(e._source.anchor),n=e._source.role_name,i=e._source.name,o=e._source.docstrings.substr(0,MAX_SUBSTRING_LIMIT)+" ...";if(void 0!==e.highlight&&null!==e.highlight){var a=e.highlight,s=getHighlightListData(a,"domains.name"),c=getHighlightListData(a,"domains.docstrings");s&&(i=s[0]),c&&(o=c[0])}var l=i,_=o,u="hit__"+COUNT;return n="["+n+"]",$u.template('
<%= domain_subheading %>
<%= domain_role_name %>

<%= domain_content %>


',{domain_link:r,domain_id:u,domain_content:_,domain_subheading:l,domain_role_name:n})},generateSingleResult=function(e,t){var r=createDomNode("div"),n="".concat(e.link).concat(DOCUMENTATION_OPTIONS.FILE_SUFFIX),i=e.title;void 0!==e.highlight&&null!==e.highlight&&void 0!==e.highlight.title&&null!==e.highlight.title&&(i=e.highlight.title),t!==e.project&&(i+=" "+$u.template(' (from project <%= project %>) ',{project:e.project})),i+="
",r.innerHTML+=$u.template('

<%= page_title %>

',{page_link:n,page_title:i});for(var o=0;oSearching ....",o.appendChild(t);var r=function(){$.ajax({url:e,crossDomain:!0,xhrFields:{withCredentials:!0},complete:function(e,t){if("success"===t||void 0!==e.responseJSON)if(0
\x3c!--?xml version="1.0" encoding="UTF-8"?--\x3e
Search by Read the Docs & readthedocs-sphinx-search
'},showSearchModal=function(t){removeResults(),SEARCH_MODAL_STATE=SEARCH_MODAL_OPENED,getInputField().blur(),$(".search__outer__wrapper").fadeIn(400,function(){var e=document.querySelector(".search__outer__input");null!==e&&(void 0!==t&&_is_string(t)?e.value=t:e.value="",e.focus())})},removeSearchModal=function(){removeResults(),SEARCH_MODAL_STATE=SEARCH_MODAL_CLOSED;var e=document.querySelector(".search__outer__input");null!==e&&(e.value="",e.blur()),SEARCH_QUERY="",updateUrl(),$(".search__outer__wrapper").fadeOut(400)};window.addEventListener("DOMContentLoaded",function(e){if(window.hasOwnProperty("READTHEDOCS_DATA")){var r=READTHEDOCS_DATA.project,n=READTHEDOCS_DATA.version,i=READTHEDOCS_DATA.language||"en",o=READTHEDOCS_DATA.api_host,t=generateAndReturnInitialHtml();document.body.innerHTML+=t;var a=document.querySelector(".search__outer__wrapper"),s=document.querySelector(".search__outer__input"),c=document.querySelector(".search__cross"),l=0,_=null,u=getInputField();u.addEventListener("focus",function(e){showSearchModal()}),s.addEventListener("input",function(e){SEARCH_QUERY=e.target.value,COUNT=0;var t=o+"/api/v2/docsearch/?"+convertObjToUrlParams({q:SEARCH_QUERY,project:r,version:n,language:i});"string"==typeof SEARCH_QUERY&&0
<%= section_subheading %> <% for (var i = 0; i < section_content.length; ++i) { %>

<%= section_content[i] %>

<% } %>

',{section_link:s,section_id:c,section_subheading:r,section_content:i})},getHighlightListData=function(e,t){return!!_is_array(e[t])&&e[t]},get_domain_html=function(e,t){var r="".concat(t,"#").concat(e.source.anchor),n=e.source.role_name,i=e.source.name,o=e.source.docstrings.substr(0,MAX_SUBSTRING_LIMIT)+" ...";if(void 0!==e.highlight&&null!==e.highlight){var a=e.highlight,s=getHighlightListData(a,"domains.name"),c=getHighlightListData(a,"domains.docstrings");s&&(i=s[0]),c&&(o=c[0])}var l=i,_=o,u="hit__"+COUNT;return n="["+n+"]",$u.template('
<%= domain_subheading %>
<%= domain_role_name %>

<%= domain_content %>


',{domain_link:r,domain_id:u,domain_content:_,domain_subheading:l,domain_role_name:n})},generateSingleResult=function(e,t){var r=createDomNode("div"),n="".concat(e.link).concat(DOCUMENTATION_OPTIONS.FILE_SUFFIX),i=e.title;void 0!==e.highlight&&null!==e.highlight&&void 0!==e.highlight.title&&null!==e.highlight.title&&(i=e.highlight.title),t!==e.project&&(i+=" "+$u.template(' (from project <%= project %>) ',{project:e.project})),i+="
",r.innerHTML+=$u.template('

<%= page_title %>

',{page_link:n,page_title:i});for(var o=0;oSearching ....",o.appendChild(t);var r=function(){$.ajax({url:e,crossDomain:!0,xhrFields:{withCredentials:!0},complete:function(e,t){if("success"===t||void 0!==e.responseJSON)if(0
\x3c!--?xml version="1.0" encoding="UTF-8"?--\x3e
Search by Read the Docs & readthedocs-sphinx-search
'},showSearchModal=function(t){removeResults(),SEARCH_MODAL_STATE=SEARCH_MODAL_OPENED,getInputField().blur(),$(".search__outer__wrapper").fadeIn(400,function(){var e=document.querySelector(".search__outer__input");null!==e&&(void 0!==t&&_is_string(t)?e.value=t:e.value="",e.focus())})},removeSearchModal=function(){removeResults(),SEARCH_MODAL_STATE=SEARCH_MODAL_CLOSED;var e=document.querySelector(".search__outer__input");null!==e&&(e.value="",e.blur()),SEARCH_QUERY="",updateUrl(),$(".search__outer__wrapper").fadeOut(400)};window.addEventListener("DOMContentLoaded",function(e){if(window.hasOwnProperty("READTHEDOCS_DATA")){var r=READTHEDOCS_DATA.project,n=READTHEDOCS_DATA.version,i=READTHEDOCS_DATA.language||"en",o=READTHEDOCS_DATA.api_host,t=generateAndReturnInitialHtml();document.body.innerHTML+=t;var a=document.querySelector(".search__outer__wrapper"),s=document.querySelector(".search__outer__input"),c=document.querySelector(".search__cross"),l=0,_=null,u=getInputField();u.addEventListener("focus",function(e){showSearchModal()}),s.addEventListener("input",function(e){SEARCH_QUERY=e.target.value,COUNT=0;var t=o+"/api/v2/docsearch/?"+convertObjToUrlParams({q:SEARCH_QUERY,project:r,version:n,language:i});"string"==typeof SEARCH_QUERY&&0 Date: Sat, 19 Oct 2019 20:25:21 +0530 Subject: [PATCH 2/4] update dummy data --- tests/dummy_results.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/dummy_results.json b/tests/dummy_results.json index e3bf28a..5caf4fe 100644 --- a/tests/dummy_results.json +++ b/tests/dummy_results.json @@ -17,7 +17,7 @@ "inner_hits": [ { "type": "sections", - "_source": { + "source": { "id": "overview", "title": "Overview", "content": "We want the extension to add the following to Sphinx:\nA helloworld directive, that will simply output the text “hello world”." @@ -28,7 +28,7 @@ }, { "type": "sections", - "_source": { + "source": { "id": "developing-a-hello-world-extension", "title": "Developing a “Hello world” extension", "content": "Only basic information is provided in this tutorial. For more information, refer to the other tutorials that go into more details.\n\nWarning\nFor this extension, you will need some basic understanding of docutils and Python.\n" @@ -41,7 +41,7 @@ }, { "type": "sections", - "_source": { + "source": { "id": "using-the-extension", "title": "Using the extension", "content": "The extension has to be declared in your conf.py file to make Sphinx aware of it. There are two steps necessary here:\nAdd the _ext directory to the Python path using sys.path.append. This should be placed at the top of the file.\nUpdate or create the extensions list and add the extension file name to the list\nFor example:\nimport os import sys sys.path.append(os.path.abspath(\"./_ext\")) extensions = ['helloworld']\nTip\nWe’re not distributing this extension as a Python package, we need to modify the Python path so Sphinx can find our extension. This is why we need the call to sys.path.append.\nYou can now use the extension in a file. For example:\nSome intro text here... .. helloworld:: Some more text here...\nThe sample above would generate:\nSome intro text here... Hello World! Some more text here..." From 6f0231d38f6b0587f92c5fcaae03b3b22a9fb7ae Mon Sep 17 00:00:00 2001 From: dojutsu-user Date: Sat, 19 Oct 2019 20:54:20 +0530 Subject: [PATCH 3/4] update chromedriver --- scripts/setup_chromedriver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_chromedriver.sh b/scripts/setup_chromedriver.sh index 1146954..c2ae4ca 100644 --- a/scripts/setup_chromedriver.sh +++ b/scripts/setup_chromedriver.sh @@ -1,4 +1,4 @@ -wget -N https://chromedriver.storage.googleapis.com/75.0.3770.8/chromedriver_linux64.zip -P ~/ +wget -N https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip -P ~/ unzip ~/chromedriver_linux64.zip -d ~/ rm ~/chromedriver_linux64.zip sudo mv -f ~/chromedriver /usr/local/bin/ From 62a10be1982d6d18551b03a63c2650032e5aed97 Mon Sep 17 00:00:00 2001 From: dojutsu-user Date: Tue, 29 Oct 2019 20:10:40 +0530 Subject: [PATCH 4/4] dont update chromedriver in this PR --- scripts/setup_chromedriver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_chromedriver.sh b/scripts/setup_chromedriver.sh index c2ae4ca..1146954 100644 --- a/scripts/setup_chromedriver.sh +++ b/scripts/setup_chromedriver.sh @@ -1,4 +1,4 @@ -wget -N https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip -P ~/ +wget -N https://chromedriver.storage.googleapis.com/75.0.3770.8/chromedriver_linux64.zip -P ~/ unzip ~/chromedriver_linux64.zip -d ~/ rm ~/chromedriver_linux64.zip sudo mv -f ~/chromedriver /usr/local/bin/