2013-01-09 02:33:53 +00:00
|
|
|
|
using System;
|
2013-01-10 02:17:45 +00:00
|
|
|
|
using System.Collections.Generic;
|
2013-01-09 02:33:53 +00:00
|
|
|
|
|
|
|
|
|
namespace mustache
|
|
|
|
|
{
|
2013-01-10 02:17:45 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generates a static block of text.
|
|
|
|
|
/// </summary>
|
2013-01-09 02:33:53 +00:00
|
|
|
|
internal sealed class StaticGenerator : IGenerator
|
|
|
|
|
{
|
2013-01-10 02:17:45 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of a StaticGenerator.
|
|
|
|
|
/// </summary>
|
2013-01-12 19:53:12 +00:00
|
|
|
|
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()
|
2013-01-09 02:33:53 +00:00
|
|
|
|
{
|
2013-01-12 19:53:12 +00:00
|
|
|
|
if (Node != null)
|
|
|
|
|
{
|
|
|
|
|
Node.List.Remove(Node);
|
|
|
|
|
Node = null;
|
|
|
|
|
}
|
2013-01-09 02:33:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-10 02:17:45 +00:00
|
|
|
|
string IGenerator.GetText(IFormatProvider provider, KeyScope scope)
|
2013-01-09 02:33:53 +00:00
|
|
|
|
{
|
2013-01-12 19:53:12 +00:00
|
|
|
|
return Value;
|
2013-01-09 02:33:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|