File tree Expand file tree Collapse file tree 2 files changed +35
-13
lines changed
Sources/SwiftDocC/Model/Rendering
Tests/SwiftDocCTests/Rendering Expand file tree Collapse file tree 2 files changed +35
-13
lines changed Original file line number Diff line number Diff line change @@ -1350,22 +1350,20 @@ public struct RenderNodeTranslator: SemanticVisitor {
1350
1350
bundle: bundle,
1351
1351
renderContext: renderContext,
1352
1352
renderer: contentRenderer
1353
- ) {
1353
+ ) , !seeAlso . references . isEmpty {
1354
1354
contentCompiler. collectedTopicReferences. append ( contentsOf: seeAlso. references)
1355
- seeAlsoSections. append ( TaskGroupRenderSection (
1356
- title: seeAlso. title,
1357
- abstract: nil ,
1358
- discussion: nil ,
1359
- identifiers: seeAlso. references. map { $0. absoluteString } ,
1360
- generated: true
1361
- ) )
1355
+ seeAlsoSections. append (
1356
+ TaskGroupRenderSection (
1357
+ title: seeAlso. title,
1358
+ abstract: nil ,
1359
+ discussion: nil ,
1360
+ identifiers: seeAlso. references. map { $0. absoluteString } ,
1361
+ generated: true
1362
+ )
1363
+ )
1362
1364
}
1363
1365
1364
- if seeAlsoSections. isEmpty {
1365
- return nil
1366
- } else {
1367
- return seeAlsoSections
1368
- }
1366
+ return seeAlsoSections
1369
1367
} ?? . init( defaultValue: [ ] )
1370
1368
1371
1369
node. deprecationSummaryVariants = VariantCollection < [ RenderBlockContent ] ? > (
Original file line number Diff line number Diff line change @@ -990,6 +990,30 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
990
990
)
991
991
}
992
992
993
+ func testDoesNotEmitObjectiveCSeeAlsoIfEmpty( ) throws {
994
+ func makeSeeAlsoSection( destination: String ) -> SeeAlsoSection {
995
+ SeeAlsoSection ( content: [
996
+ UnorderedList (
997
+ ListItem ( Paragraph ( Link ( destination: destination) ) )
998
+ )
999
+ ] )
1000
+ }
1001
+
1002
+ try assertMultiVariantSymbol (
1003
+ configureSymbol: { symbol in
1004
+ symbol. seeAlsoVariants [ . swift] = makeSeeAlsoSection (
1005
+ destination: " doc://org.swift.docc.example/documentation/MyKit/MyProtocol "
1006
+ )
1007
+ } ,
1008
+ assertOriginalRenderNode: { renderNode in
1009
+ XCTAssertEqual ( renderNode. seeAlsoSections. count, 2 )
1010
+ } ,
1011
+ assertAfterApplyingVariant: { renderNode in
1012
+ XCTAssert ( renderNode. seeAlsoSections. isEmpty)
1013
+ }
1014
+ )
1015
+ }
1016
+
993
1017
func testDeprecationSummaryVariants( ) throws {
994
1018
try assertMultiVariantSymbol (
995
1019
configureSymbol: { symbol in
You can’t perform that action at this time.
0 commit comments