/// <summary> /// Gets the text to output. /// </summary> /// <param name="writer">The writer to write the output to.</param> /// <param name="arguments">The arguments passed to the tag.</param> /// <param name="contextScope">Extra data passed along with the context.</param> public override void GetText(TextWriter writer, Dictionary<string, object> arguments, Scope contextScope) { if (contextScope.TryFind("index", out object index)) { writer.Write(index); } }
/// <summary> /// Gets the text to output. /// </summary> /// <param name="writer">The writer to write the output to.</param> /// <param name="arguments">The arguments passed to the tag.</param> /// <param name="contextScope">Extra data passed along with the context.</param> public override void GetText(TextWriter writer, Dictionary<string, object> arguments, Scope contextScope) { object index; if (contextScope.TryFind("index", out index)) { writer.Write(Convert.ToInt32(index) % 2 == 0? "even" : "odd"); } }
/// <summary> /// Gets the text to output. /// </summary> /// <param name="writer">The writer to write the output to.</param> /// <param name="arguments">The arguments passed to the tag.</param> /// <param name="contextScope">Extra data passed along with the context.</param> public override void GetText(TextWriter writer, Dictionary<string, object> arguments, Scope contextScope) { object index; if (contextScope.TryFind("index", out index)) { writer.Write(index); } }
/// <summary> /// Gets the text to output. /// </summary> /// <param name="writer">The writer to write the output to.</param> /// <param name="arguments">The arguments passed to the tag.</param> /// <param name="contextScope">Extra data passed along with the context.</param> public override void GetText(TextWriter writer, Dictionary <string, object> arguments, Scope contextScope) { object length; if (contextScope.TryFind("length", out length)) { writer.Write(length); } }
/// <summary> /// Gets the text to output. /// </summary> /// <param name="writer">The writer to write the output to.</param> /// <param name="arguments">The arguments passed to the tag.</param> /// <param name="contextScope">Extra data passed along with the context.</param> public override void GetText(TextWriter writer, Dictionary <string, object> arguments, Scope contextScope) { object val; if (contextScope.TryFind("value", out val)) { writer.Write(val as string); } }
public override IEnumerable <NestedContext> GetChildContext(TextWriter writer, Scope keyScope, Dictionary <string, object> arguments, Scope contextScope) { object appendable; if (contextScope.TryFind("beforeappend", out appendable)) { if (appendable.ToString().ToLowerInvariant() != "true") { return(new List <NestedContext>()); } return(base.GetChildContext(writer, keyScope, arguments, contextScope)); } return(base.GetChildContext(writer, keyScope, arguments, contextScope)); }
public override void GetText(TextWriter writer, Dictionary<string, object> arguments, Scope context) { var str = arguments["string"] as string; if (str == null) return; object indexObj; if (!context.TryFind("index", out indexObj)) return; var index = (int) indexObj; if (index > 0) { writer.Write(str); } }