Skip to content

Commit 2af95b2

Browse files
authored
[libc][docs] Fix POSIX basedefs links for nested headers (#188738)
Fix broken POSIX basedefs links for nested headers in llvm-libc docs. The docgen script currently emits paths like `sys/wait.h.html`, but the Open Group uses `sys_wait.h.html`, for example: - https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_wait.h.html This updates nested-header link generation while leaving flat headers unchanged.
1 parent 22cfe6f commit 2af95b2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libc/utils/docgen/docgen.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ def print_functions_rst(header: Header, functions: Dict):
149149
print(" -")
150150

151151

152+
def posix_basedefs_url(header: Header) -> str:
153+
"""Return the Open Group basedefs URL for a header."""
154+
posix_header_name = header.name.replace("/", "_")
155+
return f"https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{posix_header_name}.html"
156+
157+
152158
def print_macros_rst(header: Header, macros: Dict):
153159
tbl_hdr = "Macros"
154160
print(tbl_hdr)
@@ -170,9 +176,7 @@ def print_macros_rst(header: Header, macros: Dict):
170176
print(" -")
171177

172178
if "in-latest-posix" in macros[name]:
173-
print(
174-
f" - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{header.name}.html>`__"
175-
)
179+
print(f" - `POSIX.1-2024 <{posix_basedefs_url(header)}>`__")
176180
else:
177181
print(" -")
178182
print()

0 commit comments

Comments
 (0)