[clang-tools-extra] [clang-doc] switched from using relative to absolute paths (PR #93281)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 29 23:58:31 PDT 2024


================
@@ -1,12 +1,19 @@
 function genLink(Ref) {
   var Path = `${window.location.protocol}//${window.location.host}/${Ref.Path}`;
+  var isFileProtocol = window.location.protocol.startsWith("file");
+  // we treat the file paths different depending on if we're
+  // serving via a http server or viewing from a local
+  if (isFileProtocol) {
+    Path = `${window.location.protocol}//${RootPath}/${Ref.Path}`;
+  }
   if (Ref.RefType !== "namespace") {
     if (Ref.Path === "") {
       Path = `${Path}${Ref.Name}.html`;
-    }
-    else {
+    } else {
       Path = `${Path}/${Ref.Name}.html`;
     }
+  } else {
+    Path = `${Path}/index.html`
   }
----------------
PeterChou1 wrote:

I don't think this will make a meaningful performance difference either way. Although I agree for readability purposes this is much more concise I've updated the code to reflect this

https://github.com/llvm/llvm-project/pull/93281


More information about the cfe-commits mailing list