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

Make search compatible with sphinx 2.2.1 #6804

Merged
merged 5 commits into from Mar 30, 2020
Merged

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Mar 23, 2020

We are relying on FILE_SUFFIX,
but we were relying on a bug actually sphinx-doc/sphinx#6741

This is compatible with older and new versions.

This is also related that we don't save the real full path when
indexing.

def get_link(self, obj):
projects_url = self.context.get('projects_url')
if projects_url:
docs_url = projects_url[obj.project]
return docs_url + obj.path

Fixes #6801

We are relying on FILE_SUFFIX,
but we were relying on a bug actually sphinx-doc/sphinx#6741

This is compatible with older and new versions.

This is also related that we don't save the real full path when
indexing.

https://github.com/readthedocs/readthedocs.org/blob/24ca737e3f5c0df359801a8dede6519f67a70cb6/readthedocs/search/api.py#L34-L38

Fixes #6801
Copy link
Member

@ericholscher ericholscher left a comment

Annoying, but this makes sense 👍

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

@humitos humitos Mar 26, 2020

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

@stsewd stsewd Mar 26, 2020

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)

@ericholscher ericholscher merged commit ef680d1 into master Mar 30, 2020
2 checks passed
@ericholscher ericholscher deleted the fix-search-sphinx-2.1 branch Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants