Exemplo n.º 1
0
        /// <summary>
        /// Converts back this template to a textual representation. This is the inverse of <see cref="Parse"/>.
        /// </summary>
        /// <param name="options">The rendering options</param>
        /// <returns>The template converted back to a textual representation of the template</returns>
        public string ToText(TemplateRewriterOptions options = default(TemplateRewriterOptions))
        {
            CheckErrors();
            TextWriterOutput        writer        = new TextWriterOutput();
            TemplateRewriterContext renderContext = new TemplateRewriterContext(writer, options);

            renderContext.Write(Page);

            return(writer.ToString());
        }
Exemplo n.º 2
0
        public TemplateRewriterContext(IScriptOutput output, TemplateRewriterOptions options = default(TemplateRewriterOptions))
        {
            _isWhileLoop = new FastStack <bool>(4);
            Options      = options;
            if (options.Mode != ScriptMode.Default)
            {
                throw new ArgumentException(string.Format(RS.UnsupportedRenderMode, options.Mode));
            }

            _output = output;
        }