Lines Matching +full:self +full:-
1 # -*- coding: utf-8; mode: python -*-
2 # coding=utf-8
3 # SPDX-License-Identifier: GPL-2.0
6 kernel-abi
9 Implementation of the ``kernel-abi`` reST-directive.
12 :copyright: Copyright (C) 2016-2020 Mauro Carvalho Chehab
13 :maintained-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
16 The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the
21 .. code-block:: rst
23 .. kernel-abi:: <ABI directory location>
30 Inserts a code-block with the *raw* reST. Sometimes it is helpful to see
52 app.add_directive("kernel-abi", KernelCmd)
61 u"""KernelABI (``kernel-abi``) directive"""
73 def run(self): argument
74 doc = self.state.document
76 raise self.warning("docutils: file insertion disabled")
83 '--enable-lineno',
84 '--dir', os.path.join(srctree, 'Documentation', self.arguments[0]),
87 if 'rst' in self.options:
88 args.append('--rst-source')
90 … lines = subprocess.check_output(args, cwd=os.path.dirname(doc.current_source)).decode('utf-8')
91 nodeList = self.nestedParse(lines, self.arguments[0])
94 def nestedParse(self, lines, fname): argument
95 env = self.state.document.settings.env
99 if "debug" in self.options:
100 code_block = "\n\n.. code-block:: rst\n :linenos:\n"
105 line_regex = re.compile(r"^\.\. LINENO (\S+)\#([0-9]+)$")
119 self.do_parse(content, node)
128 ln = int(match.group(2)) - 1
132 kernellog.info(self.state.document.settings.env.app, "%s: parsed %i lines" % (fname, n))
135 self.do_parse(content, node)
139 def do_parse(self, content, node): argument
140 with switch_source_input(self.state, content):
141 self.state.nested_parse(content, 0, node, match_titles=1)