@@ -166,7 +166,8 @@ public class OutOfProcessReferenceResolver: ExternalDocumentationSource, GlobalE
166
166
url: resolvedInformation. url. path,
167
167
kind: kind,
168
168
role: role,
169
- fragments: resolvedInformation. declarationFragments? . declarationFragments. map { DeclarationRenderSection . Token ( fragment: $0, identifier: nil ) } ,
169
+ fragments: resolvedInformation. subHeadingDeclarationFragments? . declarationFragments
170
+ . map { DeclarationRenderSection . Token ( fragment: $0, identifier: nil ) } ,
170
171
isBeta: resolvedInformation. isBeta,
171
172
isDeprecated: ( resolvedInformation. platforms ?? [ ] ) . contains ( where: { $0. deprecated != nil } ) ,
172
173
images: resolvedInformation. topicImages ?? [ ]
@@ -182,7 +183,7 @@ public class OutOfProcessReferenceResolver: ExternalDocumentationSource, GlobalE
182
183
. init( traits: variant. traits, patch: [ . replace( value: [ . text( abstract) ] ) ] )
183
184
)
184
185
}
185
- if let declarationFragments = variant. declarationFragments {
186
+ if let declarationFragments = variant. subHeadingDeclarationFragments {
186
187
renderReference. fragmentsVariants. variants. append (
187
188
. init( traits: variant. traits, patch: [ . replace( value: declarationFragments? . declarationFragments. map { DeclarationRenderSection . Token ( fragment: $0, identifier: nil ) } ) ] )
188
189
)
@@ -577,7 +578,11 @@ extension OutOfProcessReferenceResolver {
577
578
public let platforms : [ PlatformAvailability ] ?
578
579
/// Information about the resolved declaration fragments, if any.
579
580
public let declarationFragments : DeclarationFragments ?
580
-
581
+ /// Information about the resolved abbreviated declaration fragments, if any.
582
+ ///
583
+ /// They are used for displaying in contexts where the full declaration fragments would be too verbose, like in the Topics section or the navigation index.
584
+ public let subHeadingDeclarationFragments : DeclarationFragments ?
585
+
581
586
// We use the real types here because they're Codable and don't have public member-wise initializers.
582
587
583
588
/// Platform availability for a resolved symbol reference.
@@ -620,6 +625,7 @@ extension OutOfProcessReferenceResolver {
620
625
/// - availableLanguages: The languages where the resolved node is available.
621
626
/// - platforms: The platforms and their versions where the resolved node is available, if any.
622
627
/// - declarationFragments: The resolved declaration fragments, if any.
628
+ /// - subHeadingDeclarationFragments: The abbreviated resolved declaration fragments, if any.
623
629
/// - topicImages: Images that are used to represent the summarized element.
624
630
/// - references: References used in the content of the summarized element.
625
631
/// - variants: The variants of content for this resolver information.
@@ -632,6 +638,7 @@ extension OutOfProcessReferenceResolver {
632
638
availableLanguages: Set < SourceLanguage > ,
633
639
platforms: [ PlatformAvailability ] ? = nil ,
634
640
declarationFragments: DeclarationFragments ? = nil ,
641
+ subHeadingDeclarationFragments: DeclarationFragments ? = nil ,
635
642
topicImages: [ TopicImage ] ? = nil ,
636
643
references: [ any RenderReference ] ? = nil ,
637
644
variants: [ Variant ] ? = nil
@@ -644,6 +651,7 @@ extension OutOfProcessReferenceResolver {
644
651
self . availableLanguages = availableLanguages
645
652
self . platforms = platforms
646
653
self . declarationFragments = declarationFragments
654
+ self . subHeadingDeclarationFragments = subHeadingDeclarationFragments
647
655
self . topicImages = topicImages
648
656
self . references = references
649
657
self . variants = variants
@@ -675,7 +683,12 @@ extension OutOfProcessReferenceResolver {
675
683
///
676
684
/// If the resolver information has a declaration but the variant doesn't, this property will be `Optional.some(nil)`.
677
685
public let declarationFragments : VariantValue < DeclarationFragments ? >
678
-
686
+ /// The abbreviated declaration fragments of the variant or `nil` if the declaration is the same as the resolved information.
687
+ ///
688
+ /// They are used for displaying in contexts where the full declaration fragments would be too verbose, like in the Topics section or the navigation index.
689
+ /// If the resolver information has a declaration but the variant doesn't, this property will be `Optional.some(nil)`.
690
+ public let subHeadingDeclarationFragments : VariantValue < DeclarationFragments ? >
691
+
679
692
/// Creates a new resolved information variant with the values that are different from the resolved information values.
680
693
///
681
694
/// - Parameters:
@@ -686,14 +699,16 @@ extension OutOfProcessReferenceResolver {
686
699
/// - abstract: The resolved (plain text) abstract.
687
700
/// - language: The resolved language.
688
701
/// - declarationFragments: The resolved declaration fragments, if any.
702
+ /// - subHeadingDeclarationFragments: The resolved abbreviated declaration fragments, if any.
689
703
public init (
690
704
traits: [ RenderNode . Variant . Trait ] ,
691
705
kind: VariantValue < DocumentationNode . Kind > = nil ,
692
706
url: VariantValue < URL > = nil ,
693
707
title: VariantValue < String > = nil ,
694
708
abstract: VariantValue < String > = nil ,
695
709
language: VariantValue < SourceLanguage > = nil ,
696
- declarationFragments: VariantValue < DeclarationFragments ? > = nil
710
+ declarationFragments: VariantValue < DeclarationFragments ? > = nil ,
711
+ subHeadingDeclarationFragments: VariantValue < DeclarationFragments ? > = nil
697
712
) {
698
713
self . traits = traits
699
714
self . kind = kind
@@ -702,6 +717,7 @@ extension OutOfProcessReferenceResolver {
702
717
self . abstract = abstract
703
718
self . language = language
704
719
self . declarationFragments = declarationFragments
720
+ self . subHeadingDeclarationFragments = subHeadingDeclarationFragments
705
721
}
706
722
}
707
723
}
@@ -717,6 +733,7 @@ extension OutOfProcessReferenceResolver.ResolvedInformation {
717
733
case availableLanguages
718
734
case platforms
719
735
case declarationFragments
736
+ case subHeadingDeclarationFragments
720
737
case topicImages
721
738
case references
722
739
case variants
@@ -733,6 +750,8 @@ extension OutOfProcessReferenceResolver.ResolvedInformation {
733
750
availableLanguages = try container. decode ( Set< SourceLanguage> . self , forKey: . availableLanguages)
734
751
platforms = try container. decodeIfPresent ( [ OutOfProcessReferenceResolver . ResolvedInformation . PlatformAvailability ] . self, forKey: . platforms)
735
752
declarationFragments = try container. decodeIfPresent ( OutOfProcessReferenceResolver . ResolvedInformation. DeclarationFragments. self, forKey: . declarationFragments)
753
+ subHeadingDeclarationFragments = try container
754
+ . decodeIfPresent ( OutOfProcessReferenceResolver . ResolvedInformation. DeclarationFragments. self, forKey: . subHeadingDeclarationFragments)
736
755
topicImages = try container. decodeIfPresent ( [ TopicImage ] . self, forKey: . topicImages)
737
756
references = try container. decodeIfPresent ( [ CodableRenderReference ] . self, forKey: . references) . map { decodedReferences in
738
757
decodedReferences. map ( \. reference)
@@ -752,6 +771,7 @@ extension OutOfProcessReferenceResolver.ResolvedInformation {
752
771
try container. encode ( self . availableLanguages, forKey: . availableLanguages)
753
772
try container. encodeIfPresent ( self . platforms, forKey: . platforms)
754
773
try container. encodeIfPresent ( self . declarationFragments, forKey: . declarationFragments)
774
+ try container. encodeIfPresent ( self . subHeadingDeclarationFragments, forKey: . subHeadingDeclarationFragments)
755
775
try container. encodeIfPresent ( self . topicImages, forKey: . topicImages)
756
776
try container. encodeIfPresent ( references? . map { CodableRenderReference ( $0) } , forKey: . references)
757
777
try container. encodeIfPresent ( self . variants, forKey: . variants)
0 commit comments