Skip to content

Commit 52f9a57

Browse files
authored
[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.
1 parent ebb04b2 commit 52f9a57

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

clang-tools-extra/clang-doc/assets/namespace-template.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797
</li>
9898
{{/Records}}
9999
</ul>
100-
{{/HasRecords}}
101100
</section>
101+
{{/HasRecords}}
102102
</div>
103103
</div>
104104
</main>

clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: rm -rf %t && mkdir -p %t
22
// RUN: clang-doc --format=mustache --output=%t --executor=standalone %s
33
// RUN: FileCheck %s < %t/html/MyNamespace/index.html
4+
// RUN: FileCheck %s < %t/html/GlobalNamespace/index.html --check-prefix=CHECK-GLOBAL
45

56
namespace MyNamespace {
67
class Foo;
@@ -13,3 +14,18 @@ namespace MyNamespace {
1314
// CHECK-NEXT: </a>
1415
// CHECK-NEXT: </li>
1516
// CHECK-NEXT: </ul>
17+
18+
// COM: Check that the empty global namespace doesn't contain tag mismatches.
19+
// CHECK-GLOBAL: <main>
20+
// CHECK-GLOBAL-NEXT: <div class="container">
21+
// CHECK-GLOBAL-NEXT: <div class="sidebar">
22+
// CHECK-GLOBAL-NEXT: <h2> </h2>
23+
// CHECK-GLOBAL-NEXT: <ul>
24+
// CHECK-GLOBAL-NEXT: </ul>
25+
// CHECK-GLOBAL-NEXT: </div>
26+
// CHECK-GLOBAL-NEXT: <div class="resizer" id="resizer"></div>
27+
// CHECK-GLOBAL-NEXT: <div class="content">
28+
// CHECK-GLOBAL-EMPTY:
29+
// CHECK-GLOBAL-NEXT: </div>
30+
// CHECK-GLOBAL-NEXT: </div>
31+
// CHECK-GLOBAL-NEXT: </main>

0 commit comments

Comments
 (0)