mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-02 18:17:30 +08:00
Add initial docs
This commit is contained in:

committed by
Patrik Svensson

parent
decb887b0a
commit
f1912b1d44
30
docs/src/Extensions/BootstrapperExtensions.cs
Normal file
30
docs/src/Extensions/BootstrapperExtensions.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Statiq.App;
|
||||
using Statiq.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Docs
|
||||
{
|
||||
public static class BootstrapperExtensions
|
||||
{
|
||||
public static Bootstrapper ConfigureSite(this Bootstrapper bootstrapper, string owner, string repo, string branch)
|
||||
{
|
||||
if (bootstrapper != null)
|
||||
{
|
||||
bootstrapper.AddSetting(Constants.Site.Owner, owner);
|
||||
bootstrapper.AddSetting(Constants.Site.Repository, repo);
|
||||
bootstrapper.AddSetting(Constants.Site.Branch, branch);
|
||||
}
|
||||
return bootstrapper;
|
||||
}
|
||||
|
||||
public static Bootstrapper ConfigureDeployment(this Bootstrapper bootstrapper, string deployBranch)
|
||||
{
|
||||
if (bootstrapper != null)
|
||||
{
|
||||
bootstrapper.AddSetting(Constants.Deployment.TargetBranch, deployBranch);
|
||||
}
|
||||
return bootstrapper;
|
||||
}
|
||||
}
|
||||
}
|
33
docs/src/Extensions/DocumentExtensions.cs
Normal file
33
docs/src/Extensions/DocumentExtensions.cs
Normal file
@ -0,0 +1,33 @@
|
||||
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 HasVisibleChildren(this IDocument document)
|
||||
{
|
||||
if (document != null)
|
||||
{
|
||||
return document.HasChildren() && document.GetChildren().Any(x => x.IsVisible());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsVisible(this IDocument document)
|
||||
{
|
||||
return !document.GetBool(Constants.Hidden, false);
|
||||
}
|
||||
|
||||
public static IEnumerable<IDocument> OnlyVisible(this IEnumerable<IDocument> source)
|
||||
{
|
||||
return source.Where(x => x.IsVisible());
|
||||
}
|
||||
}
|
||||
}
|
10
docs/src/Extensions/StringExtensions.cs
Normal file
10
docs/src/Extensions/StringExtensions.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Docs
|
||||
{
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static bool IsNotEmpty(this string source)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(source);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user