Author: Erick Velez
Date: 2025-11-21T11:32:16-08:00
New Revision: 52f9a57b2961da168b2a5ffe9eee687fe9068c2b

URL: 
https://github.com/llvm/llvm-project/commit/52f9a57b2961da168b2a5ffe9eee687fe9068c2b
DIFF: 
https://github.com/llvm/llvm-project/commit/52f9a57b2961da168b2a5ffe9eee687fe9068c2b.diff

LOG: [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.

Added: 
    

Modified: 
    clang-tools-extra/clang-doc/assets/namespace-template.mustache
    clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp

Removed: 
    


################################################################################
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