コード例 #1
0
ファイル: Block.cs プロジェクト: mwadams/dotliquid
        /// <summary>
        /// Renders all the objects in the list
        /// </summary>
        /// <param name="list"></param>
        /// <param name="context"></param>
        /// <param name="result"></param>
        protected async Task RenderAllAsync(List <object> list, Context context, TextWriter result)
        {
            foreach (var token in list)
            {
                context.CheckTimeout();

                try
                {
                    if (token is IRenderable renderableToken)
                    {
                        await renderableToken.RenderAsync(context, result).ConfigureAwait(false);
                    }
                    else
                    {
                        await result.WriteAsync(token.ToString()).ConfigureAwait(false);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException is LiquidException)
                    {
                        ex = ex.InnerException;
                    }
                    await result.WriteAsync(context.HandleError(ex)).ConfigureAwait(false);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Renders all the objects in the list
        /// </summary>
        /// <param name="list"></param>
        /// <param name="context"></param>
        /// <param name="result"></param>
        protected void RenderAll(List <object> list, Context context, TextWriter result)
        {
            foreach (var token in list)
            {
                context.CheckTimeout();

                try
                {
                    if (token is IRenderable renderableToken)
                    {
                        renderableToken.Render(context, result);
                    }
                    else
                    {
                        result.Write(token.ToString());
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException is LiquidException)
                    {
                        ex = ex.InnerException;
                    }
                    result.Write(context.HandleError(ex));
                }
            }
        }