Ejemplo 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();
            var writer        = new TextWriterOutput();
            var renderContext = new TemplateRewriterContext(writer, options);

            renderContext.Write(Page);

            return(writer.ToString());
        }
 public TemplateRewriterContext(IScriptOutput output, TemplateRewriterOptions options = default(TemplateRewriterOptions))
 {
     _isWhileLoop = new FastStack <bool>(4);
     Options      = options;
     if (options.Mode != ScriptMode.Default)
     {
         throw new ArgumentException($"The rendering mode `{options.Mode}` is not supported. Only `ScriptMode.Default` is currently supported");
     }
     _output = output;
 }