]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
docs: parser_yaml.py: fix backward compatibility with old docutils
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 19 Jun 2025 12:55:33 +0000 (14:55 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 12 Aug 2025 05:47:31 +0000 (07:47 +0200)
As reported by Akira, older docutils versions are not compatible
with the way some Sphinx versions send tab_width. Add a code to
address it.

Reported-by: Akira Yokosawa <akiyks@gmail.com>
Closes: https://lore.kernel.org/linux-doc/598b2cb7-2fd7-4388-96ba-2ddf0ab55d2a@gmail.com/
Tested-by: Akira Yokosawa <akiyks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Documentation/sphinx/parser_yaml.py

index 8288e2ff7c7cd4ce19dfcdac9af993c9b8856716..1602b31f448e7d5343852f98538797a892128b4f 100755 (executable)
@@ -77,6 +77,10 @@ class YamlParser(Parser):
 
                 result.append(line, document.current_source, lineoffset)
 
+            # Fix backward compatibility with docutils < 0.17.1
+            if "tab_width" not in vars(document.settings):
+                document.settings.tab_width = 8
+
             rst_parser = RSTParser()
             rst_parser.parse('\n'.join(result), document)