Skip to content

Commit f2b213d

Browse files
authored
Make a tiny simplification to the parameters HTML output (#1387)
1 parent bc197f4 commit f2b213d

File tree

3 files changed

+15
-45
lines changed

3 files changed

+15
-45
lines changed

Sources/DocCHTML/MarkdownRenderer+Parameters.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ package extension MarkdownRenderer {
7878
for parameter in parameterInfo {
7979
// name
8080
items.append(
81-
.element(named: "dt", children: [
82-
.element(named: "code", children: [.text(parameter.name)])
83-
])
81+
.element(named: "dt", children: [.text(parameter.name)])
8482
)
8583
// description
8684
items.append(
@@ -131,9 +129,7 @@ package extension MarkdownRenderer {
131129
let index = (offset + primaryOnlyIndices.count(where: { $0 < offset })) * 2
132130
items.insert(contentsOf: [
133131
// Name
134-
.element(named: "dt", children: [
135-
.element(named: "code", children: [.text(parameter.name)])
136-
], attributes: ["class": "\(secondary.language.id)-only"]),
132+
.element(named: "dt", children: [.text(parameter.name)], attributes: ["class": "\(secondary.language.id)-only"]),
137133
// Description
138134
.element(named: "dd", children: parameter.content.map { visit($0) }, attributes: ["class": "\(secondary.language.id)-only"])
139135
], at: index)

Tests/DocCCommandLineTests/FileWritingHTMLContentConsumerTests.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,11 @@ final class FileWritingHTMLContentConsumerTests: XCTestCase {
347347
</section>
348348
<h2>Parameters</h2>
349349
<dl>
350-
<dt>
351-
<code>first</code>
352-
</dt>
350+
<dt>first</dt>
353351
<dd>
354352
<p>Description of the <code>first</code> parameter.</p>
355353
</dd>
356-
<dt>
357-
<code>second</code>
358-
</dt>
354+
<dt>second</dt>
359355
<dd>
360356
<p>Description of the <code>second</code> parameter.</p>
361357
</dd>

Tests/DocCHTMLTests/MarkdownRenderer+PageElementsTests.swift

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,13 @@ struct MarkdownRenderer_PageElementsTests {
131131
<a href="#Parameters">Parameters</a>
132132
</h2>
133133
<dl>
134-
<dt>
135-
<code>First</code>
136-
</dt>
134+
<dt>First</dt>
137135
<dd>
138136
<p>
139137
Some <i>formatted</i> description with <code>code</code>
140138
</p>
141139
</dd>
142-
<dt>
143-
<code>Second</code>
144-
</dt>
140+
<dt>Second</dt>
145141
<dd>
146142
<p>
147143
Some <b>other</b> <i>formatted</i> description</p>
@@ -154,16 +150,12 @@ struct MarkdownRenderer_PageElementsTests {
154150
parameters.assertMatches(prettyFormatted: true, expectedXMLString: """
155151
<h2>Parameters</h2>
156152
<dl>
157-
<dt>
158-
<code>First</code>
159-
</dt>
153+
<dt>First</dt>
160154
<dd>
161155
<p>Some <i>formatted</i>description with <code>code</code>
162156
</p>
163157
</dd>
164-
<dt>
165-
<code>Second</code>
166-
</dt>
158+
<dt>Second</dt>
167159
<dd>
168160
<p>
169161
Some <b>other</b> <i>formatted</i> description</p>
@@ -194,27 +186,19 @@ struct MarkdownRenderer_PageElementsTests {
194186
<a href="#Parameters">Parameters</a>
195187
</h2>
196188
<dl>
197-
<dt>
198-
<code>FirstCommon</code>
199-
</dt>
189+
<dt>FirstCommon</dt>
200190
<dd>
201191
<p>Available in both languages</p>
202192
</dd>
203-
<dt class="swift-only">
204-
<code>SwiftOnly</code>
205-
</dt>
193+
<dt class="swift-only">SwiftOnly</dt>
206194
<dd class="swift-only">
207195
<p>Only available in Swift</p>
208196
</dd>
209-
<dt>
210-
<code>SecondCommon</code>
211-
</dt>
197+
<dt>SecondCommon</dt>
212198
<dd>
213199
<p>Also available in both languages</p>
214200
</dd>
215-
<dt class="occ-only">
216-
<code>ObjectiveCOnly</code>
217-
</dt>
201+
<dt class="occ-only">ObjectiveCOnly</dt>
218202
<dd class="occ-only">
219203
<p>Only available in Objective-C</p>
220204
</dd>
@@ -242,25 +226,19 @@ struct MarkdownRenderer_PageElementsTests {
242226
<a href="#Parameters">Parameters</a>
243227
</h2>
244228
<dl class="swift-only">
245-
<dt>
246-
<code>First</code>
247-
</dt>
229+
<dt>First</dt>
248230
<dd>
249231
<p>Some description</p>
250232
</dd>
251233
</dl>
252234
<dl class="data-only">
253-
<dt>
254-
<code>Third</code>
255-
</dt>
235+
<dt>Third</dt>
256236
<dd>
257237
<p>Some description</p>
258238
</dd>
259239
</dl>
260240
<dl class="occ-only">
261-
<dt>
262-
<code>Second</code>
263-
</dt>
241+
<dt>Second</dt>
264242
<dd>
265243
<p>Some description</p>
266244
</dd>

0 commit comments

Comments
 (0)