Skip to content

Commit 4bc2659

Browse files
authored
Add DocC availability information to all directive pages (#704)
* Add in-source DocC availability info to directives rdar://110036742 * Correct two directive introduced versions
1 parent 8c447b0 commit 4bc2659

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+636
-50
lines changed

Sources/SwiftDocC/Semantics/Comment.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -18,6 +18,7 @@ import Markdown
1818
*/
1919
public final class Comment: Semantic, DirectiveConvertible {
2020
public static let directiveName = "Comment"
21+
public static let introducedVersion = "5.5"
2122
public let originalMarkup: BlockDirective
2223

2324
/// The comment content.

Sources/SwiftDocC/Semantics/ContentAndMedia.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -14,7 +14,7 @@ import Markdown
1414
/// A piece of media, such as an image or video, with an attached description.
1515
public final class ContentAndMedia: Semantic, DirectiveConvertible {
1616
public static let directiveName = "ContentAndMedia"
17-
17+
public static let introducedVersion = "5.5"
1818
public let originalMarkup: BlockDirective
1919

2020
/// The title of this slide.

Sources/SwiftDocC/Semantics/DirectiveConvertable.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public protocol DirectiveConvertible {
2020
*/
2121
static var directiveName: String { get }
2222

23+
/**
24+
The earliest release of Swift-DocC that supports this directive.
25+
*/
26+
static var introducedVersion: String { get }
27+
2328
/**
2429
The `BlockDirective` that was analyzed and converted to this ``Semantic`` object.
2530
*/

Sources/SwiftDocC/Semantics/DirectiveInfrastructure/DirectiveMirror.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ extension DirectiveMirror {
227227
var name: String {
228228
return type.directiveName
229229
}
230+
var introducedVersion: String {
231+
return type.introducedVersion
232+
}
230233

231234
let arguments: [ReflectedArgument]
232235

Sources/SwiftDocC/Semantics/Intro.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -15,6 +15,7 @@ import Markdown
1515
An introductory section for instructional pages.
1616
*/
1717
public final class Intro: Semantic, AutomaticDirectiveConvertible {
18+
public static let introducedVersion = "5.5"
1819
public let originalMarkup: BlockDirective
1920

2021
/// The title of the containing ``Tutorial``.

Sources/SwiftDocC/Semantics/Media/ImageMedia.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Markdown
1414
/// A block filled with an image.
1515
public final class ImageMedia: Semantic, Media, AutomaticDirectiveConvertible {
1616
public static let directiveName = "Image"
17-
17+
public static let introducedVersion = "5.5"
1818
public let originalMarkup: BlockDirective
1919

2020
@DirectiveArgumentWrapped(

Sources/SwiftDocC/Semantics/Media/VideoMedia.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import Markdown
1515
public final class VideoMedia: Semantic, Media, AutomaticDirectiveConvertible {
1616
public static let directiveName = "Video"
1717

18+
public static let introducedVersion = "5.5"
19+
1820
public let originalMarkup: BlockDirective
1921

2022
@DirectiveArgumentWrapped(

Sources/SwiftDocC/Semantics/Metadata/Availability.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ extension Metadata {
4444
/// }
4545
/// ```
4646
public final class Availability: Semantic, AutomaticDirectiveConvertible {
47-
static public let directiveName: String = "Available"
47+
public static let directiveName: String = "Available"
48+
public static let introducedVersion = "5.8"
4849

4950
public enum Platform: RawRepresentable, Hashable, DirectiveArgumentValueConvertible {
5051
// FIXME: re-add `case any = "*"` when `isBeta` and `isDeprecated` are implemented

Sources/SwiftDocC/Semantics/Metadata/CallToAction.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2022 Apple Inc. and the Swift project authors
4+
Copyright (c) 2022-2023 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -42,6 +42,8 @@ import Markdown
4242
/// }
4343
/// ```
4444
public final class CallToAction: Semantic, AutomaticDirectiveConvertible {
45+
public static let introducedVersion = "5.8"
46+
4547
/// The kind of action the link is referencing.
4648
public enum Purpose: String, CaseIterable, DirectiveArgumentValueConvertible {
4749
/// References a link to download an associated asset, like a sample project.

Sources/SwiftDocC/Semantics/Metadata/CustomMetadata.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2022 Apple Inc. and the Swift project authors
4+
Copyright (c) 2022-2023 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -11,7 +11,7 @@
1111
import Foundation
1212
import Markdown
1313

14-
/// A directive that accepts an arbitary key/valye pair and emits it into the metadata of the page
14+
/// A directive that accepts an arbitrary key/value pair and emits it into the metadata of the page
1515
///
1616
/// It accepts following parameters:
1717
///
@@ -25,6 +25,7 @@ import Markdown
2525
/// }
2626
/// ```
2727
public final class CustomMetadata: Semantic, AutomaticDirectiveConvertible {
28+
public static let introducedVersion = "5.8"
2829
public let originalMarkup: BlockDirective
2930

3031
/// A key to identify a piece of metadata

0 commit comments

Comments
 (0)