public static string StringToString(string template, object data, RenderContextBehaviour renderContextBehaviour = null) { var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); return(StringToString(template, data, null, renderBehaviour)); }
public static void Template(TextReader reader, object data, TextWriter writer, RenderContextBehaviour renderContextBehaviour = null) { var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); Template(reader, data, writer, null, renderBehaviour); }
public static void StringToFile(string template, object data, string outputPath, RenderContextBehaviour renderContextBehaviour = null) { var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); StringToFile(template, data, outputPath, null, renderBehaviour); }
public static string StringToString(string template, object data, RenderContextBehaviour renderContextBehaviour = null) { var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); return StringToString(template, data, null, renderBehaviour); }
public static void Template(TextReader reader, object data, TextWriter writer, RenderContextBehaviour renderContextBehaviour = null) { var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); Template(reader, data, writer, null, renderBehaviour); }
public static void StringToFile(string template, object data, string outputPath, RenderContextBehaviour renderContextBehaviour = null) { var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); StringToFile(template, data, outputPath, null, renderBehaviour); }
public void Render(object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour) { var context = new RenderContext(this, data, writer, templateLocator, renderContextBehaviour); Render(context); writer.Flush(); }
public static string FileToString(string templatePath, object data, RenderContextBehaviour renderContextBehaviour = null) { var template = File.ReadAllText(templatePath); var templateLocator = GetTemplateLocator(templatePath); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); return(StringToString(template, data, templateLocator.GetTemplate, renderBehaviour)); }
public void Render(object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour) { var context = new RenderContext(this, data, writer, templateLocator, renderContextBehaviour); context.ActiveStartDelimiter = StartDelimiter; context.ActiveEndDelimiter = EndDelimiter; Render(context); writer.Flush(); }
public static void Template(TextReader reader, object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { var template = new Template(); template.Load(reader); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); template.Render(data, writer, templateLocator, renderBehaviour); }
public static string FileToString(string templatePath, object data, RenderContextBehaviour renderContextBehaviour = null) { var template = File.ReadAllText(templatePath); var templateLocator = GetTemplateLocator(templatePath); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); return StringToString(template, data, templateLocator.GetTemplate, renderBehaviour); }
public static string StringToString(string template, object data, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { var reader = new StringReader(template); var writer = new StringWriter(); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); Template(reader, data, writer, templateLocator, renderBehaviour); return(writer.GetStringBuilder().ToString()); }
public static void Template(TextReader reader, object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { var template = new Template(); template.Load(reader); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); template.Render(data, writer, templateLocator, renderBehaviour); }
public RenderContext(Section section, object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { _sectionStack.Push(section); _dataStack.Push(data); _writer = writer; _templateLocator = templateLocator; _includeLevel = 0; _renderContextBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); }
public static string StringToString(string template, object data, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { var reader = new StringReader(template); var writer = new StringWriter(); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); Template(reader, data, writer, templateLocator, renderBehaviour); return writer.GetStringBuilder().ToString(); }
public RenderContext(RenderContext baseContext, TextWriter writer) { _sectionStack = baseContext._sectionStack; _dataStack = baseContext._dataStack; _writer = writer; _templateLocator = baseContext._templateLocator; _renderContextBehaviour = baseContext._renderContextBehaviour; _includeLevel = baseContext._includeLevel; _indent = baseContext._indent; _lineEnded = baseContext._lineEnded; }
public RenderContext(RenderContext baseContext, TextWriter writer) { _sectionStack = baseContext._sectionStack; _dataStack = baseContext._dataStack; _writer = writer; _templateLocator = baseContext._templateLocator; _renderContextBehaviour = baseContext._renderContextBehaviour; _includeLevel = baseContext._includeLevel; _indent = baseContext._indent; _lineEnded = baseContext._lineEnded; }
public RenderContext(Section section, object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { _sectionStack.Push(section); _dataStack.Push(data); _writer = writer; _templateLocator = templateLocator; _includeLevel = 0; _renderContextBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); }
public static void StringToFile(string template, object data, string outputPath, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { var reader = new StringReader(template); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); using (var writer = File.CreateText(outputPath)) { Template(reader, data, writer, templateLocator, renderBehaviour); } }
public static void StringToFile(string template, object data, string outputPath, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { var reader = new StringReader(template); var renderBehaviour = renderContextBehaviour ?? RenderContextBehaviour.GetDefaultRenderContextBehaviour(); using (var writer = File.CreateText(outputPath)) { Template(reader, data, writer, templateLocator, renderBehaviour); } }
public void Render(object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour) { var context = new RenderContext(this, data, writer, templateLocator, renderContextBehaviour); context.ActiveStartDelimiter = StartDelimiter; context.ActiveEndDelimiter = EndDelimiter; Render(context); writer.Flush(); }
public void Render(object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour) { var context = new RenderContext(this, data, writer, templateLocator, renderContextBehaviour); Render(context); writer.Flush(); }
/// <summary> /// Renders the template. /// </summary> /// <param name="data">The data to use to render the template.</param> /// <param name="writer">The object to write the output to.</param> /// <param name="templateLocator">The delegate to use to locate templates for inclusion.</param> /// <remarks> /// The <paramref name="writer" /> is flushed, but not closed or disposed. /// </remarks> public void Render(object data, TextWriter writer, TemplateLocator templateLocator) { Render(data, writer, templateLocator, RenderContextBehaviour.GetDefaultRenderContextBehaviour()); }