提交 16e161c8 编写于 作者: D Daniel Vetter 提交者: Jani Nikula

doc/sphinx: Stop touching state_machine internals

Instead of just forcefully inserting our kernel-doc input and letting
the state machine stumble over it the recommended way is to create
ViewList, parse that and then return the list of parsed nodes.

Suggested by Jani.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: linux-doc@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
Signed-off-by: NJani Nikula <jani.nikula@intel.com>
上级 ebff7f92
......@@ -32,6 +32,7 @@ import subprocess
import sys
from docutils import nodes, statemachine
from docutils.statemachine import ViewList
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
......@@ -92,8 +93,14 @@ class KernelDocDirective(Directive):
sys.stderr.write(err)
lines = statemachine.string2lines(out, tab_width, convert_whitespace=True)
self.state_machine.insert_input(lines, source)
return []
result = ViewList(lines, source)
node = nodes.section()
node.document = self.state.document
self.state.nested_parse(result, self.content_offset, node)
return node.children
except Exception as e:
env.app.warn('kernel-doc \'%s\' processing failed with: %s' %
(" ".join(cmd), str(e)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册