Repository navigation
rest: unescape field names - #183
Merged
Merged
Conversation
A backslash escape in a field's name, as in ":param \*\*kwargs:", was kept in the name. Drop it as docutils does, so the name is "**kwargs", in param, type and rtype fields alike. Compose escapes backslashes and asterisks in names again, which reads back the same and is what Sphinx expects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReST field names now drop their backslash escapes, as docutils reads them:
:param \*\*kwargs:gives the name**kwargsinstead of\*\*kwargs. This applies to the name in:param:-style fields,:type x:/:vartype x:(so the type still finds its param) and:rtype name:/:ytype name:.Compose escapes
\and*in names again, so**kwargsis written as:param \*\*kwargs:. That reads back the same, and it is what Sphinx wants, since a bare**kwargsin a field name is an unclosed strong-emphasis start. It also means a Google or Numpydoc docstring with*argsnow composes to ReST as\*args.Types, and names in
.. attribute::directives, are left as they were.Case diffs: 13 requests corpus cases (
requests.api.*andSession.*) now name**kwargsinstead of\*\*kwargs. New caserest/escaped_names_01.txtcovers params, a type field, a literal backslash and an rtype name, parsed and composed.Parity against origin/main: 38 of 29184 docstrings differ, case 32, generated 6. The generated ones only change in ReST compose, where a name with
*is now escaped. No docstring parses only in base, so no stdlib docstring newly makes strictparseraise.