/// <summary> /// Initializes a new instance of the <see cref="RendererSettings"/> class. /// </summary> /// <param name="valueGetters">The value getters</param> /// <param name="truthyChecks">The truthy checks</param> /// <param name="templateLoader">The template loader</param> /// <param name="partialLoader">The partial loader</param> /// <param name="maxRecursionDepth">The max recursion depth</param> /// <param name="renderSettings">The render settings</param> /// <param name="enumerationConverters">The enumeration converters</param> /// <param name="ignoreCaseOnLookup">Should case be ignored on lookup</param> /// <param name="parser">The mustache parser to use</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="defaultTags">The default tags to use during parsing</param> /// <param name="parserPipeline">The parser pipeline to use during parsing</param> public RendererSettings( Dictionary <Type, ValueGetterDelegate> valueGetters, Dictionary <Type, List <Func <object, bool> > > truthyChecks, IStubbleLoader templateLoader, IStubbleLoader partialLoader, uint maxRecursionDepth, RenderSettings renderSettings, Dictionary <Type, Func <object, IEnumerable> > enumerationConverters, bool ignoreCaseOnLookup, IMustacheParser parser, TokenRendererPipeline <Context> rendererPipeline, Classes.Tags defaultTags, ParserPipeline parserPipeline) : base( templateLoader, partialLoader, maxRecursionDepth, ignoreCaseOnLookup, parser, defaultTags, parserPipeline) { ValueGetters = valueGetters.ToImmutableDictionary(); TruthyChecks = truthyChecks.ToImmutableDictionary(k => k.Key, v => v.Value.ToImmutableArray()); RenderSettings = renderSettings; EnumerationConverters = enumerationConverters.ToImmutableDictionary(); RendererPipeline = rendererPipeline; }
/// <summary> /// Initializes a new instance of the <see cref="RendererSettings"/> class. /// </summary> /// <param name="valueGetters">The value getters</param> /// <param name="truthyChecks">The truthy checks</param> /// <param name="templateLoader">The template loader</param> /// <param name="partialLoader">The partial loader</param> /// <param name="maxRecursionDepth">The max recursion depth</param> /// <param name="renderSettings">The render settings</param> /// <param name="enumerationConverters">The enumeration converters</param> /// <param name="ignoreCaseOnLookup">Should case be ignored on lookup</param> /// <param name="parser">The mustache parser to use</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="defaultTags">The default tags to use during parsing</param> /// <param name="parserPipeline">The parser pipeline to use during parsing</param> public RendererSettings( Dictionary <Type, Func <object, string, object> > valueGetters, IEnumerable <Func <object, bool?> > truthyChecks, IStubbleLoader templateLoader, IStubbleLoader partialLoader, uint maxRecursionDepth, RenderSettings renderSettings, Dictionary <Type, Func <object, IEnumerable> > enumerationConverters, bool ignoreCaseOnLookup, IMustacheParser parser, TokenRendererPipeline rendererPipeline, Classes.Tags defaultTags, ParserPipeline parserPipeline) { ValueGetters = valueGetters.ToImmutableDictionary(); TruthyChecks = truthyChecks.ToImmutableArray(); TemplateLoader = templateLoader; PartialTemplateLoader = partialLoader; MaxRecursionDepth = maxRecursionDepth; RenderSettings = renderSettings; EnumerationConverters = enumerationConverters.ToImmutableDictionary(); IgnoreCaseOnKeyLookup = ignoreCaseOnLookup; Parser = parser; RendererPipeline = rendererPipeline; DefaultTags = defaultTags; ParserPipeline = parserPipeline; }
/// <summary> /// Initializes a new instance of the <see cref="RendererSettings"/> class. /// </summary> /// <param name="valueGetters">The value getters</param> /// <param name="truthyChecks">The truthy checks</param> /// <param name="templateLoader">The template loader</param> /// <param name="partialLoader">The partial loader</param> /// <param name="maxRecursionDepth">The max recursion depth</param> /// <param name="renderSettings">The render settings</param> /// <param name="enumerationConverters">The enumeration converters</param> /// <param name="ignoreCaseOnLookup">Should case be ignored on lookup</param> /// <param name="parser">The mustache parser to use</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="defaultTags">The default tags to use during parsing</param> /// <param name="parserPipeline">The parser pipeline to use during parsing</param> /// <param name="sectionBlacklistTypes">The blacklisted section types</param> /// <param name="encodingFunction">A function for encoding strings</param> public RendererSettings( Dictionary <Type, ValueGetterDelegate> valueGetters, Dictionary <Type, List <Func <object, bool> > > truthyChecks, IStubbleLoader templateLoader, IStubbleLoader partialLoader, uint maxRecursionDepth, RenderSettings renderSettings, Dictionary <Type, Func <object, IEnumerable> > enumerationConverters, bool ignoreCaseOnLookup, IMustacheParser parser, TokenRendererPipeline <Context> rendererPipeline, Tags defaultTags, ParserPipeline parserPipeline, HashSet <Type> sectionBlacklistTypes, Func <string, string> encodingFunction) : base( templateLoader, partialLoader, maxRecursionDepth, ignoreCaseOnLookup, parser, defaultTags, parserPipeline, sectionBlacklistTypes) { OrderedValueGetters = valueGetters.Keys.OrderBy(t => t, TypeBySubclassAndAssignableImpl.Default).ToImmutableArray(); ValueGetters = valueGetters.ToImmutableDictionary(); TruthyChecks = truthyChecks.ToImmutableDictionary(k => k.Key, v => v.Value.ToImmutableArray()); RenderSettings = renderSettings; EnumerationConverters = enumerationConverters.ToImmutableDictionary(); RendererPipeline = rendererPipeline; EncodingFuction = encodingFunction; }
/// <summary> /// Initializes a new instance of the <see cref="TextRendererBase"/> class. /// </summary> /// <param name="writer">The text writer to use</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="maxDepth">The max recursion depth for the renderer</param> protected TextRendererBase(TextWriter writer, TokenRendererPipeline rendererPipeline, uint maxDepth) : base(rendererPipeline) { Writer = writer ?? throw new ArgumentNullException(nameof(writer)); // By default we output a newline with '\n' only even on Windows platforms Writer.NewLine = "\n"; this.maxDepth = maxDepth; }
/// <summary> /// Initializes a new instance of the <see cref="CompilationRenderer"/> class. /// </summary> /// <param name="rendererPipeline">The pipeline for the renderer</param> /// <param name="maxDepth">The max depth of recursion the renderer can go</param> protected CompilationRenderer(TokenRendererPipeline <CompilerContext> rendererPipeline, uint maxDepth) : base(rendererPipeline) { MaxDepth = maxDepth; Builder = Expression.Variable(typeof(StringBuilder), "sb"); Expressions = new List <Expression>() { Expression.Assign(Builder, Expression.New(typeof(StringBuilder))) }; }
/// <summary> /// Initializes a new instance of the <see cref="CompilerSettings"/> class. /// </summary> /// <param name="valueGetters">The value getters</param> /// <param name="truthyChecks">The truthy checks</param> /// <param name="enumerationConverters">The enumeration converters</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="templateLoader">The template loader</param> /// <param name="partialLoader">The partial loader</param> /// <param name="maxRecursionDepth">The max recursion depth</param> /// <param name="ignoreCaseOnLookup">Should case be ignored on lookup</param> /// <param name="parser">The mustache parser to use</param> /// <param name="defaultTags">The default tags to use during parsing</param> /// <param name="parserPipeline">The parser pipeline to use during parsing</param> /// <param name="compilationSettings">The default compilation settings for each render</param> public CompilerSettings( Dictionary <Type, DefaultSettings.ValueGetterDelegate> valueGetters, Dictionary <Type, List <LambdaExpression> > truthyChecks, Dictionary <Type, EnumerationConverter> enumerationConverters, TokenRendererPipeline <CompilerContext> rendererPipeline, IStubbleLoader templateLoader, IStubbleLoader partialLoader, uint maxRecursionDepth, bool ignoreCaseOnLookup, IMustacheParser parser, Tags defaultTags, ParserPipeline parserPipeline, CompilationSettings compilationSettings) : base(templateLoader, partialLoader, maxRecursionDepth, ignoreCaseOnLookup, parser, defaultTags, parserPipeline) { ValueGetters = valueGetters.ToImmutableDictionary(); TruthyChecks = truthyChecks.ToImmutableDictionary(k => k.Key, v => v.Value.ToImmutableList()); EnumerationConverters = enumerationConverters.ToImmutableDictionary(); RendererPipeline = rendererPipeline; CompilationSettings = compilationSettings; }
/// <summary> /// Initializes a new instance of the <see cref="TextRendererBase{T}"/> class. /// </summary> /// <param name="writer">The writer to initalize with</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="maxDepth">The max recursion depth for the renderer</param> protected TextRendererBase(TextWriter writer, TokenRendererPipeline <Context> rendererPipeline, uint maxDepth) : base(writer, rendererPipeline, maxDepth) { buffer = new char[1024]; }
/// <summary> /// Initializes a new instance of the <see cref="StringRender"/> class /// with the provided text writer and a given depth /// </summary> /// <param name="writer">The writer to use</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> /// <param name="maxDepth">The max recursion depth for the renderer</param> public StringRender(TextWriter writer, TokenRendererPipeline rendererPipeline, uint maxDepth) : base(writer, rendererPipeline, maxDepth) { }
/// <summary> /// Initializes a new instance of the <see cref="StringRender"/> class /// with the provided text writer and the default depth /// </summary> /// <param name="writer">The writer to use</param> /// <param name="rendererPipeline">The renderer pipeline to use</param> public StringRender(TextWriter writer, TokenRendererPipeline rendererPipeline) : this(writer, rendererPipeline, 256) { }
/// <summary> /// Initializes a new instance of the <see cref="CompilationRenderer{T}"/> class. /// </summary> /// <param name="rendererPipeline">The pipeline for the renderer</param> /// <param name="maxDepth">The max depth of recursion the renderer can go</param> public CompilationRenderer(TokenRendererPipeline <CompilerContext> rendererPipeline, uint maxDepth) : base(rendererPipeline, maxDepth) { }