/// <summary> /// 解析自定义模板内容 /// </summary> /// <param name="templateContent"></param> /// <param name="writer"></param> public void Process(string templateContent, TextWriter writer) { this.writer = writer; this.currentTemplate = mainTemplate; if (handler != null) { SetValue("this", handler); handler.BeforeProcess(this); } ProcessElements(mainTemplate.Elements); if (handler != null) { handler.AfterProcess(this); } }
public static TemplateManager FromString(string template, bool isPreview) { UserTemplate itemplate = UserTemplate.FromString("", template); return(new TemplateManager(itemplate, isPreview)); }
public static TemplateManager FromFile(string filename, bool isPreview) { UserTemplate template = UserTemplate.FromFile("", filename); return(new TemplateManager(template, isPreview)); }
/// <summary> /// adds template that can be used within execution /// </summary> /// <param name="template"></param> public void AddTemplate(UserTemplate template) { mainTemplate.Templates.Add(template.Name, template); }