@@ -28,6 +28,7 @@ class GrammarSnippetDirective(SphinxDirective):
2828    The content must be preceded by a blank line (like with most ReST 
2929    directives). 
3030    """ 
31+ 
3132    has_content  =  True 
3233    option_spec  =  {
3334        'group' : directives .unchanged ,
@@ -88,7 +89,7 @@ def make_snippet(directive, options, content):
8889        for  match  in  grammar_re .finditer (line ):
8990            # Handle text between matches 
9091            if  match .start () >  last_pos :
91-                 literal  +=  nodes .Text (line [last_pos : match .start ()])
92+                 literal  +=  nodes .Text (line [last_pos  :  match .start ()])
9293            last_pos  =  match .end ()
9394
9495            # Handle matches 
@@ -108,10 +109,16 @@ def make_snippet(directive, options, content):
108109                    domain  =  directive .env .domains ['std' ]
109110                    obj_name  =  f"{ group_name } { name }  
110111                    prefix  =  f'grammar-token-{ group_name }  
111-                     node_id  =  make_id (directive .env , directive .state .document , prefix , name )
112+                     node_id  =  make_id (
113+                         directive .env , directive .state .document , prefix , name 
114+                     )
112115                    name_node ['ids' ].append (node_id )
113-                     directive .state .document .note_implicit_target (name_node , name_node )
114-                     domain .note_object ('token' , obj_name , node_id , location = name_node )
116+                     directive .state .document .note_implicit_target (
117+                         name_node , name_node 
118+                     )
119+                     domain .note_object (
120+                         'token' , obj_name , node_id , location = name_node 
121+                     )
115122
116123                    text_node  =  nodes .Text (name )
117124                    name_node  +=  text_node 
@@ -134,7 +141,8 @@ def make_snippet(directive, options, content):
134141        literal  +=  nodes .Text (line [last_pos :] +  '\n ' )
135142
136143    node  =  nodes .paragraph (
137-         '' , '' ,
144+         '' ,
145+         '' ,
138146        literal ,
139147    )
140148
@@ -149,6 +157,7 @@ class CompatProductionList(SphinxDirective):
149157    It makes existing docs that use the ReST syntax look like grammar-snippet, 
150158    as much as possible. 
151159    """ 
160+ 
152161    has_content  =  False 
153162    required_arguments  =  1 
154163    optional_arguments  =  0 
@@ -177,5 +186,7 @@ def run(self):
177186
178187def  setup (app ):
179188    app .add_directive ('grammar-snippet' , GrammarSnippetDirective )
180-     app .add_directive_to_domain ('std' , 'productionlist' , CompatProductionList , override = True )
189+     app .add_directive_to_domain (
190+         'std' , 'productionlist' , CompatProductionList , override = True 
191+     )
181192    return  {'version' : '1.0' , 'parallel_read_safe' : True }
0 commit comments