Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Sphinx 1.5 searchtools override has changed #25

Closed
agjohnson opened this issue Mar 9, 2017 · 0 comments
Closed

Sphinx 1.5 searchtools override has changed #25

agjohnson opened this issue Mar 9, 2017 · 0 comments
Assignees

Comments

@agjohnson
Copy link
Contributor

Raised in readthedocs/readthedocs.org#2708

The problem here is that the Sphinx 1.5 searchtools.js_t has changed, but our override that removes the automatic execution has not been updated. This raises a few things:

  • Should we drop support for Sphinx searchtools?
  • The basic theme inserts this file inside the template, making overriding this pretty awful. We could override the searchtools.js_t with, effectively, a NOOP script. This would override whatever Sphinx 1.x adds to this file. The base implementation could be moved to our JS.
  • The quickest solution is to instead just have two overrides, and the override is selected based on the Sphinx versioninfo.

Perhaps the first wave of fix here is to select the override based on Sphinx version, and then we just blow up support for the Sphinx searchtools on RTD altogether.

agjohnson added a commit that referenced this issue May 3, 2017
Combine both into a single template for now. This isn't ideal, but the
differences were minor.

Future changes here might be to instead patch the file as we're copying,
stealing it from Sphinx package distribution instead. We only need to remove
`Search.init()` from the file, so perhaps this isn't horribly difficult.

Fixes #25
Refs readthedocs/readthedocs.org#2708
agjohnson added a commit that referenced this issue May 3, 2017
This takes the underlying `searchtools.js_t` out of the Sphinx distribution
path, patches it, and then fills the context and parses it as a templated
javascript file. This allows us to remove the script initialization on all
versions of this file.

The initialization block on `searchtools.js_t` has not changed in 10 years, so
this method should be safe. If the block changes in the future, tests will grab
this as we add new versions of Sphinx to our testing.

This reorganizes some repetitive code and cleans up a few other pieces as well:

File copying is linked to the standard `copy_static_files` that is run from
the builder. Running from an event on build finished was producing files without
the template context. This is because `build-finished` is always triggered, but
the static files are not always copied (and therefore did not have the same
template context?)

Fixes #25
Refs readthedocs/readthedocs.org#2708
@agjohnson agjohnson self-assigned this May 3, 2017
agjohnson added a commit that referenced this issue May 3, 2017
This takes the underlying searchtools.js_t out of the Sphinx distribution
path, patches it, and then fills the context and parses it as a templated
javascript file. This allows us to remove the script initialization on all
versions of this file.

The initialization block on searchtools.js_t has not changed in 10 years, so
this method should be safe. If the block changes in the future, tests will grab
this as we add new versions of Sphinx to our testing.

This reorganizes some repetitive code and cleans up a few other pieces as well:

File copying is linked to the standard copy_static_files that is run from
the builder. Running from an event on build finished was producing files without
the template context. This is because build-finished is always triggered, but
the static files are not always copied (and therefore did not have the same
template context?)

Fixes #25
Refs readthedocs/readthedocs.org#2708
agjohnson added a commit that referenced this issue May 10, 2017
This resolves #25, which caused a problem with Sphinx 1.5
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

1 participant