Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: kernel_include.py: remove line numbers from parsed-literal

When parsed-literal directive is added to rawtext, while cross
references will be properly displayed, Sphinx will ignore
line numbers. So, it is not worth adding them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/b484fe5fcbf6e5217f112f205fbf54f0bbc3dcca.1755872208.git.mchehab+huawei@kernel.org

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
4aa578f9 01dba168

+15 -4
+15 -4
Documentation/sphinx/kernel_include.py
··· 171 171 if 'warn-broken' in self.options: 172 172 env._xref_files.add(path) 173 173 174 - if "toc" in self.options: 175 - rawtext = parser.gen_toc() 176 - else: 174 + if "toc" not in self.options: 175 + 177 176 rawtext = ".. parsed-literal::\n\n" + parser.gen_output() 178 177 self.apply_range(rawtext) 179 178 180 - title = os.path.basename(path) 179 + include_lines = statemachine.string2lines(rawtext, tab_width, 180 + convert_whitespace=True) 181 + 182 + # Sphinx always blame the ".. <directive>", so placing 183 + # line numbers here won't make any difference 184 + 185 + self.state_machine.insert_input(include_lines, path) 186 + return [] 187 + 188 + # TOC output is a ReST file, not a literal. So, we can add line 189 + # numbers 190 + 191 + rawtext = parser.gen_toc() 181 192 182 193 include_lines = statemachine.string2lines(rawtext, tab_width, 183 194 convert_whitespace=True)