Merge pull request #22843 from Joehuu/display-wiki-stub-notice

Display stub notice in marked wiki articles
This commit is contained in:
Dean Herbert 2023-03-12 19:06:30 +09:00 committed by GitHub
commit 20b2d0d4c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osuTK;
namespace osu.Game.Overlays.Wiki.Markdown namespace osu.Game.Overlays.Wiki.Markdown
{ {
@ -19,24 +20,30 @@ namespace osu.Game.Overlays.Wiki.Markdown
{ {
private readonly bool isOutdated; private readonly bool isOutdated;
private readonly bool needsCleanup; private readonly bool needsCleanup;
private readonly bool isStub;
public WikiNoticeContainer(YamlFrontMatterBlock yamlFrontMatterBlock) public WikiNoticeContainer(YamlFrontMatterBlock yamlFrontMatterBlock)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical; Direction = FillDirection.Vertical;
Spacing = new Vector2(10);
foreach (object line in yamlFrontMatterBlock.Lines) foreach (object line in yamlFrontMatterBlock.Lines)
{ {
switch (line.ToString()) switch (line.ToString())
{ {
case "outdated: true": case @"outdated: true":
isOutdated = true; isOutdated = true;
break; break;
case "needs_cleanup: true": case @"needs_cleanup: true":
needsCleanup = true; needsCleanup = true;
break; break;
case @"stub: true":
isStub = true;
break;
} }
} }
} }
@ -60,6 +67,14 @@ namespace osu.Game.Overlays.Wiki.Markdown
Text = WikiStrings.ShowNeedsCleanupOrRewrite, Text = WikiStrings.ShowNeedsCleanupOrRewrite,
}); });
} }
if (isStub)
{
Add(new NoticeBox
{
Text = WikiStrings.ShowStub,
});
}
} }
private partial class NoticeBox : Container private partial class NoticeBox : Container