Skip to content

Commit fb80d5d

Browse files
committed
[clang-doc] enable comments in class templates
The Mustache basic project has comments in its headers but the comments were not serialized. Now we serialize @brief and paragraph comments for classes and add that output to the basic project test.
1 parent f361dd7 commit fb80d5d

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@
128128
<section class="hero section-container">
129129
<div class="hero__title">
130130
<h1 class="hero__title-large">{{TagType}} {{Name}}</h1>
131-
{{#RecordComments}}
131+
{{#Description}}
132132
<div class="hero__subtitle">
133133
{{>Comments}}
134134
</div>
135-
{{/RecordComments}}
135+
{{/Description}}
136136
</div>
137137
</section>
138138
{{#HasPublicMembers}}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
66
This file defines templates for generating comments
77
}}
8-
{{#FullComment}}
8+
{{#BriefComments}}
99
{{#Children}}
1010
{{>Comments}}
1111
{{/Children}}
12-
{{/FullComment}}
12+
{{/BriefComments}}
13+
{{#ParagraphComments}}
14+
{{#Children}}
15+
{{>Comments}}
16+
{{/Children}}
17+
{{/ParagraphComments}}
1318
{{#ParagraphComment}}
1419
{{#Children}}
1520
{{>Comments}}

clang-tools-extra/test/clang-doc/basic-project.mustache.test

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ HTML-SHAPE: <div class="content">
6060
HTML-SHAPE: <section class="hero section-container">
6161
HTML-SHAPE: <div class="hero__title">
6262
HTML-SHAPE: <h1 class="hero__title-large">class Shape</h1>
63+
HTML-SHAPE: <div class="hero__subtitle">
64+
HTML-SHAPE: <div>
65+
HTML-SHAPE: <p> Abstract base class for shapes.</p>
66+
HTML-SHAPE: </div>
67+
HTML-SHAPE: <div>
68+
HTML-SHAPE: <p></p>
69+
HTML-SHAPE: </div>
70+
HTML-SHAPE: <div>
71+
HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
72+
HTML-SHAPE: </div>
73+
HTML-SHAPE: </div>
6374
HTML-SHAPE: </div>
6475
HTML-SHAPE: </section>
6576
HTML-SHAPE: <section id="PublicMethods" class="section-container">
@@ -172,6 +183,16 @@ HTML-CALC: <div class="content">
172183
HTML-CALC: <section class="hero section-container">
173184
HTML-CALC: <div class="hero__title">
174185
HTML-CALC: <h1 class="hero__title-large">class Calculator</h1>
186+
HTML-CALC: <div>
187+
HTML-CALC: <p> A simple calculator class.</p>
188+
HTML-CALC: </div>
189+
HTML-CALC: <div>
190+
HTML-CALC: <p></p>
191+
HTML-CALC: </div>
192+
HTML-CALC: <div>
193+
HTML-CALC: <p> Provides basic arithmetic operations.</p>
194+
HTML-CALC: </div>
195+
HTML-CALC: </div>
175196
HTML-CALC: </div>
176197
HTML-CALC: </section>
177198
HTML-CALC: <section id="PublicMembers" class="section-container">
@@ -300,6 +321,17 @@ HTML-RECTANGLE: <div class="content">
300321
HTML-RECTANGLE: <section class="hero section-container">
301322
HTML-RECTANGLE: <div class="hero__title">
302323
HTML-RECTANGLE: <h1 class="hero__title-large">class Rectangle</h1>
324+
HTML-RECTANGLE: <div class="hero__subtitle">
325+
HTML-RECTANGLE: <div>
326+
HTML-RECTANGLE: <p> Rectangle class derived from Shape.</p>
327+
HTML-RECTANGLE: </div>
328+
HTML-RECTANGLE: <div>
329+
HTML-RECTANGLE: <p></p>
330+
HTML-RECTANGLE: </div>
331+
HTML-RECTANGLE: <div>
332+
HTML-RECTANGLE: <p> Represents a rectangle with a given width and height.</p>
333+
HTML-RECTANGLE: </div>
334+
HTML-RECTANGLE: </div>
303335
HTML-RECTANGLE: </div>
304336
HTML-RECTANGLE: </section>
305337
HTML-RECTANGLE: <section id="PublicMethods" class="section-container">
@@ -395,6 +427,17 @@ HTML-CIRCLE: <div class="content">
395427
HTML-CIRCLE: <section class="hero section-container">
396428
HTML-CIRCLE: <div class="hero__title">
397429
HTML-CIRCLE: <h1 class="hero__title-large">class Circle</h1>
430+
HTML-CIRCLE: <div class="hero__subtitle">
431+
HTML-CIRCLE: <div>
432+
HTML-CIRCLE: <p> Circle class derived from Shape.</p>
433+
HTML-CIRCLE: </div>
434+
HTML-CIRCLE: <div>
435+
HTML-CIRCLE: <p></p>
436+
HTML-CIRCLE: </div>
437+
HTML-CIRCLE: <div>
438+
HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
439+
HTML-CIRCLE: </div>
440+
HTML-CIRCLE: </div>
398441
HTML-CIRCLE: </div>
399442
HTML-CIRCLE: </section>
400443
HTML-CIRCLE: <section id="PublicMethods" class="section-container">

0 commit comments

Comments
 (0)