-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label Sample-Code Call-to-Action buttons with "View Source" #566
Label Sample-Code Call-to-Action buttons with "View Source" #566
Conversation
Updates the logic for `@CallToAction` buttons that are attached to `sampleCode` pages and use the `link` purpose to render with a more specific “View Source” title instead of the more generic “Visit” title. This makes the intent of the button more clear. Resolves rdar://108013602
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
Just two non-blocking suggestions for the implementations of the deprecated properties.
@@ -178,6 +197,7 @@ extension CallToAction { | |||
extension CallToAction.Purpose { | |||
/// The label that will be applied to a Call to Action with this purpose if it doesn't provide | |||
/// a separate label. | |||
@available(*, deprecated, message: "Replaced with 'CallToAction.buttonLabel(for:)'.") | |||
public var defaultLabel: String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this internally call defaultLabel(for: nil)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea: c83c4a3.
@@ -79,6 +81,7 @@ public final class CallToAction: Semantic, AutomaticDirectiveConvertible { | |||
|
|||
/// The computed label for this Call to Action, whether provided directly via ``label`` or | |||
/// indirectly via ``purpose``. | |||
@available(*, deprecated, renamed: "buttonLabel(for:)") | |||
public var buttonLabel: String { | |||
if let label = label { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this internally call buttonLabel(for: nil)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea: c83c4a3.
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
…g#566) Updates the logic for `@CallToAction` buttons that are attached to `sampleCode` pages and use the `link` purpose to render with a more specific “View Source” title instead of the more generic “Visit” title. This makes the intent of the button more clear. Resolves rdar://108013602
Bug/issue #, if applicable: rdar://108013602
Summary
Updates the logic for
@CallToAction
buttons that are attached tosampleCode
pages and use thelink
purpose to render with a more specific “View Source” title instead of the more generic “Visit” title.This makes the intent of the button more clear. Regular article pages should continue to have the same behavior.
Testing
Create an article with
@CallToAction
directive using that provides aurl
andlink
purpose and a@PageKind(sampleCode)
directive. Confirm that the call to action button is labeled "View Source".Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded