You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update LinkDestinationSummary to support multi-language content (#54)
* Move content into a source language variant structure
rdar://83716043
* Update LinkDestinationSummary to match spec changes
rdar://83716043
* Move `usr` out of variant substructure since it doesn't vary
* Update the spec to reduce the amount of duplicate data.
Now, the data continues to be encoded directly in the summary and each variant only sets the information that's different in that source language.
* Remove extra closing back-tick in documentation comments
* Use an alias to make optionality of variant properties more explicit
* Remove trait from main summary element to avoid using it as a language replacement
* Small documentation comment refinements
/// - In a paragraph of text, a link to this element will use the ``title`` as the link text and style the tile in code font if the ``kind`` is a type of symbol.
72
72
/// - In a task group, the the ``title`` and ``abstract-swift.property`` is displayed together to give more context about this element and the element may be marked as deprecated
73
73
/// based on the values of its ``platforms`` and other metadata about the current versions of the platforms.
74
+
///
75
+
/// The summary may include content that vary based on the source language. The content that is different in another source language is specified in a ``Variant``. Any property on the variant that is `nil` has the same value as the summarized element's value.
@@ -142,6 +144,54 @@ public struct LinkDestinationSummary: Codable, Equatable {
142
144
///
143
145
/// A web server can use this list of URLs to redirect to the current URL.
144
146
publicletredirects:[URL]?
147
+
148
+
/// A variant of content for a summarized element.
149
+
///
150
+
/// - Note: All properties except for ``traits`` are optional. If a property is `nil` it means that the value is the same as the summarized element's value.
151
+
publicstructVariant:Codable,Equatable{
152
+
/// The traits of the variant.
153
+
publiclettraits:[RenderNode.Variant.Trait]
154
+
155
+
/// A wrapper for variant values that can either be specified, meaning the variant has a custom value, or not, meaning the variant has the same value as the summarized element.
156
+
///
157
+
/// This alias is used to make the property declarations more explicit while at the same time offering the convenient syntax of optionals.
158
+
publictypealiasVariantValue=Optional
159
+
160
+
/// The kind of the variant or `nil` if the kind is the same as the summarized element.
0 commit comments