Exemple #1
0
        void IMustacheGenerator.GetText(TextWriter writer, Scope keyScope, Scope contextScope, Action <Substitution> postProcessor)
        {
            Dictionary <string, object> arguments = _arguments.GetArguments(keyScope, contextScope);
            IEnumerable <NestedContext> contexts  = _definition.GetChildContext(writer, keyScope, arguments, contextScope);
            List <IMustacheGenerator>   generators;

            if (_definition.ShouldGeneratePrimaryGroup(arguments))
            {
                generators = _primaryGenerators;
            }
            else
            {
                generators = new List <IMustacheGenerator>();
                if (_subMustacheGenerator != null)
                {
                    generators.Add(_subMustacheGenerator);
                }
            }
            foreach (NestedContext context in contexts)
            {
                foreach (IMustacheGenerator generator in generators)
                {
                    generator.GetText(context.Writer ?? writer, context.KeyScope ?? keyScope, context.ContextScope, postProcessor);
                }

                if (context.WriterNeedsConsidated)
                {
                    writer.Write(_definition.ConsolidateWriter(context.Writer ?? writer, arguments));
                }
            }
        }
Exemple #2
0
        void IMustacheGenerator.GetText(TextWriter writer, Scope scope, Scope context, Action <Substitution> postProcessor)
        {
            Dictionary <string, object> arguments;

            if (_definition.IsSetter)
            {
                arguments = _arguments.GetArgumentKeyNames();
            }
            else
            {
                arguments = _arguments.GetArguments(scope, context);
            }
            _definition.GetText(writer, arguments, context);
        }