mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-19 02:12:49 +08:00

* Add constants for emojis * Move emoji shortcode rendering to Markup * Add documentation * Add example * Add tests
30 lines
789 B
C#
30 lines
789 B
C#
using Statiq.Common;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Docs
|
|
{
|
|
public static class DocumentExtensions
|
|
{
|
|
public static string GetDescription(this IDocument document)
|
|
{
|
|
return document?.GetString(Constants.Description, string.Empty) ?? string.Empty;
|
|
}
|
|
|
|
public static bool IsVisible(this IDocument document)
|
|
{
|
|
return !document.GetBool(Constants.Hidden, false);
|
|
}
|
|
|
|
public static bool ShowLink(this IDocument document)
|
|
{
|
|
return !document.GetBool(Constants.NoLink, false);
|
|
}
|
|
|
|
public static IEnumerable<IDocument> OnlyVisible(this IEnumerable<IDocument> source)
|
|
{
|
|
return source.Where(x => x.IsVisible());
|
|
}
|
|
}
|
|
}
|