Migrate to .NET Standard 2.0.
This commit is contained in:
parent
107b588019
commit
21097a18d7
|
@ -100,6 +100,7 @@ ClientBin
|
||||||
~$*
|
~$*
|
||||||
*.dbmdl
|
*.dbmdl
|
||||||
Generated_Code #added for RIA/Silverlight projects
|
Generated_Code #added for RIA/Silverlight projects
|
||||||
|
.vs
|
||||||
|
|
||||||
# Backup & report files from converting an old project file to a newer
|
# Backup & report files from converting an old project file to a newer
|
||||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +0,0 @@
|
||||||
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ../mustache-sharp.sln /p:Configuration=Release
|
|
||||||
nuget pack ../mustache-sharp/mustache-sharp.csproj -Properties Configuration=Release
|
|
||||||
nuget push *.nupkg -Source https://www.nuget.org/api/v2/package
|
|
||||||
del *.nupkg
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
&dotnet pack "..\MustacheSharp\MustacheSharp.csproj" --configuration Release --output $PWD
|
||||||
|
|
||||||
|
.\NuGet.exe push mustache-sharp.*.nupkg -Source https://www.nuget.org/api/v2/package
|
||||||
|
|
||||||
|
Remove-Item mustache-sharp.*.nupkg
|
|
@ -1249,10 +1249,12 @@ Last";
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestCompile_Each_ContextAfterIndexTag()
|
public void TestCompile_Each_ContextAfterIndexTag()
|
||||||
{
|
{
|
||||||
List<TestObject> objects = new List<TestObject>();
|
List<TestObject> objects = new List<TestObject>()
|
||||||
objects.Add(new TestObject { Name = "name1", Val = "val1" });
|
{
|
||||||
objects.Add(new TestObject { Name = "name2", Val = "val2" });
|
new TestObject { Name = "name1", Val = "val1" },
|
||||||
objects.Add(new TestObject { Name = "name3", Val = "val3" });
|
new TestObject { Name = "name2", Val = "val2" },
|
||||||
|
new TestObject { Name = "name3", Val = "val3" }
|
||||||
|
};
|
||||||
|
|
||||||
const string template = @"{{#each this}}
|
const string template = @"{{#each this}}
|
||||||
Item Number: {{#index}}<br />{{#newline}}
|
Item Number: {{#index}}<br />{{#newline}}
|
|
@ -0,0 +1,25 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
|
||||||
|
<AssemblyOriginatorKeyFile>MustacheSharp.Tests.snk</AssemblyOriginatorKeyFile>
|
||||||
|
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="1.2.1" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="1.2.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\MustacheSharp\MustacheSharp.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Binary file not shown.
|
@ -97,8 +97,7 @@ namespace Mustache.Test
|
||||||
{
|
{
|
||||||
var source = new Dictionary<string, string>() { { "Name", "Bob" } };
|
var source = new Dictionary<string, string>() { { "Name", "Bob" } };
|
||||||
IDictionary<string, object> result = UpcastDictionary.Create(source);
|
IDictionary<string, object> result = UpcastDictionary.Create(source);
|
||||||
object value;
|
bool found = result.TryGetValue("Name", out object value);
|
||||||
bool found = result.TryGetValue("Name", out value);
|
|
||||||
Assert.IsTrue(found, "The key should have been found.");
|
Assert.IsTrue(found, "The key should have been found.");
|
||||||
Assert.AreSame(source["Name"], value, "The value in the underlying dictionary should have been returned.");
|
Assert.AreSame(source["Name"], value, "The value in the underlying dictionary should have been returned.");
|
||||||
}
|
}
|
||||||
|
@ -108,8 +107,7 @@ namespace Mustache.Test
|
||||||
{
|
{
|
||||||
var source = new Dictionary<string, int>() { { "Age", 100 } };
|
var source = new Dictionary<string, int>() { { "Age", 100 } };
|
||||||
IDictionary<string, object> result = UpcastDictionary.Create(source);
|
IDictionary<string, object> result = UpcastDictionary.Create(source);
|
||||||
object value;
|
bool found = result.TryGetValue("Name", out object value);
|
||||||
bool found = result.TryGetValue("Name", out value);
|
|
||||||
Assert.IsFalse(found, "The key should not have been found.");
|
Assert.IsFalse(found, "The key should not have been found.");
|
||||||
Assert.IsNull(value, "The value should be null even if the actual type is a struct.");
|
Assert.IsNull(value, "The value should be null even if the actual type is a struct.");
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.27703.2042
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MustacheSharp", "MustacheSharp\MustacheSharp.csproj", "{3013083D-0FB2-4A71-AFD7-6B7875112553}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MustacheSharp.Tests", "MustacheSharp.Tests\MustacheSharp.Tests.csproj", "{AFCE0299-A701-4648-9D3D-CC0084F85259}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3013083D-0FB2-4A71-AFD7-6B7875112553}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3013083D-0FB2-4A71-AFD7-6B7875112553}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3013083D-0FB2-4A71-AFD7-6B7875112553}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3013083D-0FB2-4A71-AFD7-6B7875112553}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AFCE0299-A701-4648-9D3D-CC0084F85259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AFCE0299-A701-4648-9D3D-CC0084F85259}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AFCE0299-A701-4648-9D3D-CC0084F85259}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AFCE0299-A701-4648-9D3D-CC0084F85259}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {2A85C61F-B68F-44E2-879C-5DEE6EB01C56}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
|
@ -9,15 +8,7 @@ namespace Mustache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ArgumentCollection
|
internal sealed class ArgumentCollection
|
||||||
{
|
{
|
||||||
private readonly Dictionary<TagParameter, IArgument> _argumentLookup;
|
private readonly Dictionary<TagParameter, IArgument> _argumentLookup = new Dictionary<TagParameter, IArgument>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of an ArgumentCollection.
|
|
||||||
/// </summary>
|
|
||||||
public ArgumentCollection()
|
|
||||||
{
|
|
||||||
_argumentLookup = new Dictionary<TagParameter, IArgument>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Associates the given parameter to the key placeholder.
|
/// Associates the given parameter to the key placeholder.
|
||||||
|
@ -36,16 +27,12 @@ namespace Mustache
|
||||||
/// <param name="parameterName">The name of the parameter.</param>
|
/// <param name="parameterName">The name of the parameter.</param>
|
||||||
public string GetKey(TagParameter parameter)
|
public string GetKey(TagParameter parameter)
|
||||||
{
|
{
|
||||||
IArgument argument;
|
if (_argumentLookup.TryGetValue(parameter, out IArgument argument) && argument != null)
|
||||||
if (_argumentLookup.TryGetValue(parameter, out argument) && argument != null)
|
|
||||||
{
|
{
|
||||||
return argument.GetKey();
|
return argument.GetKey();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Substitutes the key placeholders with their respective values.
|
/// Substitutes the key placeholders with their respective values.
|
|
@ -11,7 +11,7 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
private readonly TagDefinition _definition;
|
private readonly TagDefinition _definition;
|
||||||
private readonly ArgumentCollection _arguments;
|
private readonly ArgumentCollection _arguments;
|
||||||
private readonly List<IGenerator> _primaryGenerators;
|
private readonly List<IGenerator> _primaryGenerators = new List<IGenerator>();
|
||||||
private IGenerator _subGenerator;
|
private IGenerator _subGenerator;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,7 +23,6 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
_definition = definition;
|
_definition = definition;
|
||||||
_arguments = arguments;
|
_arguments = arguments;
|
||||||
_primaryGenerators = new List<IGenerator>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
|
@ -69,8 +69,7 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IEnumerable enumerable = condition as IEnumerable;
|
if (condition is IEnumerable enumerable)
|
||||||
if (enumerable != null)
|
|
||||||
{
|
{
|
||||||
return enumerable.Cast<object>().Any();
|
return enumerable.Cast<object>().Any();
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines a tag that can contain inner text.
|
/// Defines a tag that can contain inner text.
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a context within a template.
|
/// Represents a context within a template.
|
||||||
|
@ -21,11 +19,11 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tag that created the context.
|
/// Gets the tag that created the context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TagName { get; private set; }
|
public string TagName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the argument used to create the context.
|
/// Gets the argument used to create the context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ContextParameter[] Parameters { get; private set; }
|
public ContextParameter[] Parameters { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Holds information describing a parameter that creates a new context.
|
/// Holds information describing a parameter that creates a new context.
|
||||||
|
@ -21,11 +19,11 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the parameter that is used to create a new context.
|
/// Gets the parameter that is used to create a new context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Parameter { get; private set; }
|
public string Parameter { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the key whose corresponding value will be used to create the context.
|
/// Gets the key whose corresponding value will be used to create the context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Argument { get; private set; }
|
public string Argument { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
@ -53,8 +52,7 @@ namespace Mustache
|
||||||
Scope contextScope)
|
Scope contextScope)
|
||||||
{
|
{
|
||||||
object value = arguments[collectionParameter];
|
object value = arguments[collectionParameter];
|
||||||
IEnumerable enumerable = value as IEnumerable;
|
if (!(value is IEnumerable enumerable))
|
||||||
if (enumerable == null)
|
|
||||||
{
|
{
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
|
@ -12,19 +12,15 @@ namespace Mustache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class FormatCompiler
|
public sealed class FormatCompiler
|
||||||
{
|
{
|
||||||
private readonly Dictionary<string, TagDefinition> _tagLookup;
|
private readonly Dictionary<string, TagDefinition> _tagLookup = new Dictionary<string, TagDefinition>();
|
||||||
private readonly Dictionary<string, Regex> _regexLookup;
|
private readonly Dictionary<string, Regex> _regexLookup = new Dictionary<string, Regex>();
|
||||||
private readonly MasterTagDefinition _masterDefinition;
|
private readonly MasterTagDefinition _masterDefinition = new MasterTagDefinition();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of a FormatCompiler.
|
/// Initializes a new instance of a FormatCompiler.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormatCompiler()
|
public FormatCompiler()
|
||||||
{
|
{
|
||||||
_tagLookup = new Dictionary<string, TagDefinition>();
|
|
||||||
_regexLookup = new Dictionary<string, Regex>();
|
|
||||||
_masterDefinition = new MasterTagDefinition();
|
|
||||||
|
|
||||||
IfTagDefinition ifDefinition = new IfTagDefinition();
|
IfTagDefinition ifDefinition = new IfTagDefinition();
|
||||||
_tagLookup.Add(ifDefinition.Name, ifDefinition);
|
_tagLookup.Add(ifDefinition.Name, ifDefinition);
|
||||||
ElifTagDefinition elifDefinition = new ElifTagDefinition();
|
ElifTagDefinition elifDefinition = new ElifTagDefinition();
|
||||||
|
@ -111,12 +107,13 @@ namespace Mustache
|
||||||
|
|
||||||
private Regex prepareRegex(TagDefinition definition)
|
private Regex prepareRegex(TagDefinition definition)
|
||||||
{
|
{
|
||||||
Regex regex;
|
if (!_regexLookup.TryGetValue(definition.Name, out Regex regex))
|
||||||
if (!_regexLookup.TryGetValue(definition.Name, out regex))
|
|
||||||
{
|
{
|
||||||
List<string> matches = new List<string>();
|
List<string> matches = new List<string>()
|
||||||
matches.Add(getKeyRegex());
|
{
|
||||||
matches.Add(getCommentTagRegex());
|
getKeyRegex(),
|
||||||
|
getCommentTagRegex()
|
||||||
|
};
|
||||||
foreach (string closingTag in definition.ClosingTags)
|
foreach (string closingTag in definition.ClosingTags)
|
||||||
{
|
{
|
||||||
matches.Add(getClosingTagRegex(closingTag));
|
matches.Add(getClosingTagRegex(closingTag));
|
||||||
|
@ -376,8 +373,7 @@ namespace Mustache
|
||||||
}
|
}
|
||||||
else if (RegexHelper.IsNumber(placeholder))
|
else if (RegexHelper.IsNumber(placeholder))
|
||||||
{
|
{
|
||||||
decimal number;
|
if (Decimal.TryParse(placeholder, out decimal number))
|
||||||
if (Decimal.TryParse(placeholder, out number))
|
|
||||||
{
|
{
|
||||||
argument = new NumberArgument(number);
|
argument = new NumberArgument(number);
|
||||||
}
|
}
|
|
@ -11,9 +11,9 @@ namespace Mustache
|
||||||
public sealed class Generator
|
public sealed class Generator
|
||||||
{
|
{
|
||||||
private readonly IGenerator _generator;
|
private readonly IGenerator _generator;
|
||||||
private readonly List<EventHandler<KeyFoundEventArgs>> _foundHandlers;
|
private readonly List<EventHandler<KeyFoundEventArgs>> _foundHandlers = new List<EventHandler<KeyFoundEventArgs>>();
|
||||||
private readonly List<EventHandler<KeyNotFoundEventArgs>> _notFoundHandlers;
|
private readonly List<EventHandler<KeyNotFoundEventArgs>> _notFoundHandlers = new List<EventHandler<KeyNotFoundEventArgs>>();
|
||||||
private readonly List<EventHandler<ValueRequestEventArgs>> _valueRequestedHandlers;
|
private readonly List<EventHandler<ValueRequestEventArgs>> _valueRequestedHandlers = new List<EventHandler<ValueRequestEventArgs>>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of a Generator.
|
/// Initializes a new instance of a Generator.
|
||||||
|
@ -22,9 +22,6 @@ namespace Mustache
|
||||||
internal Generator(IGenerator generator)
|
internal Generator(IGenerator generator)
|
||||||
{
|
{
|
||||||
_generator = generator;
|
_generator = generator;
|
||||||
_foundHandlers = new List<EventHandler<KeyFoundEventArgs>>();
|
|
||||||
_notFoundHandlers = new List<EventHandler<KeyNotFoundEventArgs>>();
|
|
||||||
_valueRequestedHandlers = new List<EventHandler<ValueRequestEventArgs>>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
|
@ -5,11 +5,10 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
public sealed class HtmlFormatCompiler
|
public sealed class HtmlFormatCompiler
|
||||||
{
|
{
|
||||||
private readonly FormatCompiler compiler;
|
private readonly FormatCompiler compiler = new FormatCompiler();
|
||||||
|
|
||||||
public HtmlFormatCompiler()
|
public HtmlFormatCompiler()
|
||||||
{
|
{
|
||||||
compiler = new FormatCompiler();
|
|
||||||
compiler.AreExtensionTagsAllowed = true;
|
compiler.AreExtensionTagsAllowed = true;
|
||||||
compiler.RemoveNewLines = true;
|
compiler.RemoveNewLines = true;
|
||||||
}
|
}
|
|
@ -1,9 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
public interface IArgument
|
public interface IArgument
|
||||||
{
|
{
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines a tag that renders its content depending on the truthyness
|
/// Defines a tag that renders its content depending on the truthyness
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
|
@ -25,8 +24,7 @@ namespace Mustache
|
||||||
/// <param name="contextScope">Extra data passed along with the context.</param>
|
/// <param name="contextScope">Extra data passed along with the context.</param>
|
||||||
public override void GetText(TextWriter writer, Dictionary<string, object> arguments, Scope contextScope)
|
public override void GetText(TextWriter writer, Dictionary<string, object> arguments, Scope contextScope)
|
||||||
{
|
{
|
||||||
object index;
|
if (contextScope.TryFind("index", out object index))
|
||||||
if (contextScope.TryFind("index", out index))
|
|
||||||
{
|
{
|
||||||
writer.Write(index);
|
writer.Write(index);
|
||||||
}
|
}
|
|
@ -25,16 +25,20 @@ namespace Mustache
|
||||||
|
|
||||||
void IGenerator.GetText(TextWriter writer, Scope scope, Scope context, Action<Substitution> postProcessor)
|
void IGenerator.GetText(TextWriter writer, Scope scope, Scope context, Action<Substitution> postProcessor)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> arguments;
|
var arguments = GetArguments(scope, context);
|
||||||
|
_definition.GetText(writer, arguments, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, object> GetArguments(Scope scope, Scope context)
|
||||||
|
{
|
||||||
if (_definition.IsSetter)
|
if (_definition.IsSetter)
|
||||||
{
|
{
|
||||||
arguments = _arguments.GetArgumentKeyNames();
|
return _arguments.GetArgumentKeyNames();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
arguments = _arguments.GetArguments(scope, context);
|
return _arguments.GetArguments(scope, context);
|
||||||
}
|
}
|
||||||
_definition.GetText(writer, arguments, context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
|
@ -21,12 +21,12 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the fully-qualified key.
|
/// Gets the fully-qualified key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether the key appeared within triple curly braces.
|
/// Gets or sets whether the key appeared within triple curly braces.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsExtension { get; private set; }
|
public bool IsExtension { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the object to use as the substitute.
|
/// Gets or sets the object to use as the substitute.
|
|
@ -23,17 +23,17 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the fully-qualified key.
|
/// Gets the fully-qualified key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the part of the key that could not be found.
|
/// Gets the part of the key that could not be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MissingMember { get; private set; }
|
public string MissingMember { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets whether the key appeared within triple curly braces.
|
/// Gets whether the key appeared within triple curly braces.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsExtension { get; private set; }
|
public bool IsExtension { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether to use the substitute.
|
/// Gets or sets whether to use the substitute.
|
|
@ -0,0 +1,37 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>NET45;netstandard2.0</TargetFrameworks>
|
||||||
|
<RootNamespace>Mustache</RootNamespace>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>MustacheSharp.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<AssemblyName>mustache-sharp</AssemblyName>
|
||||||
|
<Authors>Truncon</Authors>
|
||||||
|
<Description>An extension of the mustache text template engine for .NET.</Description>
|
||||||
|
<Copyright>Copyright © 2013</Copyright>
|
||||||
|
<PackageLicenseUrl>https://github.com/jehugaleahsa/mustache-sharp/blob/master/UNLICENSE.txt</PackageLicenseUrl>
|
||||||
|
<PackageProjectUrl>https://github.com/jehugaleahsa/mustache-sharp</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/jehugaleahsa/mustache-sharp.git</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageTags>mustache handlebars text generation building template</PackageTags>
|
||||||
|
<PackageReleaseNotes>Migrate to .NET Standard 2.0</PackageReleaseNotes>
|
||||||
|
<NeutralLanguage>en-US</NeutralLanguage>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Binary file not shown.
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.IO;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
public class NumberArgument : IArgument
|
public class NumberArgument : IArgument
|
||||||
{
|
{
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
public class PlaceholderArgument : IArgument
|
public class PlaceholderArgument : IArgument
|
||||||
{
|
{
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using Mustache.Properties;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
||||||
|
@ -47,6 +46,6 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the context where the placeholder was found.
|
/// Gets the context where the placeholder was found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Context[] Context { get; private set; }
|
public Context[] Context { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly:InternalsVisibleTo("MustacheSharp.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fd172e711b4abd8f660ce475c6b888aa47f2e1e37c0a9b0296f2df9f7ab9ec8f7fc28c8e926cc8f77079e4b55dcd74427620e0265ded8aba26576e00dc6de91514b52799ee2ed9bb74be24a370bb77f327c92cb5bd114913b75385beeaeb43bba8b66971d21e330ca274a13bc632d6d2ac7ff595c4df0c199a9d0b9e8e9c67ed")]
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.18052
|
// Runtime Version:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -19,7 +19,7 @@ namespace Mustache.Properties {
|
||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
internal class Resources {
|
|
@ -13,8 +13,6 @@ namespace Mustache
|
||||||
internal sealed class PropertyDictionary : IDictionary<string, object>
|
internal sealed class PropertyDictionary : IDictionary<string, object>
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<Type, Dictionary<string, Func<object, object>>> _cache = new Dictionary<Type, Dictionary<string, Func<object, object>>>();
|
private static readonly Dictionary<Type, Dictionary<string, Func<object, object>>> _cache = new Dictionary<Type, Dictionary<string, Func<object, object>>>();
|
||||||
|
|
||||||
private readonly object _instance;
|
|
||||||
private readonly Dictionary<string, Func<object, object>> _typeCache;
|
private readonly Dictionary<string, Func<object, object>> _typeCache;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,7 +21,7 @@ namespace Mustache
|
||||||
/// <param name="instance">The instance to wrap in the PropertyDictionary.</param>
|
/// <param name="instance">The instance to wrap in the PropertyDictionary.</param>
|
||||||
public PropertyDictionary(object instance)
|
public PropertyDictionary(object instance)
|
||||||
{
|
{
|
||||||
_instance = instance;
|
Instance = instance;
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
_typeCache = new Dictionary<string, Func<object, object>>();
|
_typeCache = new Dictionary<string, Func<object, object>>();
|
||||||
|
@ -32,7 +30,7 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
lock (_cache)
|
lock (_cache)
|
||||||
{
|
{
|
||||||
_typeCache = getCacheType(_instance);
|
_typeCache = getCacheType(instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,10 +96,7 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the underlying instance.
|
/// Gets the underlying instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object Instance
|
public object Instance { get; }
|
||||||
{
|
|
||||||
get { return _instance; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
void IDictionary<string, object>.Add(string key, object value)
|
void IDictionary<string, object>.Add(string key, object value)
|
||||||
|
@ -148,7 +143,7 @@ namespace Mustache
|
||||||
value = null;
|
value = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
value = getter(_instance);
|
value = getter(Instance);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +158,7 @@ namespace Mustache
|
||||||
List<object> values = new List<object>();
|
List<object> values = new List<object>();
|
||||||
foreach (Func<object, object> getter in getters)
|
foreach (Func<object, object> getter in getters)
|
||||||
{
|
{
|
||||||
object value = getter(_instance);
|
object value = getter(Instance);
|
||||||
values.Add(value);
|
values.Add(value);
|
||||||
}
|
}
|
||||||
return values.AsReadOnly();
|
return values.AsReadOnly();
|
||||||
|
@ -186,7 +181,7 @@ namespace Mustache
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Func<object, object> getter = _typeCache[key];
|
Func<object, object> getter = _typeCache[key];
|
||||||
return getter(_instance);
|
return getter(Instance);
|
||||||
}
|
}
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
set
|
set
|
||||||
|
@ -209,12 +204,11 @@ namespace Mustache
|
||||||
|
|
||||||
bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
|
bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
|
||||||
{
|
{
|
||||||
Func<object, object> getter;
|
if (!_typeCache.TryGetValue(item.Key, out Func<object, object> getter))
|
||||||
if (!_typeCache.TryGetValue(item.Key, out getter))
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
object value = getter(_instance);
|
object value = getter(Instance);
|
||||||
return Equals(item.Value, value);
|
return Equals(item.Value, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +219,7 @@ namespace Mustache
|
||||||
foreach (KeyValuePair<string, Func<object, object>> pair in collection)
|
foreach (KeyValuePair<string, Func<object, object>> pair in collection)
|
||||||
{
|
{
|
||||||
Func<object, object> getter = pair.Value;
|
Func<object, object> getter = pair.Value;
|
||||||
object value = getter(_instance);
|
object value = getter(Instance);
|
||||||
pairs.Add(new KeyValuePair<string, object>(pair.Key, value));
|
pairs.Add(new KeyValuePair<string, object>(pair.Key, value));
|
||||||
}
|
}
|
||||||
pairs.CopyTo(array, arrayIndex);
|
pairs.CopyTo(array, arrayIndex);
|
||||||
|
@ -262,7 +256,7 @@ namespace Mustache
|
||||||
foreach (KeyValuePair<string, Func<object, object>> pair in _typeCache)
|
foreach (KeyValuePair<string, Func<object, object>> pair in _typeCache)
|
||||||
{
|
{
|
||||||
Func<object, object> getter = pair.Value;
|
Func<object, object> getter = pair.Value;
|
||||||
object value = getter(_instance);
|
object value = getter(Instance);
|
||||||
yield return new KeyValuePair<string, object>(pair.Key, value);
|
yield return new KeyValuePair<string, object>(pair.Key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Text.RegularExpressions;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using Mustache.Properties;
|
using Mustache.Properties;
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
|
@ -86,8 +85,7 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
return onKeyFound(name, results.Value, isExtension);
|
return onKeyFound(name, results.Value, isExtension);
|
||||||
}
|
}
|
||||||
object value;
|
if (onKeyNotFound(name, results.Member, isExtension, out object value))
|
||||||
if (onKeyNotFound(name, results.Member, isExtension, out value))
|
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -199,8 +197,7 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
results.Lookup = toLookup(results.Value);
|
results.Lookup = toLookup(results.Value);
|
||||||
results.MemberIndex = index;
|
results.MemberIndex = index;
|
||||||
object value;
|
results.Found = results.Lookup.TryGetValue(results.Member, out object value);
|
||||||
results.Found = results.Lookup.TryGetValue(results.Member, out value);
|
|
||||||
results.Value = value;
|
results.Value = value;
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
@ -209,8 +206,7 @@ namespace Mustache
|
||||||
private void tryFindFirst(SearchResults results)
|
private void tryFindFirst(SearchResults results)
|
||||||
{
|
{
|
||||||
results.Lookup = toLookup(_source);
|
results.Lookup = toLookup(_source);
|
||||||
object value;
|
if (results.Lookup.TryGetValue(results.Member, out object value))
|
||||||
if (results.Lookup.TryGetValue(results.Member, out value))
|
|
||||||
{
|
{
|
||||||
results.Found = true;
|
results.Found = true;
|
||||||
results.Value = value;
|
results.Value = value;
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
|
@ -8,8 +8,6 @@ namespace Mustache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class StaticGenerator : IGenerator
|
internal sealed class StaticGenerator : IGenerator
|
||||||
{
|
{
|
||||||
private readonly string value;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of a StaticGenerator.
|
/// Initializes a new instance of a StaticGenerator.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -17,21 +15,18 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
if (removeNewLines)
|
if (removeNewLines)
|
||||||
{
|
{
|
||||||
this.value = value.Replace(Environment.NewLine, String.Empty);
|
Value = value.Replace(Environment.NewLine, String.Empty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the static text.
|
/// Gets or sets the static text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Value
|
public string Value { get; }
|
||||||
{
|
|
||||||
get { return value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
void IGenerator.GetText(TextWriter writer, Scope scope, Scope context, Action<Substitution> postProcessor)
|
void IGenerator.GetText(TextWriter writer, Scope scope, Scope context, Action<Substitution> postProcessor)
|
||||||
{
|
{
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
public class StringArgument : IArgument
|
public class StringArgument : IArgument
|
||||||
{
|
{
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
internal class Substitution
|
internal class Substitution
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Mustache.Properties;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Mustache.Properties;
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
||||||
|
@ -10,8 +10,6 @@ namespace Mustache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class TagDefinition
|
public abstract class TagDefinition
|
||||||
{
|
{
|
||||||
private readonly string _tagName;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of a TagDefinition.
|
/// Initializes a new instance of a TagDefinition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -33,16 +31,13 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
throw new ArgumentException(Resources.BlankTagName, "tagName");
|
throw new ArgumentException(Resources.BlankTagName, "tagName");
|
||||||
}
|
}
|
||||||
_tagName = tagName;
|
Name = tagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the tag.
|
/// Gets the name of the tag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name
|
public string Name { get; private set; }
|
||||||
{
|
|
||||||
get { return _tagName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool IsSetter
|
internal bool IsSetter
|
||||||
{
|
{
|
|
@ -23,12 +23,12 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the fully-qualified key.
|
/// Gets the fully-qualified key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether the key appeared within triple curly braces.
|
/// Gets or sets whether the key appeared within triple curly braces.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsExtension { get; private set; }
|
public bool IsExtension { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the object to use as the substitute.
|
/// Gets or sets the object to use as the substitute.
|
|
@ -8,8 +8,6 @@ namespace Mustache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class TagParameter
|
public sealed class TagParameter
|
||||||
{
|
{
|
||||||
private readonly string _name;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of a TagParameter.
|
/// Initializes a new instance of a TagParameter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -21,34 +19,23 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
throw new ArgumentException(Resources.BlankParameterName, "parameterName");
|
throw new ArgumentException(Resources.BlankParameterName, "parameterName");
|
||||||
}
|
}
|
||||||
_name = parameterName;
|
Name = parameterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the parameter.
|
/// Gets the name of the parameter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name
|
public string Name { get; }
|
||||||
{
|
|
||||||
get { return _name; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether the field is required.
|
/// Gets or sets whether the field is required.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsRequired
|
public bool IsRequired { get; set; }
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the default value to use when an argument is not provided
|
/// Gets or sets the default value to use when an argument is not provided
|
||||||
/// for the parameter.
|
/// for the parameter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object DefaultValue
|
public object DefaultValue { get; set; }
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,8 +14,7 @@ namespace Mustache
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IDictionary<string, object> sourceDictionary = source as IDictionary<string, object>;
|
if (source is IDictionary<string, object> sourceDictionary)
|
||||||
if (sourceDictionary != null)
|
|
||||||
{
|
{
|
||||||
return sourceDictionary;
|
return sourceDictionary;
|
||||||
}
|
}
|
||||||
|
@ -123,8 +122,7 @@ namespace Mustache
|
||||||
|
|
||||||
public bool TryGetValue(string key, out object value)
|
public bool TryGetValue(string key, out object value)
|
||||||
{
|
{
|
||||||
TValue result;
|
if (dictionary.TryGetValue(key, out TValue result))
|
||||||
if (dictionary.TryGetValue(key, out result))
|
|
||||||
{
|
{
|
||||||
value = result;
|
value = result;
|
||||||
return true;
|
return true;
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
namespace Mustache
|
||||||
|
|
||||||
namespace Mustache
|
|
||||||
{
|
{
|
||||||
public class VariableArgument : IArgument
|
public class VariableArgument : IArgument
|
||||||
{
|
{
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using Mustache.Properties;
|
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
||||||
{
|
{
|
||||||
|
@ -48,6 +47,6 @@ namespace Mustache
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the context where the placeholder was found.
|
/// Gets the context where the placeholder was found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Context[] Context { get; private set; }
|
public Context[] Context { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Mustache
|
namespace Mustache
|
|
@ -1,29 +0,0 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 2012
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mustache-sharp", "mustache-sharp\mustache-sharp.csproj", "{D71B378F-A4BA-4263-A4F0-07A49A0C528D}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mustache-sharp.test", "mustache-sharp.test\mustache-sharp.test.csproj", "{7F607362-0680-4751-B1DC-621219294AE3}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
|
||||||
CategoryFile = mustache-sharp.vsmdi
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{D71B378F-A4BA-4263-A4F0-07A49A0C528D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{D71B378F-A4BA-4263-A4F0-07A49A0C528D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{D71B378F-A4BA-4263-A4F0-07A49A0C528D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{D71B378F-A4BA-4263-A4F0-07A49A0C528D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{7F607362-0680-4751-B1DC-621219294AE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{7F607362-0680-4751-B1DC-621219294AE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{7F607362-0680-4751-B1DC-621219294AE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{7F607362-0680-4751-B1DC-621219294AE3}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
|
@ -1,15 +0,0 @@
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("mustache-sharp.test")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("Truncon")]
|
|
||||||
[assembly: AssemblyProduct("mustache-sharp.test")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
[assembly: Guid("9975f293-f972-4751-9c8c-e25b17c0c8bc")]
|
|
||||||
[assembly: AssemblyVersion("0.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
|
|
@ -1,75 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>
|
|
||||||
</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{7F607362-0680-4751-B1DC-621219294AE3}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Mustache.Test</RootNamespace>
|
|
||||||
<AssemblyName>mustache-sharp.test</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<SignAssembly>true</SignAssembly>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<AssemblyOriginatorKeyFile>mustache-sharp.test.snk</AssemblyOriginatorKeyFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Web" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
</CodeAnalysisDependentAssemblyPaths>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="FormatCompilerTester.cs" />
|
|
||||||
<Compile Include="HtmlFormatCompilerTester.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="UpcastDictionaryTester.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\mustache-sharp\mustache-sharp.csproj">
|
|
||||||
<Project>{d71b378f-a4ba-4263-a4f0-07a49a0c528d}</Project>
|
|
||||||
<Name>mustache-sharp</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="mustache-sharp.test.snk" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
Binary file not shown.
|
@ -1,19 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("mustache-sharp")]
|
|
||||||
[assembly: AssemblyDescription("A extension of the mustache text template engine for .NET.")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("truncon")]
|
|
||||||
[assembly: AssemblyProduct("mustache-sharp")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: CLSCompliant(true)]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
[assembly: Guid("e5a4263d-d450-4d85-a4d5-44c0a2822668")]
|
|
||||||
[assembly: AssemblyVersion("0.2.10.0")]
|
|
||||||
[assembly: AssemblyFileVersion("0.2.10.0")]
|
|
||||||
[assembly: InternalsVisibleTo("mustache-sharp.test,PublicKey=0024000004800000940000000602000000240000525341310004000001000100755df5a2b24c568812aae0eb194d08a4e3cba960673bcc07a7d446acf52f3f56ae2155b37b8d547bc5d8c562823bd592d1312bef9ad4740a8bb503d0095c31419f9d190882a2fa46090412bf15b13ca0057ba533c85a853333132ec8b70cf19655ef961b06d1c3fc35b3f68680420562be741456cb7a18bd5ab0fa779f8d47b1")]
|
|
|
@ -1,109 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{D71B378F-A4BA-4263-A4F0-07A49A0C528D}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Mustache</RootNamespace>
|
|
||||||
<AssemblyName>mustache-sharp</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<SignAssembly>true</SignAssembly>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<AssemblyOriginatorKeyFile>mustache-sharp.snk</AssemblyOriginatorKeyFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="ArgumentCollection.cs" />
|
|
||||||
<Compile Include="CompoundGenerator.cs" />
|
|
||||||
<Compile Include="ConditionTagDefinition.cs" />
|
|
||||||
<Compile Include="ContentTagDefinition.cs" />
|
|
||||||
<Compile Include="Context.cs" />
|
|
||||||
<Compile Include="ContextParameter.cs" />
|
|
||||||
<Compile Include="Substitution.cs" />
|
|
||||||
<Compile Include="TagFormattedEventArgs.cs" />
|
|
||||||
<Compile Include="HtmlFormatCompiler.cs" />
|
|
||||||
<Compile Include="IArgument.cs" />
|
|
||||||
<Compile Include="NumberArgument.cs" />
|
|
||||||
<Compile Include="PlaceholderArgument.cs" />
|
|
||||||
<Compile Include="StringArgument.cs" />
|
|
||||||
<Compile Include="UpcastDictionary.cs" />
|
|
||||||
<Compile Include="VariableArgument.cs" />
|
|
||||||
<Compile Include="VariableFoundEventArgs.cs" />
|
|
||||||
<Compile Include="SetTagDefinition.cs" />
|
|
||||||
<Compile Include="NewlineTagDefinition.cs" />
|
|
||||||
<Compile Include="IndexTagDefinition.cs" />
|
|
||||||
<Compile Include="KeyFoundEventArgs.cs" />
|
|
||||||
<Compile Include="InlineTagDefinition.cs" />
|
|
||||||
<Compile Include="EachTagDefinition.cs" />
|
|
||||||
<Compile Include="ElifTagDefinition.cs" />
|
|
||||||
<Compile Include="ElseTagDefinition.cs" />
|
|
||||||
<Compile Include="FormatCompiler.cs" />
|
|
||||||
<Compile Include="Generator.cs" />
|
|
||||||
<Compile Include="IfTagDefinition.cs" />
|
|
||||||
<Compile Include="IGenerator.cs" />
|
|
||||||
<Compile Include="InlineGenerator.cs" />
|
|
||||||
<Compile Include="PlaceholderFoundEventArgs.cs" />
|
|
||||||
<Compile Include="KeyGenerator.cs" />
|
|
||||||
<Compile Include="MasterTagDefinition.cs" />
|
|
||||||
<Compile Include="KeyNotFoundEventArgs.cs" />
|
|
||||||
<Compile Include="NestedContext.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="PropertyDictionary.cs" />
|
|
||||||
<Compile Include="RegexHelper.cs" />
|
|
||||||
<Compile Include="StaticGenerator.cs" />
|
|
||||||
<Compile Include="TagDefinition.cs" />
|
|
||||||
<Compile Include="TagParameter.cs" />
|
|
||||||
<Compile Include="Scope.cs" />
|
|
||||||
<Compile Include="ValueRequestEventArgs.cs" />
|
|
||||||
<Compile Include="WithTagDefinition.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="mustache-sharp.snk" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<package >
|
|
||||||
<metadata>
|
|
||||||
<id>$id$</id>
|
|
||||||
<version>$version$</version>
|
|
||||||
<title>$title$</title>
|
|
||||||
<authors>$author$</authors>
|
|
||||||
<owners>$author$</owners>
|
|
||||||
<projectUrl>http://github.com/jehugaleahsa/mustache-sharp</projectUrl>
|
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
|
||||||
<description>$description$</description>
|
|
||||||
<copyright>Copyright 2013</copyright>
|
|
||||||
<tags>
|
|
||||||
mustache handlebars.js text generation building template
|
|
||||||
</tags>
|
|
||||||
</metadata>
|
|
||||||
</package>
|
|
Binary file not shown.
Loading…
Reference in New Issue