Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit bc6a51a

Browse files
authored
Merge branch 'master' into improve-parallelMap
2 parents 4cc21ff + c757fff commit bc6a51a

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
#62 by @victor-pavlychko.
1919
- Fixed rendering of type relationships section when no graph data is available.
2020
#62 by @victor-pavlychko.
21+
- Fixed rendering of protocol requirements in the HTML version.
22+
#76 by @victor-pavlychko.
2123

2224

2325
## [1.0.0-beta.2] - 2020-04-08

Sources/swift-doc/Supporting Types/Components/Relationships.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct Relationships: Component {
9595
return #"""
9696
<section id="relationships">
9797
<h2 hidden>Relationships</h2>
98-
\#(graphHTML.flatMap { graphHTML in
98+
\#(graphHTML.flatMap { (graphHTML) -> HypertextLiteral.HTML in
9999
return #"""
100100
<figure>
101101
\#(graphHTML)

Sources/swift-doc/Supporting Types/Components/Requirements.swift

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ struct Requirements: Component {
1313
self.module = module
1414
}
1515

16+
var sections: [(title: String, requirements: [Symbol])] {
17+
return [
18+
("Requirements", module.interface.requirements(of: symbol)),
19+
("Optional Requirements", module.interface.optionalRequirements(of: symbol))
20+
].filter { !$0.requirements.isEmpty }
21+
}
22+
1623
// MARK: - Component
1724

1825
var fragment: Fragment {
19-
let sections: [(title: String, requirements: [Symbol])] = [
20-
("Requirements", module.interface.requirements(of: symbol)),
21-
("Optional Requirements", module.interface.optionalRequirements(of: symbol))
22-
].filter { !$0.requirements.isEmpty}
2326
guard !sections.isEmpty else { return Fragment { "" } }
2427

2528
return Fragment {
@@ -37,7 +40,26 @@ struct Requirements: Component {
3740

3841
var html: HypertextLiteral.HTML {
3942
return #"""
43+
\#(sections.map { section -> HypertextLiteral.HTML in
44+
#"""
45+
<section id=\#(section.title.lowercased())>
46+
<h2>\#(section.title)</h2>
47+
48+
\#(section.requirements.map { member -> HypertextLiteral.HTML in
49+
let descriptor = String(describing: type(of: symbol.api)).lowercased()
4050

51+
return #"""
52+
<div role="article" class="\#(descriptor)" id=\#(member.id.description.lowercased().replacingOccurrences(of: " ", with: "-"))>
53+
<h3>
54+
<code>\#(softbreak(member.name))</code>
55+
</h3>
56+
\#(Documentation(for: member, in: module).html)
57+
</div>
58+
"""#
59+
})
60+
</section>
61+
"""#
62+
})
4163
"""#
4264
}
4365
}

0 commit comments

Comments
 (0)