2013-05-03 12:44:51 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Mustache
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generates a static block of text.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal sealed class StaticGenerator : IGenerator
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of a StaticGenerator.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public StaticGenerator()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the linked list node containing the current generator.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public LinkedListNode<IGenerator> Node
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the static text.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Value
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes the static text from the final output.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Prune()
|
|
|
|
|
{
|
|
|
|
|
if (Node != null)
|
|
|
|
|
{
|
|
|
|
|
Node.List.Remove(Node);
|
|
|
|
|
Node = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IGenerator.GetText(KeyScope scope, TextWriter writer)
|
|
|
|
|
{
|
|
|
|
|
writer.Write(Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|