GetDefaultRenderContextBehaviour() public static method

public static GetDefaultRenderContextBehaviour ( ) : RenderContextBehaviour
return RenderContextBehaviour
Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
 /// <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());
 }