https://github.com/evelez7 updated 
https://github.com/llvm/llvm-project/pull/168966

>From c82802e10b577fa39295f39fc7bfa122d4791031 Mon Sep 17 00:00:00 2001
From: Erick Velez <[email protected]>
Date: Thu, 20 Nov 2025 14:55:55 -0800
Subject: [PATCH] [clang-doc] Fix `</section>` mismatch in the namespace
 template

A `</section>` tag wasn't inside the `{{#HasRecords}}` Mustache tag, which 
caused a
mismatch if there weren't any records to render.
---
 .../clang-doc/assets/namespace-template.mustache |  2 +-
 .../clang-doc/mustache-separate-namespace.cpp    | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/assets/namespace-template.mustache 
b/clang-tools-extra/clang-doc/assets/namespace-template.mustache
index f4a35cfe4c79a..614023b9f6723 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 ee8b844d1f7f1..dfc81df134596 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>

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to