Skip to content

Commit e0c265d

Browse files
authored
[clang-doc] Fix whitespace issues in Mustache basic test (llvm#168491)
I found that the issues we've been seeing in the HTML whitespace/alignment are due to partials inserting their own whitespace and calling partials on indented lines or lines containing text already. This patch gets rid of unnecessary whitespace in the comment and function partials so that they are properly indented when inserted.
1 parent 609c88a commit e0c265d

File tree

4 files changed

+402
-506
lines changed

4 files changed

+402
-506
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
<h2>Public Methods</h2>
175175
<div>
176176
{{#PublicFunctions}}
177-
{{>FunctionPartial}}
177+
{{>FunctionPartial}}
178178
{{/PublicFunctions}}
179179
</div>
180180
</section>

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

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,61 @@
66
This file defines templates for generating comments
77
}}
88
{{#BriefComments}}
9-
<div>
10-
{{#.}}
11-
<p>{{TextComment}}</p>
12-
{{/.}}
13-
</div>
9+
<div>
10+
{{#.}}
11+
<p>{{TextComment}}</p>
12+
{{/.}}
13+
</div>
1414
{{/BriefComments}}
1515
{{#ParagraphComments}}
16-
<div>
17-
{{#.}}
18-
<p>{{TextComment}}</p>
19-
{{/.}}
20-
</div>
16+
<div>
17+
{{#.}}
18+
<p>{{TextComment}}</p>
19+
{{/.}}
20+
</div>
2121
{{/ParagraphComments}}
2222
{{#ParagraphComment}}
23-
{{#Children}}
24-
{{>Comments}}
25-
{{/Children}}
23+
{{#Children}}
24+
{{TextComment}}
25+
{{/Children}}
2626
{{/ParagraphComment}}
2727
{{#HasParamComments}}
28-
<h3>Parameters</h3>
29-
{{#ParamComments}}
30-
<div>
31-
<b>{{ParamName}}</b> {{#Explicit}}{{Direction}}{{/Explicit}} {{#Children}}{{>Comments}}{{/Children}}
32-
</div>
33-
{{/ParamComments}}
28+
<h3>Parameters</h3>
29+
{{#ParamComments}}
30+
<div>
31+
<b>{{ParamName}}</b> {{#Explicit}}{{Direction}}{{/Explicit}} {{#Children}}{{TextComment}}{{/Children}}
32+
</div>
33+
{{/ParamComments}}
3434
{{/HasParamComments}}
3535
{{#HasReturnComments}}
36-
<h3>Returns</h3>
37-
{{#ReturnComments}}
38-
{{#.}}
39-
<p>{{TextComment}}</p>
40-
{{/.}}
41-
{{/ReturnComments}}
36+
<h3>Returns</h3>
37+
{{#ReturnComments}}
38+
{{#.}}
39+
<p>{{TextComment}}</p>
40+
{{/.}}
41+
{{/ReturnComments}}
4242
{{/HasReturnComments}}
4343
{{#HasCodeComments}}
44-
<h3>Code</h3>
45-
{{#CodeComments}}
46-
<div>
47-
<pre class="code-block">
48-
<code>
49-
{{#.}}
44+
<h3>Code</h3>
45+
{{#CodeComments}}
46+
<div>
47+
<pre class="code-block">
48+
<code>
49+
{{#.}}
5050
{{.}}
51-
{{/.}}
52-
</code>
53-
</pre>
54-
</div>
55-
{{/CodeComments}}
51+
{{/.}}
52+
</code>
53+
</pre>
54+
</div>
55+
{{/CodeComments}}
5656
{{/HasCodeComments}}
5757
{{#HasThrowsComments}}
58-
<h3>Throws</h3>
59-
{{#ThrowsComments}}
60-
<div>
61-
<b>{{Exception}}</b> {{#Children}}{{TextComment}}{{/Children}}
62-
</div>
63-
{{/ThrowsComments}}
58+
<h3>Throws</h3>
59+
{{#ThrowsComments}}
60+
<div>
61+
<b>{{Exception}}</b> {{#Children}}{{TextComment}}{{/Children}}
62+
</div>
63+
{{/ThrowsComments}}
6464
{{/HasThrowsComments}}
6565
{{#BlockCommandComment}}
6666
<div class="block-command-comment__command">
@@ -74,8 +74,3 @@
7474
</div>
7575
</div>
7676
{{/BlockCommandComment}}
77-
{{#TextComment}}
78-
<div>
79-
<p>{{TextComment}}</p>
80-
</div>
81-
{{/TextComment}}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
<div class="delimiter-container">
99
<div id="{{USR}}">
1010
{{! Function Prototype }}
11-
<pre>
12-
<code class="language-cpp code-clang-doc">
13-
{{ReturnType.Name}} {{Name}} ({{#Params}}{{^End}}{{Type}} {{Name}}, {{/End}}{{#End}}{{Type}} {{Name}}{{/End}}{{/Params}})
14-
</code>
15-
</pre>
11+
<pre><code class="language-cpp code-clang-doc">{{ReturnType.Name}} {{Name}} ({{#Params}}{{^End}}{{Type}} {{Name}}, {{/End}}{{#End}}{{Type}} {{Name}}{{/End}}{{/Params}})</code></pre>
1612
{{! Function Comments }}
1713
{{#Description}}
1814
<div>

0 commit comments

Comments
 (0)