using System; using System.Collections.Generic; using System.IO; namespace Mustache { /// /// Defines a tag that declares a named value in the current context. /// internal sealed class SetTagDefinition : InlineTagDefinition { private const string nameParameter = "name"; private static readonly TagParameter name = new TagParameter(nameParameter) { IsRequired = true }; /// /// Initializes a new instance of an SetTagDefinition. /// public SetTagDefinition() : base("set", true) { } protected override bool GetIsSetter() { return true; } protected override IEnumerable GetParameters() { return new TagParameter[] { name }; } /// /// Gets the text to output. /// /// The writer to write the output to. /// The arguments passed to the tag. /// Extra data passed along with the context. public override void GetText(TextWriter writer, Dictionary arguments, Scope contextScope) { string name = (string)arguments[nameParameter]; // TODO - get the value for the variable object value = null; contextScope.Set(name, value); } } }