-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang-doc] Add a "Home" link to navbar #171900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: users/evelez7/clang-doc-index-page
Are you sure you want to change the base?
[clang-doc] Add a "Home" link to navbar #171900
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesThis patch removes the old buttons and adds a link to the homepage. Full diff: https://github.com/llvm/llvm-project/pull/171900.diff 3 Files Affected:
diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index 3fc89311749ad..1af555a5b772b 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -120,6 +120,13 @@ Error HTMLGenerator::setupTemplateResources(const ClangDocContext &CDCtx,
SCA->emplace_back(JsPath);
}
V.getAsObject()->insert({"Scripts", ScriptArr});
+ if (RelativeRootPath.empty()) {
+ RelativeRootPath = "";
+ } else {
+ sys::path::append(RelativeRootPath, "/index.html");
+ sys::path::native(RelativeRootPath, sys::path::Style::posix);
+ }
+ V.getAsObject()->insert({"Homepage", RelativeRootPath});
return Error::success();
}
diff --git a/clang-tools-extra/clang-doc/assets/navbar-template.mustache b/clang-tools-extra/clang-doc/assets/navbar-template.mustache
index 178d147a556d3..2767d5af86668 100644
--- a/clang-tools-extra/clang-doc/assets/navbar-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/navbar-template.mustache
@@ -8,10 +8,7 @@
<div class="navbar__menu">
<ul class="navbar__links">
<li class="navbar__item">
- <a href="/" class="navbar__link">Namespace</a>
- </li>
- <li class="navbar__item">
- <a href="/" class="navbar__link">Class</a>
+ <a href="{{Homepage}}" class="navbar__link">Home</a>
</li>
</ul>
</div>
diff --git a/clang-tools-extra/test/clang-doc/basic-project.mustache.test b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
index d406c9f297960..26e42280f3474 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
@@ -25,10 +25,7 @@ HTML-SHAPE: </div>
HTML-SHAPE: <div class="navbar__menu">
HTML-SHAPE: <ul class="navbar__links">
HTML-SHAPE: <li class="navbar__item">
-HTML-SHAPE: <a href="/" class="navbar__link">Namespace</a>
-HTML-SHAPE: </li>
-HTML-SHAPE: <li class="navbar__item">
-HTML-SHAPE: <a href="/" class="navbar__link">Class</a>
+HTML-SHAPE: <a href="../index.html" class="navbar__link">Home</a>
HTML-SHAPE: </li>
HTML-SHAPE: </ul>
HTML-SHAPE: </div>
@@ -135,10 +132,7 @@ HTML-CALC: </div>
HTML-CALC: <div class="navbar__menu">
HTML-CALC: <ul class="navbar__links">
HTML-CALC: <li class="navbar__item">
-HTML-CALC: <a href="/" class="navbar__link">Namespace</a>
-HTML-CALC: </li>
-HTML-CALC: <li class="navbar__item">
-HTML-CALC: <a href="/" class="navbar__link">Class</a>
+HTML-CALC: <a href="../index.html" class="navbar__link">Home</a>
HTML-CALC: </li>
HTML-CALC: </ul>
HTML-CALC: </div>
@@ -339,10 +333,7 @@ HTML-RECTANGLE: </div>
HTML-RECTANGLE: <div class="navbar__menu">
HTML-RECTANGLE: <ul class="navbar__links">
HTML-RECTANGLE: <li class="navbar__item">
-HTML-RECTANGLE: <a href="/" class="navbar__link">Namespace</a>
-HTML-RECTANGLE: </li>
-HTML-RECTANGLE: <li class="navbar__item">
-HTML-RECTANGLE: <a href="/" class="navbar__link">Class</a>
+HTML-RECTANGLE: <a href="../index.html" class="navbar__link">Home</a>
HTML-RECTANGLE: </li>
HTML-RECTANGLE: </ul>
HTML-RECTANGLE: </div>
@@ -457,10 +448,7 @@ HTML-CIRCLE: </div>
HTML-CIRCLE: <div class="navbar__menu">
HTML-CIRCLE: <ul class="navbar__links">
HTML-CIRCLE: <li class="navbar__item">
-HTML-CIRCLE: <a href="/" class="navbar__link">Namespace</a>
-HTML-CIRCLE: </li>
-HTML-CIRCLE: <li class="navbar__item">
-HTML-CIRCLE: <a href="/" class="navbar__link">Class</a>
+HTML-CIRCLE: <a href="../index.html" class="navbar__link">Home</a>
HTML-CIRCLE: </li>
HTML-CIRCLE: </ul>
HTML-CIRCLE: </div>
|
5224012 to
9e214dd
Compare
00f3570 to
d54ed0d
Compare
🪟 Windows x64 Test Results
✅ The build succeeded and all tests passed. |
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
This patch removes the old buttons and adds a link to the homepage.
9e214dd to
655f299
Compare
d54ed0d to
24e5f13
Compare

This patch removes the old buttons and adds a link to the homepage.