History

docs: sphinx/kernel_abi: properly split lines

Sphinx doesn't like to have lines split with str.split("\n"). Instead, it uses its own splitter, with handles line breaks the way Spinx expects. Not using it cause issues at the output files.

Mauro Carvalho Chehab committed 1 year ago

Commit cc93e481 parent aea5e521 file · +3 −2Browse files

Unified · Split

Documentation/sphinx/kernel_abi.py+3−2
@@ -36,7 +36,7 @@ import os · 35 unmodified lines
3636 import re
3737 import sys
3838
39−from docutils import nodes
39+from docutils import nodes, statemachine
4040 from docutils.statemachine import ViewList
4141 from docutils.parsers.rst import directives, Directive
4242 from sphinx.util.docutils import switch_source_input
@@ -105,7 +105,8 @@ class KernelCmd(Directive): · 62 unmodified lines
105105 old_f = fname
106106 n = 0
107107 for msg, f, ln in self.parser.doc():
108− msg_list = msg.split("\n")
108+ msg_list = statemachine.string2lines(msg, tab_width,
109+ convert_whitespace=True)
109110 if "debug" in self.options:
110111 lines = [
111112 "", "", ".. code-block:: rst",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t