mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-01 15:49:11 +00:00
27 lines
1.0 KiB
C#
27 lines
1.0 KiB
C#
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
using Scriban;
|
|
using Scriban.Parsing;
|
|
using Scriban.Runtime;
|
|
using Tyrrrz.Extensions;
|
|
|
|
namespace DiscordChatExporter.Core.Rendering
|
|
{
|
|
public partial class HtmlChatLogRenderer
|
|
{
|
|
private class TemplateLoader : ITemplateLoader
|
|
{
|
|
private const string ResourceRootNamespace = "DiscordChatExporter.Core.Rendering.Resources";
|
|
|
|
public string Load(string templatePath) =>
|
|
Assembly.GetExecutingAssembly().GetManifestResourceString($"{ResourceRootNamespace}.{templatePath}");
|
|
|
|
public string GetPath(TemplateContext context, SourceSpan callerSpan, string templateName) => templateName;
|
|
|
|
public string Load(TemplateContext context, SourceSpan callerSpan, string templatePath) => Load(templatePath);
|
|
|
|
public ValueTask<string> LoadAsync(TemplateContext context, SourceSpan callerSpan, string templatePath) =>
|
|
new ValueTask<string>(Load(templatePath));
|
|
}
|
|
}
|
|
} |