Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html_sourcelink_suffix don't allow anymore to make search result user friendly #3696

Closed
pybride opened this issue May 3, 2017 · 5 comments
Closed

Comments

@pybride
Copy link

pybride commented May 3, 2017

Subject: html_sourcelink_suffix don't allow anymore to make search result user friendly

Problem

  • To make the search result user friendly (see HTML Search results aren't reader friendly #1618), the only solution for the moment is to run again sphinx, generating text output, which is filtered and then placed in the generated HTML _sources folder.
    The sphinx-pretty-searchresults plugin makes the filtering better, but it is still a text output from sphinx.

Therefore, if the documentation source has a something.rst file, a something.txt would be put in the _sources folder.

But since sphinx 1.5 and #2454, the behavior is to add the html_sourcelink_suffix to the source file name: the javascript search will look for a file something.rst.txt

Unfortunately, this new behavior cannot be disabled (not like the previous #2399).

I see three possible solutions:

  • add text output option text_file_suffix to allow the second run to generate file like something.rst.txt
  • put again the html option html_sourcelink_keep_suffix, so that when set to false, the javascript will look for something.txt
  • correct the whole html search (HTML Search results aren't reader friendly #1618) by integrating the sphinx-pretty-searchresults

Environment info

  • Python version: 2.7
  • Sphinx version: 1.5.x
@pybride
Copy link
Author

pybride commented May 3, 2017

As workaround, in searchtools.js_t, replace the line
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
with
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5].slice(0, -4) + '.txt',

@ekpgh
Copy link

ekpgh commented May 18, 2017

For what it's worth, sphinxprettysearchresults was updated this week to v0.2.0, which works with Sphinx 1.5.

@tk0miya
Copy link
Member

tk0miya commented Jun 3, 2017

@pybride Is this still needed?

@pybride
Copy link
Author

pybride commented Jun 12, 2017

@tk0miya I just returned from a long trip, so I didn't tested the new sphinxprettysearchresults, but apparently it isn't needed anymore. I will close it.

@pybride pybride closed this as completed Jun 12, 2017
@tk0miya
Copy link
Member

tk0miya commented Jun 12, 2017

:-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants