File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 37
37
from docutils .statemachine import ViewList
38
38
from docutils .parsers .rst import directives
39
39
from sphinx .util .compat import Directive
40
+ from sphinx .ext .autodoc import AutodocReporter
40
41
41
42
class KernelDocDirective (Directive ):
42
43
"""Extract kernel-doc comments from the specified file"""
@@ -117,12 +118,17 @@ def run(self):
117
118
lineoffset += 1
118
119
119
120
node = nodes .section ()
120
- node .document = self .state .document
121
- self .state .nested_parse (result , self .content_offset , node )
121
+ buf = self .state .memo .title_styles , self .state .memo .section_level , self .state .memo .reporter
122
+ self .state .memo .reporter = AutodocReporter (result , self .state .memo .reporter )
123
+ self .state .memo .title_styles , self .state .memo .section_level = [], 0
124
+ try :
125
+ self .state .nested_parse (result , 0 , node , match_titles = 1 )
126
+ finally :
127
+ self .state .memo .title_styles , self .state .memo .section_level , self .state .memo .reporter = buf
122
128
123
129
return node .children
124
130
125
- except Exception as e :
131
+ except Exception as e : # pylint: disable=W0703
126
132
env .app .warn ('kernel-doc \' %s\' processing failed with: %s' %
127
133
(" " .join (cmd ), str (e )))
128
134
return [nodes .error (None , nodes .paragraph (text = "kernel-doc missing" ))]
You can’t perform that action at this time.
0 commit comments