Esempio n. 1
0
        public override LiquidExpressionResult ApplyTo(ITemplateContext ctx, LiquidCollection liquidArrayExpression)
        {
            String separator = _separator == null ? "" : _separator.StringVal;

            var vals = liquidArrayExpression.Select(ValueCaster.RenderAsString);

            return(LiquidExpressionResult.Success(LiquidString.Create(String.Join(separator, vals))));
        }
Esempio n. 2
0
        public override LiquidExpressionResult ApplyTo(ITemplateContext ctx, LiquidCollection liquidArrayExpression)
        {
            var list = liquidArrayExpression.Select(x => x.HasValue
                ? FieldAccessor.TryField(ctx, x.Value, _selector.StringVal)
                : LiquidExpressionResult.ErrorOrNone(ctx, _selector.StringVal)).ToList();

            //new None<ILiquidValue>()).ToList();
            return(list.Any(x => x.IsError) ?
                   list.First(x => x.IsError) :
                   LiquidExpressionResult.Success(new LiquidCollection(list.Select(x => x.SuccessResult).ToList())));
        }