mirror of
https://github.com/art-ist/mustache-sharp.git
synced 2024-06-16 21:05:32 +00:00

This is the code almost verbatim from the NList project. This project is due for a major overhaul, but I don't know the order I will be breaking out NList in the upcoming weeks.
34 lines
747 B
C#
34 lines
747 B
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace mustache
|
|
{
|
|
internal sealed class WithBuilder : IBuilder
|
|
{
|
|
private readonly CompoundBuilder builder;
|
|
|
|
public WithBuilder()
|
|
{
|
|
builder = new CompoundBuilder();
|
|
}
|
|
|
|
public string Key
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public CompoundBuilder Builder
|
|
{
|
|
get { return builder; }
|
|
}
|
|
|
|
public void Build(Scope scope, StringBuilder output, IFormatProvider provider)
|
|
{
|
|
object value = scope.Find(Key);
|
|
Scope valueScope = scope.CreateChildScope(value);
|
|
builder.Build(valueScope, output, provider);
|
|
}
|
|
}
|
|
}
|