Skip to content

Commit 86a25b5

Browse files
committed
WIP Major design update
1 parent db12727 commit 86a25b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1222
-0
lines changed

ApiExtensions.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Statiq.CodeAnalysis;
2+
using Statiq.Docs.Pipelines;
3+
using System.Text;
4+
5+
namespace TurnerSoftware.Compendium;
6+
7+
public class ApiExtensions : Pipeline
8+
{
9+
public ApiExtensions()
10+
{
11+
Dependencies.Add(nameof(Api));
12+
13+
DependencyOf.Add(nameof(Statiq.Web.Pipelines.Content));
14+
15+
ProcessModules = new ModuleList(
16+
new ConcatDocuments(nameof(Api)),
17+
new ExecuteConfig(Config.FromDocument((doc, ctx) =>
18+
{
19+
var coreName = $"{doc.GetString(CodeAnalysisKeys.FullName)} {doc.GetString(CodeAnalysisKeys.SpecificKind)}";
20+
var title = coreName;
21+
22+
var containingNamespace = doc.GetDocument(CodeAnalysisKeys.ContainingNamespace);
23+
if (containingNamespace is not null)
24+
{
25+
title = $"{coreName} ({containingNamespace.GetString(Keys.Title)})";
26+
}
27+
28+
return doc.Clone(new Dictionary<string, object>()
29+
{
30+
[Keys.Title] = title
31+
});
32+
}))
33+
);
34+
}
35+
}

DocumentTable.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace TurnerSoftware.Compendium;
2+
3+
/// <summary>
4+
/// This model is used for the _DocumentTable partial that renders documents, titles, headers, and summaries as a table.
5+
/// </summary>
6+
public class DocumentTable
7+
{
8+
public IList<IDocument> Documents { get; set; }
9+
public string Title { get; set; }
10+
public string Header { get; set; }
11+
public bool HasSummary { get; set; }
12+
public bool LinkTypeArguments { get; set; } = true;
13+
}

Tailwind.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace TurnerSoftware.Compendium;
2+
3+
public class Tailwind : Pipeline
4+
{
5+
private const bool MinifyOutput = true;
6+
7+
private static string MinifyOutputArgument => MinifyOutput ? "--minify" : string.Empty;
8+
9+
public Tailwind()
10+
{
11+
InputModules = new ModuleList
12+
{
13+
new ReadFiles("**/*.tailwind.css")
14+
};
15+
16+
ProcessModules = new ModuleList
17+
{
18+
new StartProcess("dotnet", Config.FromDocument(d => $"tailwindcss -c theme/tailwind.config.js -i {d.Source} {MinifyOutputArgument}"))
19+
.ContinueOnError(Config.FromValue(true))
20+
.LogErrors(Config.FromValue(false)),
21+
new ReplaceDocuments(Config.FromDocument(d => d.Clone(d.Destination.ChangeExtension("min.css")).Yield()))
22+
};
23+
24+
OutputModules = new ModuleList
25+
{
26+
new WriteFiles()
27+
};
28+
}
29+
}

ThemeKeys.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace TurnerSoftware.Compendium;
2+
3+
public static class ThemeKeys
4+
{
5+
public const string ProjectName = nameof(ProjectName);
6+
public const string ProjectShortDescription = nameof(ProjectShortDescription);
7+
public const string RepositoryUrl = nameof(RepositoryUrl);
8+
public const string Layout = nameof(Layout);
9+
}

TurnerSoftware.Compendium.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Statiq.Docs" Version="1.0.0-beta.5" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@foreach(IGrouping<string, IDocument> typeGroup
2+
in Outputs.FromPipeline(nameof(Statiq.Docs.Pipelines.Api))
3+
.Where(x => x.GetBool(CodeAnalysisKeys.IsResult)
4+
&& x.GetString(CodeAnalysisKeys.Kind) == "NamedType"
5+
&& Document.IdEquals(x.GetDocument(CodeAnalysisKeys.ContainingAssembly)))
6+
.GroupBy(x => x.GetString(CodeAnalysisKeys.SpecificKind))
7+
.OrderBy(x => x.Key))
8+
{
9+
@await Html.PartialAsync("Api/Section/_DocumentTable", new DocumentTable
10+
{
11+
Documents = typeGroup.OrderBy(x => x.GetString(CodeAnalysisKeys.DisplayName)).ToList(),
12+
Title = typeGroup.Key + " Types",
13+
Header = typeGroup.Key,
14+
HasSummary = true
15+
});
16+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@await Html.PartialAsync("Api/Section/_Definition")
2+
@await Html.PartialAsync("Api/Section/_Examples")
3+
@await Html.PartialAsync("Api/Section/_Remarks")
4+
@await Html.PartialAsync("Api/Section/_SeeAlso")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@await Html.PartialAsync("Api/Section/_Definition")
2+
@await Html.PartialAsync("Api/Section/_Examples")
3+
@await Html.PartialAsync("Api/Section/_Remarks")
4+
@await Html.PartialAsync("Api/Section/_Attributes")
5+
@await Html.PartialAsync("Api/Section/_ConstantValue")
6+
@await Html.PartialAsync("Api/Section/_SeeAlso")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@await Html.PartialAsync("Api/Section/_Definition")
2+
@await Html.PartialAsync("Api/Section/_Examples")
3+
@await Html.PartialAsync("Api/Section/_Remarks")
4+
@await Html.PartialAsync("Api/Section/_Attributes")
5+
@await Html.PartialAsync("Api/Section/_TypeParameters")
6+
@await Html.PartialAsync("Api/Section/_Parameters")
7+
@await Html.PartialAsync("Api/Section/_ReturnValue")
8+
@await Html.PartialAsync("Api/Section/_SeeAlso")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@await Html.PartialAsync("Api/Section/_Definition")
2+
@await Html.PartialAsync("Api/Section/_Examples")
3+
@await Html.PartialAsync("Api/Section/_Remarks")
4+
@await Html.PartialAsync("Api/Section/_Attributes")
5+
@await Html.PartialAsync("Api/Section/_TypeParameters")
6+
@await Html.PartialAsync("Api/Section/_Constructors")
7+
@await Html.PartialAsync("Api/Section/_Events")
8+
@await Html.PartialAsync("Api/Section/_Fields")
9+
@await Html.PartialAsync("Api/Section/_Properties")
10+
@await Html.PartialAsync("Api/Section/_Methods")
11+
@await Html.PartialAsync("Api/Section/_Operators")
12+
@await Html.PartialAsync("Api/Section/_ExtensionMethods")
13+
@await Html.PartialAsync("Api/Section/_SeeAlso")

0 commit comments

Comments
 (0)