summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Velez <erickvelez7@gmail.com>2025-11-21 11:32:16 -0800
committerGitHub <noreply@github.com>2025-11-21 11:32:16 -0800
commit52f9a57b2961da168b2a5ffe9eee687fe9068c2b (patch)
treef1a94e87556d221df2ed16c5d9374dade1969fd6
parentebb04b2b4c38e6bb7b6068f3474a8e8edf912f4d (diff)
[clang-doc] Fix `</section>` mismatch in the namespace template (#168966)
A `</section>` tag wasn't inside the `{{#HasRecords}}` Mustache tag, which caused a mismatch if there weren't any records to render.
-rw-r--r--clang-tools-extra/clang-doc/assets/namespace-template.mustache2
-rw-r--r--clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp16
2 files changed, 17 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-doc/assets/namespace-template.mustache b/clang-tools-extra/clang-doc/assets/namespace-template.mustache
index f4a35cfe4c79..614023b9f672 100644
--- a/clang-tools-extra/clang-doc/assets/namespace-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/namespace-template.mustache
@@ -97,8 +97,8 @@
</li>
{{/Records}}
</ul>
- {{/HasRecords}}
</section>
+ {{/HasRecords}}
</div>
</div>
</main>
diff --git a/clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp b/clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp
index ee8b844d1f7f..dfc81df13459 100644
--- a/clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp
+++ b/clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp
@@ -1,6 +1,7 @@
// RUN: rm -rf %t && mkdir -p %t
// RUN: clang-doc --format=mustache --output=%t --executor=standalone %s
// RUN: FileCheck %s < %t/html/MyNamespace/index.html
+// RUN: FileCheck %s < %t/html/GlobalNamespace/index.html --check-prefix=CHECK-GLOBAL
namespace MyNamespace {
class Foo;
@@ -13,3 +14,18 @@ namespace MyNamespace {
// CHECK-NEXT: </a>
// CHECK-NEXT: </li>
// CHECK-NEXT: </ul>
+
+// COM: Check that the empty global namespace doesn't contain tag mismatches.
+// CHECK-GLOBAL: <main>
+// CHECK-GLOBAL-NEXT: <div class="container">
+// CHECK-GLOBAL-NEXT: <div class="sidebar">
+// CHECK-GLOBAL-NEXT: <h2> </h2>
+// CHECK-GLOBAL-NEXT: <ul>
+// CHECK-GLOBAL-NEXT: </ul>
+// CHECK-GLOBAL-NEXT: </div>
+// CHECK-GLOBAL-NEXT: <div class="resizer" id="resizer"></div>
+// CHECK-GLOBAL-NEXT: <div class="content">
+// CHECK-GLOBAL-EMPTY:
+// CHECK-GLOBAL-NEXT: </div>
+// CHECK-GLOBAL-NEXT: </div>
+// CHECK-GLOBAL-NEXT: </main>