Migrated Documentation library from NetFlow.DocumentationHelper.Library
This commit is contained in:
Regular → Executable
+21
-12
@@ -3,10 +3,11 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using GameDevLibrary.Helpers;
|
||||
using OmegaLeo.HelperLib.Helpers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NetFlow.DocumentationHelper.Library.Helpers;
|
||||
using NetFlow.DocumentationHelper.Library.Models;
|
||||
using OmegaLeo.HelperLib.Changelog.Helpers;
|
||||
using OmegaLeo.HelperLib.Documentation.Helpers;
|
||||
using OmegaLeo.HelperLib.Documentation.Models;
|
||||
using OmegaLeo.HelperLib.Changelog.Tools;
|
||||
using OmegaLeo.HelperLib.Web.Models;
|
||||
|
||||
@@ -52,7 +53,15 @@ public class HomeController : Controller
|
||||
"Game Development Library",
|
||||
"Game development utilities for Unity and Godot",
|
||||
"OmegaLeo.HelperLib.Game"
|
||||
)
|
||||
),
|
||||
["documentation"] = GenerateLibraryDocs(
|
||||
typeof(OmegaLeo.HelperLib.Documentation.Helpers.DocumentationHelperTool).Assembly,
|
||||
Path.Combine(root, "changelogs", "OmegaLeo.HelperLib.Documentation.CHANGELOG.md"),
|
||||
"Documentation Library",
|
||||
"Tools for generating documentation from code attributes",
|
||||
"OmegaLeo.HelperLib.Documentation",
|
||||
true
|
||||
),
|
||||
};
|
||||
|
||||
_logger.LogInformation("Initialized {Count} libraries", _libraryCache.Count);
|
||||
@@ -99,11 +108,11 @@ public class HomeController : Controller
|
||||
{
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
var target = assemblies.FirstOrDefault(a =>
|
||||
a.GetName().Name.Equals("NetFlow.DocumentationHelper.Library", StringComparison.OrdinalIgnoreCase));
|
||||
a.GetName().Name.Equals("OmegaLeo.HelperLib.Documentation", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
_logger.LogWarning("NetFlow.DocumentationHelper.Library not loaded. Loaded assemblies ({Count}):",
|
||||
_logger.LogWarning("OmegaLeo.HelperLib.Documentation not loaded. Loaded assemblies ({Count}):",
|
||||
assemblies.Length);
|
||||
foreach (var a in assemblies.OrderBy(a => a.GetName().Name))
|
||||
{
|
||||
@@ -120,7 +129,7 @@ public class HomeController : Controller
|
||||
Type attrType = null;
|
||||
try
|
||||
{
|
||||
attrType = target.GetType("NetFlow.DocumentationHelper.Library.Attributes.DocumentationAttribute",
|
||||
attrType = target.GetType("OmegaLeo.HelperLib.Documentation.Attributes.DocumentationAttribute",
|
||||
false, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -238,7 +247,7 @@ public class HomeController : Controller
|
||||
}
|
||||
|
||||
private LibraryDocumentationViewModel GenerateLibraryDocs(Assembly assembly, string changelogPath,
|
||||
string displayName, string description, string nugetPackageId)
|
||||
string displayName, string description, string nugetPackageId, bool generateForDocumentationAssembly = false)
|
||||
{
|
||||
_logger.LogInformation("=== Starting GenerateLibraryDocs for {Assembly} ===", assembly.GetName().Name);
|
||||
_logger.LogInformation("Assembly location: {Location}", assembly.Location ?? "<in-memory>");
|
||||
@@ -278,7 +287,7 @@ public class HomeController : Controller
|
||||
try
|
||||
{
|
||||
// Pass the specific assembly to only scan that assembly
|
||||
var result = DocumentationHelperTool.GenerateDocumentation();
|
||||
var result = DocumentationHelperTool.GenerateDocumentation(generateForDocumentationAssembly);
|
||||
allDocumentation = result?
|
||||
.Where(d => d.AssemblyName?.Equals(assembly.GetName().Name ,StringComparison.OrdinalIgnoreCase) == true)
|
||||
.ToList() ?? Enumerable.Empty<DocumentationStructure>();
|
||||
@@ -307,7 +316,7 @@ public class HomeController : Controller
|
||||
throw;
|
||||
}
|
||||
|
||||
var changelogMarkdown = string.Empty;
|
||||
/*var changelogMarkdown = string.Empty;
|
||||
if (System.IO.File.Exists(changelogPath))
|
||||
{
|
||||
try
|
||||
@@ -324,14 +333,14 @@ public class HomeController : Controller
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Changelog file not found at {Path}", changelogPath);
|
||||
}
|
||||
}*/
|
||||
|
||||
var viewModel = new LibraryDocumentationViewModel
|
||||
{
|
||||
LibraryName = displayName,
|
||||
Description = description,
|
||||
NuGetPackageId = nugetPackageId,
|
||||
ChangelogMarkdown = changelogMarkdown,
|
||||
ChangelogMarkdown = ChangelogHelper.GetChangelogMarkdown(new []{assembly}),
|
||||
Documentation = allDocumentation.ToList()
|
||||
};
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: `OmegaLeo.HelperLib.Web/Models/LibraryDocumentationViewModel.cs`
|
||||
using NetFlow.DocumentationHelper.Library.Models;
|
||||
using OmegaLeo.HelperLib.Documentation.Models;
|
||||
|
||||
namespace OmegaLeo.HelperLib.Web.Models
|
||||
{
|
||||
|
||||
Regular → Executable
-1
@@ -16,7 +16,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Markdig" Version="0.40.0" />
|
||||
<PackageReference Include="MarkdigExtensions.SyntaxHighlighting" Version="1.0.3" />
|
||||
<PackageReference Include="NetFlow.DocumentationHelper.Library" Version="1.1.3" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+2
-2
@@ -1,6 +1,6 @@
|
||||
@* File: `OmegaLeo.HelperLib.Web/Views/Home/Library.cshtml` *@
|
||||
@using ColorCode.Styling
|
||||
@using GameDevLibrary.Extensions
|
||||
@using OmegaLeo.HelperLib.Extensions
|
||||
@using Markdig
|
||||
@model OmegaLeo.HelperLib.Web.Models.LibraryDocumentationViewModel
|
||||
@{
|
||||
@@ -83,7 +83,7 @@
|
||||
{
|
||||
<tr>
|
||||
<td><code>@desc.Title</code></td>
|
||||
<td>@Html.Raw(desc.Description)<br/>
|
||||
<td>@Html.Raw(Markdig.Markdown.ToHtml(desc.Description))<br/>
|
||||
@if (desc.CodeExample.IsNotNullOrEmpty())
|
||||
{
|
||||
<strong>Example:</strong><br/>
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+3
@@ -33,6 +33,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Library" asp-route-id="game">Game Dev</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Library" asp-route-id="documentation">Documentation</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="navbar-nav ms-auto">
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Regular → Executable
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Regular → Executable
Reference in New Issue
Block a user