diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dbab903..f02afa4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,6 @@ name: publish env: - VERSION: '0.16.0-preview' + VERSION: '0.17.0-preview' PRERELEASE: true on: push: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 36d236f..957b3c6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.17.0-preview +### Changed +- Made `Topic.GetTitle` public + ## 0.16.0-preview ### Changed - Archive topics diff --git a/src/Models/Topic.cs b/src/Models/Topic.cs index 1225a71..65a7dcd 100644 --- a/src/Models/Topic.cs +++ b/src/Models/Topic.cs @@ -78,6 +78,18 @@ public static string GetId(string title, string wikiNamespace, string? domain) ? $"{wikiNamespace}:{title}:messages" : $"({domain}):{wikiNamespace}:{title}:messages"; + /// + /// Gets the title of the wiki page associated with this . + /// + /// + /// The title of the wiki page associated with this , or an empty title if + /// this topic's does not appear to refer to a wiki page. + /// + public PageTitle GetTitle() => string.IsNullOrEmpty(Id) + || Id.Length <= TopicIdItemTypeName.Length + ? new() + : PageTitle.Parse(Id[TopicIdItemTypeName.Length..]); + /// /// Gets the that fits the given parameters. /// @@ -137,8 +149,4 @@ await dataStore.StoreItemAsync(existing) .ConfigureAwait(false); } } - - private PageTitle GetTitle() => string.IsNullOrEmpty(Id) - ? new() - : PageTitle.Parse(Id[TopicIdItemTypeName.Length..]); }