Skip to content

Conversation

@d-ronnqvist
Copy link
Contributor

@d-ronnqvist d-ronnqvist commented May 22, 2024

Bug/issue #, if applicable: rdar://126292460

Summary

This renames the confusingly named TitleStyle/title and TitleStyle/symbol to PropertyListTitleStyle/useDisplayName and PropertyListTitleStyle/useRawKey to clarify what they are used for and fixes a fixes a call site that set the titleStyle of topic references because it wasn't clear that the API was only for property list keys.

For the TopicRenderReference changes I started by renaming titleStyle to propertyListTitleStyle, name to propertyListRawKey, and ideTitle to propertyListDisplayName. Next, the common prefix led me to group these into a struct to make it even more clear that they are related.

Dependencies

None.

Testing

In any documentation project

  • Modify /path/to/swift-docc-clone/bin/test-data-external-resolver so that "kind/isSymbol" is "false"
  • Add a documentation link to <doc://com.test.bundle/something> somewhere in the content
  • Set DOCC_LINK_RESOLVER_EXECUTABLE=/path/to/swift-docc-clone/bin/test-data-external-resolver
  • Preview documentation for the page with the link externally resolved link.
    • The link text should not use a monospace font.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added Updated tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

fragments: resolvedInformation.declarationFragments?.declarationFragments.map { DeclarationRenderSection.Token(fragment: $0, identifier: nil) },
isBeta: (resolvedInformation.platforms ?? []).contains(where: { $0.isBeta == true }),
isDeprecated: (resolvedInformation.platforms ?? []).contains(where: { $0.deprecated != nil }),
titleStyle: resolvedInformation.kind.isSymbol ? .symbol : .title,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to get this change on the 6.0 release branch but if you prefer I can open a separate PR that only does that (and the other similarly called out call site).

titleStyle: self.kind.isSymbol ? .symbol : .title,
name: title,
ideTitle: nil,
propertyListKeyNames: nil,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to get this change on the 6.0 release branch but if you prefer I can open a separate PR that only does that (and the other similarly called out call site).

/// ## See Also
/// - ``TopicRenderReference/PropertyListKeyNames/rawKey``
case useRawKey = "symbol"
/// Render links to the symbol using a special "IDE title" name, for example, "Enables Data Access".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit maybe remove the reference to IDE because it was removed everywhere else?

case titleStyle
case name
case ideTitle
case propertyListTitleStyle = "titleStyle"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this was done to preserve RenderJSON compatibility but I wonder if there is a path forward to eventually encoding these in a more sensible way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about that as well but AFAIK we've never done a breaking change to the RenderNode OpenAPI spec so I don't think we ever defined a process for how to stop encoding an old value.

For example, we still use the original "project" value for the tutorial page kind and that change predates the initial open source release.

 case tutorial = "project"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely beyond the scope of this change, but I wonder if we should encode a RenderJSON version field or something.

@daniel-grumberg daniel-grumberg self-requested a review May 22, 2024 12:44
@daniel-grumberg
Copy link
Contributor

LGTM

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit fc2d491 into swiftlang:main May 22, 2024
@d-ronnqvist d-ronnqvist deleted the rename-title-style branch May 22, 2024 13:56
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request May 22, 2024
swiftlang#919)

* Rename `TitleStyle` to `PropertyListTitleStyle` to clarify its purpose

rdar://126292460

* Avoid referring to deprecated "IDE title" in updated documentation
d-ronnqvist added a commit that referenced this pull request May 22, 2024
#919) (#921)

* Rename `TitleStyle` to `PropertyListTitleStyle` to clarify its purpose

rdar://126292460

* Avoid referring to deprecated "IDE title" in updated documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants