File: mkdocs-fix-generate_api.py-s-edit_path.patch

package info (click to toggle)
python-xsdata 26.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,200 kB
  • sloc: python: 31,234; xml: 422; makefile: 20; sh: 6
file content (26 lines) | stat: -rw-r--r-- 1,077 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: Faidon Liambotis <paravoid@debian.org>
Date: Mon, 16 Feb 2026 00:04:16 +0200
Subject: mkdocs: fix generate_api.py's edit_path

Fix the edit_path to be relative, rather than hardcode the build
directory, and to point to the proper URL in the GitHub repository.
---
 docs/scripts/generate_api.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/docs/scripts/generate_api.py b/docs/scripts/generate_api.py
index 4d59a62..dc792ca 100644
--- a/docs/scripts/generate_api.py
+++ b/docs/scripts/generate_api.py
@@ -23,7 +23,10 @@ for path in sorted(src.rglob("*.py")):
         identifier = ".".join(parts)
         print("::: xsdata." + identifier, file=fd)
 
-    mkdocs_gen_files.set_edit_path(full_doc_path, path)
+    # point edit path to the .py file location. Given edit_uri is set to be
+    # docs/, we need to go one-level up and into xsdata for the source tree
+    edit_path = "../xsdata/" / path.relative_to(src)
+    mkdocs_gen_files.set_edit_path(full_doc_path, edit_path)
 
 
 with mkdocs_gen_files.open("api/SUMMARY.md", "w") as nav_file: