forked from cake-build/website
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.wyam
101 lines (90 loc) · 3.65 KB
/
config.wyam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#n Humanizer.Core
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");
ContentStreamFactory = new MemoryContentStreamFactory();
Settings[Keys.Host] = "cakebuild.net";
Settings[Keys.LinksUseHttps] = true;
Settings[DocsKeys.Title] = "Cake";
Settings[DocsKeys.Logo] = "/assets/img/logo.png";
Settings[DocsKeys.SourceFiles] = "../release/cake-repo/src/**/{!bin,!obj,!packages,!*.Tests,!Cake.Frosting.Example,!Cake.Frosting.Template,}/**/*.cs";
Settings[DocsKeys.BaseEditUrl] = "https://github.com/cake-build/website/blob/master/input/";
Settings[DocsKeys.IncludeGlobalNamespace] = false;
Settings[DocsKeys.IncludeDateInPostPath] = true;
Settings[DocsKeys.BlogAtomPath] = "blog/feed/atom/index.xml";
Settings[DocsKeys.BlogRssPath] = "blog/feed/rss/index.xml";
// Reads maintainer metadata
Pipelines.InsertBefore(Docs.Code, "Maintainers",
ReadFiles("../maintainers/*.yml"),
Yaml()
);
// Reads contributor metadata
Pipelines.InsertBefore(Docs.Code, "Contributors",
ReadFiles("../contributors/*.yml"),
Yaml()
);
// Reads extension metadata
Pipelines.InsertBefore(Docs.Code, "Extensions",
ReadFiles("../extensions/*.yml"),
Yaml(),
Meta(
"SupportedCakeVersions",
FileSystem.GetInputFile($"../release/extensions/{@doc.String("NuGet")}.supportedcakeversions").Exists
? FileSystem.GetInputFile($"../release/extensions/{@doc.String("NuGet")}.supportedcakeversions").ReadAllText()
: null
),
Meta(
Keys.WritePath,
new FilePath("extensions/" + @doc.String("Name").ToLower().Replace(".", "-") + "/index.html")
),
Meta(DocsKeys.NoSidebar, true)
);
// Read all classes containing aliases from API documentation
Pipelines.InsertAfter(Docs.Api, "Aliases",
Documents(Docs.Api),
Where(
@doc.String(CodeAnalysisKeys.Kind) == "NamedType"
&& @doc.DocumentList(CodeAnalysisKeys.Attributes)
.Any(attr => attr.String(CodeAnalysisKeys.Name) == "CakeAliasCategoryAttribute")
)
);
// Prepares aliases classes for reference page by grouping them by category.
Pipelines.InsertAfter("Aliases", "DslAliases",
GroupByMany(
@doc.DocumentList(CodeAnalysisKeys.Attributes)
.Where(attr => attr.String(CodeAnalysisKeys.Name) == "CakeAliasCategoryAttribute")
.Select(attr => attr.Get<Microsoft.CodeAnalysis.AttributeData>(CodeAnalysisKeys.AttributeData).ConstructorArguments.FirstOrDefault().Value)
.Distinct(),
Documents("Aliases")
),
Meta(
"ContainsBuiltInAliases",
@doc
.DocumentList(Keys.GroupDocuments)
.Any(x => string.IsNullOrWhiteSpace(x.Document(CodeAnalysisKeys.ContainingAssembly)?.String(CodeAnalysisKeys.DisplayName)))
? true
: false),
Meta(Keys.WritePath, new FilePath("dsl/" + @doc.String(Keys.GroupKey).ToLower().Replace(" ", "-") + "/index.html")),
Meta(Keys.RelativeFilePath, @doc.FilePath(Keys.WritePath)),
OrderBy(@doc.String(Keys.GroupKey))
);
// Renders individual extension pages
Pipelines.Add("RenderExtensions",
Documents("Extensions"),
Razor()
.WithLayout("/_ExtensionsLayout.cshtml"),
WriteFiles()
);
// Renders reference page
Pipelines.Add("RenderDsl",
Documents("DslAliases"),
Razor()
.WithLayout("/_DslLayout.cshtml"),
Headings(),
HtmlInsert("div#infobar-headings", (doc, ctx) => ctx.GenerateInfobarHeadings(doc)),
WriteFiles()
);
// Creates sitemap
Pipelines.Add("BuildSiteMap",
Documents(@ctx.Documents.ExceptPipeline("Extensions").Except(@ctx.Documents.FromPipeline("Code"))),
Sitemap(),
WriteFiles((d,c) => "sitemap.xml")
);