public override void Write(TextWriter writer, Context context) { var items = context.GetValues(_expression).ToArray(); int index = 0; foreach (var item in items) { try { var meta = new Dictionary <string, object>(StringComparer.Ordinal) { { "@index", index }, { "@first", index == 0 }, { "@last", index == items.Length - 1 } }; context.Push(item, meta); _content.Write(writer, context); index++; } finally { context.Pop(); } } }
public override void Write(TextWriter writer, Context context) { if (context.GetValue(_expression).IsFalse()) { _content.Write(writer, context); } else { _else.Write(writer, context); } }
public override void Write(TextWriter writer, Context context) { var value = context.GetValue(_expression); if (value.IsNullOrNoValue()) { return; } try { context.Push(value, null); _content.Write(writer, context); } catch (Exception) { context.Pop(); } }