/// <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) { 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)); } } }
/// <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); } } }
protected void RenderAll(List <object> list, Context context, TextWriter result) { list.ForEach(token => { try { if (token is IRenderable) { ((IRenderable)token).Render(context, result); } else { result.Write(token.ToString()); } } catch (Exception ex) { if (ex.InnerException is LiquidException) { ex = ex.InnerException; } result.Write(context.HandleError(ex)); } }); }
protected void RenderAll(List<object> list, Context context, StringBuilder result) { list.ForEach(token => { try { if (token is IRenderable) ((IRenderable)token).Render(context, result); else result.Append(token.ToString()); } catch (Exception ex) { if (ex.InnerException is LiquidException) ex = ex.InnerException; result.Append(context.HandleError(ex)); } }); }
protected void RenderAll(List<object> list, Context context, TextWriter result) { foreach (var token in list) { try { if (token is IRenderable) ((IRenderable)token).Render(context, result); else result.Write(token.ToString()); } catch (Exception ex) { if (ex.InnerException is LiquidException) ex = ex.InnerException; result.Write(context.HandleError(ex)); } } }