aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-06-02 08:59:18 -0400
committerJani Nikula <jani.nikula@intel.com>2016-06-03 04:31:37 -0400
commit16e161c8c67ac3b27cfc096cf07af9bceb144707 (patch)
tree9b352ffff0fa3ef266bbe388ec1c22f4b968f999
parentebff7f929b2a72fa614f5e95fd34c56c82ac9c36 (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>
-rw-r--r--Documentation/sphinx/kernel-doc.py11
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
32import sys 32import sys
33 33
34from docutils import nodes, statemachine 34from docutils import nodes, statemachine
35from docutils.statemachine import ViewList
35from docutils.parsers.rst import directives 36from docutils.parsers.rst import directives
36from sphinx.util.compat import Directive 37from sphinx.util.compat import Directive
37 38
@@ -92,8 +93,14 @@ class KernelDocDirective(Directive):
92 sys.stderr.write(err) 93 sys.stderr.write(err)
93 94
94 lines = statemachine.string2lines(out, tab_width, convert_whitespace=True) 95 lines = statemachine.string2lines(out, tab_width, convert_whitespace=True)
95 self.state_machine.insert_input(lines, source) 96 result = ViewList(lines, source)
96 return [] 97
98 node = nodes.section()
99 node.document = self.state.document
100 self.state.nested_parse(result, self.content_offset, node)
101
102 return node.children
103
97 except Exception as e: 104 except Exception as e:
98 env.app.warn('kernel-doc \'%s\' processing failed with: %s' % 105 env.app.warn('kernel-doc \'%s\' processing failed with: %s' %
99 (" ".join(cmd), str(e))) 106 (" ".join(cmd), str(e)))