mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in RelentlessIdiot/sphinx (pull request #149)
Fix #1203: Do not append space to unknown field names.
This commit is contained in:
commit
1a99c74e4b
@ -219,7 +219,9 @@ class DocFieldTransformer(object):
|
|||||||
if typedesc is None or typedesc.has_arg != bool(fieldarg):
|
if typedesc is None or typedesc.has_arg != bool(fieldarg):
|
||||||
# either the field name is unknown, or the argument doesn't
|
# either the field name is unknown, or the argument doesn't
|
||||||
# match the spec; capitalize field name and be done with it
|
# match the spec; capitalize field name and be done with it
|
||||||
new_fieldname = fieldtype.capitalize() + ' ' + fieldarg
|
new_fieldname = fieldtype[0:1].upper() + fieldtype[1:]
|
||||||
|
if fieldarg:
|
||||||
|
new_fieldname = new_fieldname + ' ' + fieldarg
|
||||||
fieldname[0] = nodes.Text(new_fieldname)
|
fieldname[0] = nodes.Text(new_fieldname)
|
||||||
entries.append(field)
|
entries.append(field)
|
||||||
continue
|
continue
|
||||||
|
@ -7,6 +7,32 @@ Testing object descriptions
|
|||||||
|
|
||||||
.. function:: func_without_body()
|
.. function:: func_without_body()
|
||||||
|
|
||||||
|
.. function:: func_with_unknown_field()
|
||||||
|
|
||||||
|
: :
|
||||||
|
|
||||||
|
: empty field name:
|
||||||
|
|
||||||
|
:field_name:
|
||||||
|
|
||||||
|
:field_name all lower:
|
||||||
|
|
||||||
|
:FIELD_NAME:
|
||||||
|
|
||||||
|
:FIELD_NAME ALL CAPS:
|
||||||
|
|
||||||
|
:Field_Name:
|
||||||
|
|
||||||
|
:Field_Name All Word Caps:
|
||||||
|
|
||||||
|
:Field_name:
|
||||||
|
|
||||||
|
:Field_name First word cap:
|
||||||
|
|
||||||
|
:FIELd_name:
|
||||||
|
|
||||||
|
:FIELd_name PARTial caps:
|
||||||
|
|
||||||
.. function:: func_noindex
|
.. function:: func_noindex
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
|
@ -196,6 +196,17 @@ HTML_XPATH = {
|
|||||||
'Testing object descriptions'),
|
'Testing object descriptions'),
|
||||||
(".//li[@class='toctree-l1']/a[@href='markup.html']",
|
(".//li[@class='toctree-l1']/a[@href='markup.html']",
|
||||||
'Testing various markup'),
|
'Testing various markup'),
|
||||||
|
# test unknown field names
|
||||||
|
(".//th[@class='field-name']", 'Field_name:'),
|
||||||
|
(".//th[@class='field-name']", 'Field_name all lower:'),
|
||||||
|
(".//th[@class='field-name']", 'FIELD_NAME:'),
|
||||||
|
(".//th[@class='field-name']", 'FIELD_NAME ALL CAPS:'),
|
||||||
|
(".//th[@class='field-name']", 'Field_Name:'),
|
||||||
|
(".//th[@class='field-name']", 'Field_Name All Word Caps:'),
|
||||||
|
(".//th[@class='field-name']", 'Field_name:'),
|
||||||
|
(".//th[@class='field-name']", 'Field_name First word cap:'),
|
||||||
|
(".//th[@class='field-name']", 'FIELd_name:'),
|
||||||
|
(".//th[@class='field-name']", 'FIELd_name PARTial caps:'),
|
||||||
# custom sidebar
|
# custom sidebar
|
||||||
(".//h4", 'Custom sidebar'),
|
(".//h4", 'Custom sidebar'),
|
||||||
# docfields
|
# docfields
|
||||||
|
Loading…
Reference in New Issue
Block a user