2013-01-10 02:17:45 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2013-01-16 20:10:25 +00:00
|
|
|
|
using System.IO;
|
2013-01-10 02:17:45 +00:00
|
|
|
|
|
|
|
|
|
namespace mustache
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generates the text for a tag that only exists on a single line.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal sealed class InlineGenerator : IGenerator
|
|
|
|
|
{
|
|
|
|
|
private readonly TagDefinition _definition;
|
|
|
|
|
private readonly ArgumentCollection _arguments;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of an InlineGenerator.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="definition">The tag to render the text for.</param>
|
|
|
|
|
/// <param name="arguments">The arguments passed to the tag.</param>
|
|
|
|
|
public InlineGenerator(TagDefinition definition, ArgumentCollection arguments)
|
|
|
|
|
{
|
|
|
|
|
_definition = definition;
|
|
|
|
|
_arguments = arguments;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-16 20:10:25 +00:00
|
|
|
|
void IGenerator.GetText(KeyScope scope, TextWriter writer)
|
2013-01-10 02:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
Dictionary<string, object> arguments = _arguments.GetArguments(scope);
|
2013-01-16 20:10:25 +00:00
|
|
|
|
_definition.GetText(writer, arguments);
|
2013-01-10 02:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|