Skip to content

Make search compatible with sphinx 2.2.1 #6804

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

Merged
merged 5 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion readthedocs/core/static-src/core/js/doc-embed/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ function attach_elastic_search_query(data) {
}

// Creating the result from elements
var link = doc.link + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
var suffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
// Since sphinx 2.2.1 FILE_SUFFIX is .html for all builders,
// and there is a new BUILDER option.
if ('BUILDER' in DOCUMENTATION_OPTIONS && DOCUMENTATION_OPTIONS.BUILDER === 'readthedocsdirhtml') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to use .endswith('dirhtml') here? That way, we allow people using a different builder. See https://docs.readthedocs.io/en/stable/builds.html#writing-your-own-builder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That case will be only valid for a custom installation with their own builders, not sure if users have that level of customization (there are a lot of parts to change the code to make that work)

suffix = '';
}
var link = doc.link + suffix;

var item = $('<a>', {'href': link});

Expand Down
Loading