diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-06-02 14:59:18 +0200 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2016-06-03 11:31:37 +0300 |
commit | 16e161c8c67ac3b27cfc096cf07af9bceb144707 (patch) | |
tree | 9b352ffff0fa3ef266bbe388ec1c22f4b968f999 /Documentation/sphinx/kernel-doc.py | |
parent | ebff7f929b2a72fa614f5e95fd34c56c82ac9c36 (diff) |
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: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'Documentation/sphinx/kernel-doc.py')
-rw-r--r-- | Documentation/sphinx/kernel-doc.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Documentation/sphinx/kernel-doc.py b/Documentation/sphinx/kernel-doc.py index 9fc2c27916a9..bd422870101e 100644 --- a/Documentation/sphinx/kernel-doc.py +++ b/Documentation/sphinx/kernel-doc.py @@ -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))) |