コード例 #1
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        public static string StringToString(string template, object data, RenderContextBehaviour renderContextBehaviour = null)
        {
            var renderBehaviour = renderContextBehaviour ??
                                  RenderContextBehaviour.GetDefaultRenderContextBehaviour();

            return(StringToString(template, data, null, renderBehaviour));
        }
コード例 #2
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        public static void Template(TextReader reader, object data, TextWriter writer, RenderContextBehaviour renderContextBehaviour = null)
        {
            var renderBehaviour = renderContextBehaviour ??
                                  RenderContextBehaviour.GetDefaultRenderContextBehaviour();

            Template(reader, data, writer, null, renderBehaviour);
        }
コード例 #3
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        public static void StringToFile(string template, object data, string outputPath, RenderContextBehaviour renderContextBehaviour = null)
        {
            var renderBehaviour = renderContextBehaviour ??
                                  RenderContextBehaviour.GetDefaultRenderContextBehaviour();

            StringToFile(template, data, outputPath, null, renderBehaviour);
        }
コード例 #4
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        public static string StringToString(string template, object data, RenderContextBehaviour renderContextBehaviour = null)
        {
            var renderBehaviour = renderContextBehaviour ??
                                         RenderContextBehaviour.GetDefaultRenderContextBehaviour();

            return StringToString(template, data, null, renderBehaviour);
        }
コード例 #5
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        public static void Template(TextReader reader, object data, TextWriter writer, RenderContextBehaviour renderContextBehaviour = null)
        {
            var renderBehaviour = renderContextBehaviour ??
                                        RenderContextBehaviour.GetDefaultRenderContextBehaviour();

            Template(reader, data, writer, null, renderBehaviour);
        }
コード例 #6
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        public static void StringToFile(string template, object data, string outputPath, RenderContextBehaviour renderContextBehaviour = null)
        {
            var renderBehaviour = renderContextBehaviour ??
                                         RenderContextBehaviour.GetDefaultRenderContextBehaviour();

            StringToFile(template, data, outputPath, null, renderBehaviour);
        }
コード例 #7
0
ファイル: Template.cs プロジェクト: Romanx/Nustache
        public void Render(object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour)
        {
            var context = new RenderContext(this, data, writer, templateLocator, renderContextBehaviour);

            Render(context);

            writer.Flush();
        }
コード例 #8
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        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));
        }
コード例 #9
0
ファイル: Template.cs プロジェクト: reicheltp/Nustache
        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();
        }
コード例 #10
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        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);
        }
コード例 #11
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        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);
        }
コード例 #12
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        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());
        }
コード例 #13
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        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);
        }
コード例 #14
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();
        }
コード例 #15
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        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();
        }
コード例 #16
0
 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;
 }
コード例 #17
0
ファイル: RenderContext.cs プロジェクト: jdiamond/Nustache
 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;
 }
コード例 #18
0
ファイル: RenderContext.cs プロジェクト: jdiamond/Nustache
        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();
        }
コード例 #19
0
ファイル: Render.cs プロジェクト: Pxtl/Nustache.SqlClr
        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);
            }
        }
コード例 #20
0
ファイル: Render.cs プロジェクト: Romanx/Nustache
        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);
            }
        }
コード例 #21
0
        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();
        }
コード例 #22
0
        public void Render(object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour)
        {
            var context = new RenderContext(this, data, writer, templateLocator, renderContextBehaviour);

            Render(context);

            writer.Flush();
        }
コード例 #23
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());
 }