@@ -48,25 +48,30 @@ def make_refs(role_name, name, node):
48
48
def handle_item (
49
49
fieldarg : str , content : list [nodes .inline ]
50
50
) -> nodes .definition_list_item :
51
- head = nodes .inline ()
52
- head += make_refs (self .rolename , fieldarg , addnodes .literal_strong )
51
+ term = nodes .term ()
52
+ term += make_refs (self .rolename , fieldarg , addnodes .literal_strong )
53
+
53
54
field_type = types .pop (fieldarg , None )
54
55
if field_type is not None :
55
- head += nodes .Text (" : " )
56
56
if len (field_type ) == 1 and isinstance (field_type [0 ], nodes .Text ):
57
57
(text_node ,) = field_type # type: nodes.Text
58
- head + = make_refs (
58
+ classifier_content = make_refs (
59
59
self .typerolename , text_node .astext (), addnodes .literal_emphasis
60
60
)
61
61
else :
62
- head += field_type
63
-
64
- # Contents are wrapped into a span for pydata sphinx theme
65
- head_wrap = nodes .term ("" , "" , head )
66
- body_content = nodes .paragraph ("" , "" , * content )
67
- body = nodes .definition ("" , body_content )
68
-
69
- return nodes .definition_list_item ("" , head_wrap , body )
62
+ classifier_content = field_type
63
+ term += [
64
+ # https://github.com/sphinx-doc/sphinx/issues/10815
65
+ nodes .Text (" " ),
66
+ # Sphinx tries to fixup classifiers without rawsource,
67
+ # but for this expects attributes we don’t have. Thus “×”.
68
+ nodes .classifier ("×" , "" , * classifier_content ),
69
+ ]
70
+
71
+ def_content = nodes .paragraph ("" , "" , * content )
72
+ definition = nodes .definition ("" , def_content )
73
+
74
+ return nodes .definition_list_item ("" , term , definition )
70
75
71
76
field_name = nodes .field_name ("" , self .label )
72
77
assert not self .can_collapse
0 commit comments