[clang-tools-extra] clang-doc switched from using relative to absolute paths (PR #93281)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Fri May 24 10:24:09 PDT 2024
================
@@ -1,48 +1,22 @@
-// Append using posix-style a file name or directory to Base
-function append(Base, New) {
- if (!New)
- return Base;
- if (Base)
- Base += "/";
- Base += New;
- return Base;
-}
-
-// Get relative path to access FilePath from CurrentDirectory
-function computeRelativePath(FilePath, CurrentDirectory) {
- var Path = FilePath;
- while (Path) {
- if (CurrentDirectory == Path)
- return FilePath.substring(Path.length + 1);
- Path = Path.substring(0, Path.lastIndexOf("/"));
+function genLink(Ref) {
+ var Path = `${window.location.protocol}//${window.location.host}/${Ref.Path}`;
+ if (Ref.RefType !== "namespace") {
+ if (Ref.Path === "") {
+ Path = `${Path}${Ref.Name}.html`;
+ }
+ else {
+ Path = `${Path}/${Ref.Name}.html`;
+ }
}
- var Dir = CurrentDirectory;
- var Result = "";
- while (Dir) {
- if (Dir == FilePath)
- break;
- Dir = Dir.substring(0, Dir.lastIndexOf("/"));
- Result = append(Result, "..")
- }
- Result = append(Result, FilePath.substring(Dir.length))
- return Result;
-}
-
-function genLink(Ref, CurrentDirectory) {
- var Path = computeRelativePath(Ref.Path, CurrentDirectory);
- if (Ref.RefType == "namespace")
- Path = append(Path, "index.html");
- else
- Path = append(Path, Ref.Name + ".html")
-
- ANode = document.createElement("a");
+ ANode = document.createElement("a");
ANode.setAttribute("href", Path);
var TextNode = document.createTextNode(Ref.Name);
ANode.appendChild(TextNode);
return ANode;
}
+
----------------
ilovepi wrote:
nit: unrelated new line
https://github.com/llvm/llvm-project/pull/93281
More information about the cfe-commits
mailing list