mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-05 20:18:15 +08:00
Add initial docs
This commit is contained in:

committed by
Patrik Svensson

parent
decb887b0a
commit
f1912b1d44
41
docs/src/Pipelines/ColorsPipeline.cs
Normal file
41
docs/src/Pipelines/ColorsPipeline.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Docs.Models;
|
||||
using NJsonSchema;
|
||||
using Statiq.Common;
|
||||
using Statiq.Core;
|
||||
|
||||
namespace Docs.Pipelines
|
||||
{
|
||||
public class ColorsPipeline : Pipeline
|
||||
{
|
||||
public const string Url = "https://raw.githubusercontent.com/spectresystems/spectre.console/main/resources/scripts/Generator/Data/colors.json";
|
||||
|
||||
public ColorsPipeline()
|
||||
{
|
||||
InputModules = new ModuleList
|
||||
{
|
||||
new ExecuteConfig(
|
||||
Config.FromContext(ctx => {
|
||||
return new ReadWeb(Url);
|
||||
}))
|
||||
};
|
||||
|
||||
ProcessModules = new ModuleList
|
||||
{
|
||||
new ExecuteConfig(
|
||||
Config.FromDocument(async (doc, ctx) =>
|
||||
{
|
||||
var colors = Color.Parse(await doc.GetContentStringAsync()).ToList();
|
||||
var definitions = new List<IDocument> { colors.ToDocument(Constants.Colors.Root) };
|
||||
|
||||
return doc.Clone(new MetadataDictionary
|
||||
{
|
||||
[Constants.Colors.Root] = definitions
|
||||
});
|
||||
}))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
22
docs/src/Pipelines/DeploymentPipeline.cs
Normal file
22
docs/src/Pipelines/DeploymentPipeline.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Statiq.Common;
|
||||
using Statiq.Core;
|
||||
using Statiq.Web.GitHub;
|
||||
|
||||
namespace Docs.Pipelines
|
||||
{
|
||||
public class DeploymentPipeline : Pipeline
|
||||
{
|
||||
public DeploymentPipeline()
|
||||
{
|
||||
Deployment = true;
|
||||
OutputModules = new ModuleList
|
||||
{
|
||||
new DeployGitHubPages(
|
||||
Config.FromSetting<string>(Constants.Site.Owner),
|
||||
Config.FromSetting<string>(Constants.Site.Repository),
|
||||
Config.FromSetting<string>(Constants.Deployment.GitHubToken))
|
||||
.ToBranch(Config.FromSetting<string>(Constants.Deployment.TargetBranch))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user