swift-doc
swift-doc copied to clipboard
Add availabilityAttributes property to Symbol
This is to partially support #105 and the @available attributes.
AvailabilityAttribute
I've added a property to Symbol called availabilityAttributes to support any attributes that are on the Symbol. SwiftSemantics already has support for this, so just drawing out the specific available attribute into it's own property
public var availabilityAttributes: [AvailabilityAttribute] {
enum AvailabilityAttributeType
I decided to code all the specific attributes inside the AvailabilityAttributeType enum. This allows the HTML or MarkDown, to check for specific attribute and change the UI accordingly.
The init?(from argument: Attribute.Argument) { is a little awkward I will admit. I was trying to handle the various scenarios of @available where sometimes you can have a version, sometimes not. It turned into something a little ugly, but looking for feedback, and perhaps you had another direction for it.
There is no UI change for HTML or Markdown, but the first step in supporting making that change.
@mattt made some more changes to the Availability type. This should better allow arbitrary platform names.
I tried to best split out the platform/version for future use where we could filter based on that.
Also added more tests for a variety of different @available options.
@mattt just wondering if there's anything I can do to move this forward?