예제 #1
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>
        /// <param name="options">The options defining the behaviour of the renderer.</param>
        /// <remarks>
        /// The <paramref name="writer" /> is flushed, but not closed or disposed.
        /// </remarks>
        public void Render(object data, TextWriter writer, TemplateLocator templateLocator, Options options)
        {
            var context = new RenderContext(this, data, writer, templateLocator, options);

            Render(context);

            writer.Flush();
        }
예제 #2
0
        public RenderContext(
            Section section,
            object data,
            TextWriter writer,
            TemplateLocator templateLocator,
            Options options)
        {
            _sectionStack.Push(section);
            _dataStack.Push(data);
            _writer = writer;
            _templateLocator = templateLocator;
            _includeLevel = 0;

            CurrentOptions = options;
        }