mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00

* Adding a dark mode * Adding reference for types to summary pages * Adding API Reference * Adding modifiers to methods/fields/etc * Minimizing files input * Caching a lot of the output pages * Cache only for each execution * Adding API references to existing docs
59 lines
2.3 KiB
Plaintext
59 lines
2.3 KiB
Plaintext
@using Statiq.CodeAnalysis
|
|
@using Microsoft.AspNetCore.Html
|
|
@using Docs.Extensions
|
|
@{
|
|
var isEnum = Document.GetString(CodeAnalysisKeys.SpecificKind) == "Enum";
|
|
IReadOnlyList<IDocument> fields;
|
|
if (isEnum)
|
|
{
|
|
fields = Document.GetDocumentList(CodeAnalysisKeys.Members)?.Where(x => x.GetBool(CodeAnalysisKeys.IsResult) && x.GetString(CodeAnalysisKeys.Kind) == "Field")
|
|
.OrderBy(x => x.Get(CodeAnalysisKeys.ConstantValue) as int? ?? 0)
|
|
.ToList();
|
|
}
|
|
else
|
|
{
|
|
fields = Document.GetDocumentList(CodeAnalysisKeys.Members)?.Where(x => x.GetBool(CodeAnalysisKeys.IsResult) && x.GetString(CodeAnalysisKeys.Kind) == "Field")
|
|
.OrderBy(x => x.GetString(CodeAnalysisKeys.DisplayName))
|
|
.ToList();
|
|
}
|
|
|
|
|
|
if (fields?.Count > 0)
|
|
{
|
|
<h3>Fields</h3>
|
|
<div class="doc-summary">
|
|
<div>
|
|
<dl>
|
|
@foreach (var field in fields)
|
|
{
|
|
<div>
|
|
<dt>
|
|
|
|
<div class="flex flex-row">
|
|
<div class="w-4/5">
|
|
@if (isEnum)
|
|
{
|
|
@Context.GetTypeLink(field, false)
|
|
}
|
|
else
|
|
{
|
|
@field.GetModifiers() @Context.GetTypeLink(field.GetDocument(CodeAnalysisKeys.Type))
|
|
@Context.GetTypeLink(field, false)
|
|
}
|
|
</div>
|
|
<div>
|
|
@(field.GetBool(CodeAnalysisKeys.HasConstantValue) ? new HtmlString(field.Get(CodeAnalysisKeys.ConstantValue)?.ToString() ?? "null") : new HtmlString(string.Empty))
|
|
</div>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
@Html.Raw(field.GetString(CodeAnalysisKeys.Summary))
|
|
</dd>
|
|
</div>
|
|
}
|
|
</dl>
|
|
</div>
|
|
|
|
</div>
|
|
}
|
|
} |