got assignment template variables and replacement working

This commit is contained in:
2023-07-27 19:51:36 -06:00
parent b03c699381
commit 7c857a3887
10 changed files with 63 additions and 81 deletions

View File

@@ -15,4 +15,16 @@ public record AssignmentTemplate
return matches.Select(match => match.Groups[1].Value);
}
public static string GetHtml(AssignmentTemplate template, LocalAssignment assignment)
{
var html = Markdig.Markdown.ToHtml(template.Markdown);
foreach (KeyValuePair<string, string> entry in assignment.template_variables)
{
html = html.Replace($"%7B%7B{entry.Key}%7D%7D", entry.Value);
}
return html;
}
}