This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-nitride-cil/src/MfGames.Nitride.Markdown/IdentifyMarkdownFromPath.cs

30 lines
644 B
C#
Raw Normal View History

using FluentValidation;
2022-09-06 05:53:22 +00:00
using MfGames.Gallium;
using Zio;
2022-09-06 05:53:22 +00:00
namespace MfGames.Nitride.Markdown;
public class IdentifyMarkdownFromPath : IdentifyMarkdown
{
public IdentifyMarkdownFromPath(IValidator<IdentifyMarkdown> validator)
: base(validator)
{
this.IsMarkdownTest = DefaultIsMarkdown;
}
2022-07-09 04:52:10 +00:00
private static bool DefaultIsMarkdown(
Entity entity,
UPath path)
{
return (path.GetExtensionWithDot() ?? string.Empty).ToLowerInvariant()
switch
{
".md" => true,
".markdown" => true,
_ => false,
};
}
}