diff --git a/docs/testing/req.md b/docs/testing/req.md index 58ac2f891..a96c80e2f 100644 --- a/docs/testing/req.md +++ b/docs/testing/req.md @@ -29,6 +29,7 @@ Current version: **9.0.0** | `` {applies_to}`stack: removed 8.18` `` | {applies_to}`stack: removed 8.18` | | `` {applies_to}`stack: removed 9.0` `` | {applies_to}`stack: removed 9.0` | | `` {applies_to}`stack: removed 9.1` `` | {applies_to}`stack: removed 9.1` | +| `` {applies_to}`stack: ` `` | {applies_to}`stack: ` | {applies_to}`stack: deprecated 9.1, removed 9.4` diff --git a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml index cfead056b..fc4fd0197 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml +++ b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml @@ -1,3 +1,4 @@ +@using System.Diagnostics.CodeAnalysis @using Elastic.Documentation @using Elastic.Markdown.Myst.FrontMatter @inherits RazorSlice @@ -94,7 +95,7 @@ switch (applicability.Lifecycle) { case ProductLifecycle.TechnicalPreview: - if (applicability.Version is not null && applicability.Version > currentStackVersion) + if (TryGetRealVersion(applicability, out var previewVersion) && previewVersion > currentStackVersion) { badgeText = "Planned"; tooltip = "We plan to add this functionality in a future update. Plans may change without notice."; @@ -105,7 +106,7 @@ } break; case ProductLifecycle.Beta: - if (applicability.Version is not null && applicability.Version > currentStackVersion) + if (TryGetRealVersion(applicability, out var betaVersion) && betaVersion > currentStackVersion) { badgeText = "Planned"; tooltip = "We plan to add this functionality in a future update. Plans may change without notice."; @@ -117,7 +118,7 @@ break; case ProductLifecycle.GenerallyAvailable: - if (applicability.Version is not null && applicability.Version > currentStackVersion) + if (TryGetRealVersion(applicability, out var version) && version > currentStackVersion) { badgeText = "Planned"; tooltip = "We plan to add this functionality in a future update. Plans may change without notice."; @@ -125,7 +126,7 @@ break; case ProductLifecycle.Deprecated: - if (applicability.Version is not null && applicability.Version > currentStackVersion) + if (TryGetRealVersion(applicability, out var deprecatedVersion) && deprecatedVersion > currentStackVersion) { badgeText = "Deprecation planned"; tooltip = "We plan to deprecate this functionality in a future update. Plans may change without notice."; @@ -133,7 +134,7 @@ break; case ProductLifecycle.Removed: - if (applicability.Version is not null && applicability.Version > currentStackVersion) + if (TryGetRealVersion(applicability, out var removedVersion) && removedVersion > currentStackVersion) { badgeText = "Removal planned"; tooltip = "We plan to remove this functionality in a future update. Plans may change without notice."; @@ -177,3 +178,16 @@ return HtmlString.Empty; } } +@functions { + private static bool TryGetRealVersion(Applicability applicability, [NotNullWhen(true)] out SemVersion? version) + { + version = null; + if (applicability.Version is not null && applicability.Version != AllVersions.Instance) + { + version = applicability.Version; + return true; + } + + return false; + } +}