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.
Unified · Split
| @@ -36,7 +36,7 @@ import os · 35 unmodified lines | |||
| 36 | import re | 36 | import re |
| 37 | import sys | 37 | import sys |
| 38 | 38 | ||
| 39 | from docutils import nodes | 39 | from docutils import nodes, statemachine |
| 40 | from docutils.statemachine import ViewList | 40 | from docutils.statemachine import ViewList |
| 41 | from docutils.parsers.rst import directives, Directive | 41 | from docutils.parsers.rst import directives, Directive |
| 42 | from sphinx.util.docutils import switch_source_input | 42 | from sphinx.util.docutils import switch_source_input |
| @@ -105,7 +105,8 @@ class KernelCmd(Directive): · 62 unmodified lines | |||
| 105 | old_f = fname | 105 | old_f = fname |
| 106 | n = 0 | 106 | n = 0 |
| 107 | for msg, f, ln in self.parser.doc(): | 107 | 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) | ||
| 109 | if "debug" in self.options: | 110 | if "debug" in self.options: |
| 110 | lines = [ | 111 | lines = [ |
| 111 | "", "", ".. code-block:: rst", | 112 | "", "", ".. code-block:: rst", |