-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
41 lines (40 loc) · 1.46 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections.Generic;
namespace TemplateSharp
{
class Program
{
static void Main(string[] args)
{
var env = new Dictionary<string, Value>{
{"x", Value.Construct(11)},
{"name", "Ameer"},
{"book", new Dictionary<Value, Value>{
{"length", 240},
{"author", new Dictionary<Value, Value>{
{"firstName", "Frank"},
{"lastName", "Herbert"},
}}
}},
{"meals", new List<Value>(){
new List<Value>(){"Tuna", "Salmon"},
new List<Value>(){"Chicken", "Broccoli"},
}},
{"sin", Value.Construct(arr => System.Math.Sin(arr[0]))},
{"cos", Value.Construct(arr => System.Math.Cos(arr[0]))},
{"pow", Value.Construct(arr => System.Math.Pow(arr[0], arr[1]))},
{"index", Value.Construct(arr => arr[0][arr[1]])},
};
var files = new List<string>{
"parent.tempSh",
"child.tempSh",
};
var templates = new TemplateBuilder().Build(files);
templates.Compile(new List<string>{
"parent.tempSh",
"child.tempSh",
});
var executed = ChildTemplate.Execute(env);
System.Console.WriteLine(executed);
}
}
}