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

Fix: parse_json also including html in titles #5970

merged 1 commit into from Jul 22, 2019


Copy link

@dojutsu-user dojutsu-user commented Jul 20, 2019

Some titles have html code in them:

parse_json was not yielding the text if title has backticks content.

@dojutsu-user dojutsu-user added this to In progress in In-doc search UI via automation Jul 20, 2019
@dojutsu-user dojutsu-user requested a review from ericholscher Jul 20, 2019
Copy link

@humitos humitos left a comment

Changes look good to me!

@@ -19,6 +19,9 @@ def test_h2_parsing(self):
self.assertEqual(data['path'], 'api')
self.assertEqual(data['sections'][1]['id'], 'a-basic-api-client-using-slumber')

# In api.fjson, title is in the form: A basic API client ``using slumber``
self.assertEqual(data['sections'][1]['title'], 'A basic API client using slumber')
Copy link

@humitos humitos Jul 22, 2019

In my test the quotes will still be there:

>>> pyquery.PyQuery('A basic API client ``using slumber``').text().replace('¶', '').strip()
'A basic API client ``using slumber``'

Copy link
Member Author

@dojutsu-user dojutsu-user Jul 22, 2019

When a text like this: Include ``404`` page is converted to html by sphinx. It is something like this: Include <code class=\"docutils literal notranslate\"><span class=\"pre\">404</span></code> page.

We were indexing this line as it is, because of which -- we are getting results with the html code -

It is something like this:

>>> import pyquery
>>> temp = 'Include <code class=\"docutils literal notranslate\"><span class=\"pre\">404</span></code> page'
>>> pyquery.PyQuery(temp).text().replace('¶', '').strip()
'Include 404 page' 

Copy link

@humitos humitos Jul 22, 2019

Thanks for clarifying this!

@ericholscher ericholscher merged commit 7049425 into readthedocs:master Jul 22, 2019
1 check passed
@dojutsu-user dojutsu-user deleted the fix-parse-json branch Jul 22, 2019
@dojutsu-user dojutsu-user moved this from In progress to Done in In-doc search UI Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
No open projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants