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
merged 1 commit into from
Jul 22, 2019
Merged

Fix: parse_json also including html in titles #5970

merged 1 commit into from
Jul 22, 2019

Conversation

dojutsu-user
Copy link
Member

Some titles have html code in them:

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

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

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
Member

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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 - http://docs.celeryproject.org/en/latest/search.html?q=utilities&check_keywords=yes&area=default

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
Member

Choose a reason for hiding this comment

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

Thanks for clarifying this!

@ericholscher ericholscher merged commit 7049425 into readthedocs:master Jul 22, 2019
@dojutsu-user dojutsu-user deleted the fix-parse-json branch July 22, 2019 16:36
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