Re: [PATCH 2/8] docs: kernel_{abi,feat}.py: use doc.current_source

From
Jani Nikula <hidden>
Date
2024-02-06 08:49:53
Reply to
Vegard Nossum, 2024-02-05
On Mon, 05 Feb 2024, Vegard Nossum [off-list ref] wrote:
It probably doesn't matter a whole lot what we actually pass here,
but the .rst being processed seems most appropriate to me.
But it's not the actual .rst file being parsed here. It's something
originating from some oher file and processed in between. The kernel-doc
extension takes care to map the parsing errors in source code comments
to the right source file and line, which is where the problem is, not in
the .rst file.

The line numbers in the error messages will be adjusted according to the
ViewList. So I don't think you'll get messages that actually point at
line where the directive is either.

Please experiment with some errors injected to see what the output will
be.


BR,
Jani.
quoted hunk ↗ jump to hunk
This presumably gets used by Shpinx to record/report where each line
of .rst source originates.

Signed-off-by: Vegard Nossum <redacted>
---
 Documentation/sphinx/kernel_abi.py  | 2 +-
 Documentation/sphinx/kernel_feat.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
index 5911bd0d7965..288f26097569 100644
--- a/Documentation/sphinx/kernel_abi.py
+++ b/Documentation/sphinx/kernel_abi.py
@@ -88,7 +88,7 @@ class KernelCmd(Directive):
             args.append('--rst-source')
 
         lines = subprocess.check_output(args, cwd=os.path.dirname(doc.current_source)).decode('utf-8')
-        nodeList = self.nestedParse(lines, self.arguments[0])
+        nodeList = self.nestedParse(lines, doc.current_source)
         return nodeList
 
     def nestedParse(self, lines, fname):
diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py
index 03ace5f01b5c..3493621d1a4e 100644
--- a/Documentation/sphinx/kernel_feat.py
+++ b/Documentation/sphinx/kernel_feat.py
@@ -109,7 +109,7 @@ class KernelFeat(Directive):
             else:
                 out_lines += line + "\n"
 
-        nodeList = self.nestedParse(out_lines, self.arguments[0])
+        nodeList = self.nestedParse(out_lines, doc.current_source)
         return nodeList
 
     def nestedParse(self, lines, fname):
-- 
Jani Nikula, Intel
Thread (32 messages) 32 messages, 6 authors, last reply 2024-02-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help