Inheritance: BlockAccumulatorContext
コード例 #1
0
 public static BlockAccumulatorContext Create(Expression item, HandlebarsConfiguration configuration)
 {
     BlockAccumulatorContext context = null;
     if (IsConditionalBlock(item))
     {
         context = new ConditionalBlockAccumulatorContext(item);
     }
     else if (IsPartialBlock(item))
     {
         context = new PartialBlockAccumulatorContext(item);
     }
     else if (IsBlockHelper(item, configuration))
     {
         context = new BlockHelperAccumulatorContext(item);
     }
     else if (IsIteratorBlock(item))
     {
         context = new IteratorBlockAccumulatorContext(item);
     }
     else if (IsDeferredBlock(item))
     {
         context = new DeferredBlockAccumulatorContext(item);
     }
     return context;
 }
コード例 #2
0
        public static BlockAccumulatorContext Create(Expression item, HandlebarsConfiguration configuration)
        {
            BlockAccumulatorContext context = null;

            if (IsConditionalBlock(item))
            {
                context = new ConditionalBlockAccumulatorContext(item);
            }
            else if (IsPartialBlock(item))
            {
                context = new PartialBlockAccumulatorContext(item);
            }
            else if (IsBlockHelper(item, configuration))
            {
                context = new BlockHelperAccumulatorContext(item);
            }
            else if (IsIteratorBlock(item))
            {
                context = new IteratorBlockAccumulatorContext(item);
            }
            else if (IsDeferredBlock(item))
            {
                context = new DeferredBlockAccumulatorContext(item);
            }
            return(context);
        }
コード例 #3
0
        public static BlockAccumulatorContext Create(Expression item, Expression parentItem, ICompiledHandlebarsConfiguration configuration)
        {
            BlockAccumulatorContext context = null;

            if (IsConditionalBlock(item))
            {
                context = new ConditionalBlockAccumulatorContext(item);
            }
            else if (IsPartialBlock(item))
            {
                context = new PartialBlockAccumulatorContext(item);
            }
            else if (IsIteratorBlock(item))
            {
                context = new IteratorBlockAccumulatorContext(item);
            }
            else if (IsBlockHelper(item, configuration))
            {
                context = new BlockHelperAccumulatorContext(item);
            }
            else if (IsDetachedClosingElement(item, parentItem, out var closingElement))
            {
                throw new HandlebarsCompilerException($"A closing element '{closingElement}' was found without a matching open element");
            }

            return(context);
        }