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 LoadAsync(TemplateContext context, SourceSpan callerSpan, string templatePath) => new ValueTask(Load(templatePath)); } } }