Add initial docs

This commit is contained in:
Patrik Svensson
2020-08-27 13:57:25 +02:00
committed by Patrik Svensson
parent decb887b0a
commit f1912b1d44
117 changed files with 9290 additions and 0 deletions

View 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;
}
}
}

View 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());
}
}
}

View File

@ -0,0 +1,10 @@
namespace Docs
{
public static class StringExtensions
{
public static bool IsNotEmpty(this string source)
{
return !string.IsNullOrWhiteSpace(source);
}
}
}