-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template Engine #120
Labels
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please keep it open |
API proposal: public interface ITextTemplate
{
string Text { get; }
HashSet<string> Variables { get; }
}
public interface ITemplateParser
{
Task<ITextTemplate> ParseAsync(string text);
}
public interface ITemplateRenderer
{
Task<string> RenderAsync(ITextTemplate template, object globals);
}
public class TextTemplateContext: ITextTemplate,IProperties
{
public TextTemplateContext(string text, HashSet<string> variables)
{
Text = text;
Variables = variables;
}
public string Text { get; }
public HashSet<string> Variables { get; }
public IDictionary<string, object?> Properties { get; } = new Dictionary<string, object?>();
}
public interface ITemplateRendererBuilder
{
ITemplateRendererBuilder UseMiddleware(Func<TextTemplateContext, Task> middleware);
ITemplateRender Build();
} |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: