JinianNet.JNTemplate 2.4.4
JNTemplate
JNTemplate is fast, lightweight, extensible .net template engine for generating html, xml, sql, or any other formatted text output.
Special placeholders in the template allow writing code similar to c# syntax. Then the template is passed data to render the final document.
How to use
Install
dotnet add package JinianNet.JNTemplate
Import
using JinianNet.JNTemplate;
var
chsare code:
var text = @"Hello, ${name}";
var template = Engine.CreateTemplate(text);
template.Set("name","jntemplate");
var result = template.Render();
Console.WriteLine(result);
output:
Hello, jntemplate
Iteration
var text = @"
<ul>
${foreach(name in list)}
<li>${name}</li>
${end}
</ul>
";
var template = Engine.CreateTemplate(text);
template.Set("list", new string[] { "github","jntemplate" });
var result = template.Render();
Console.WriteLine(result);
output:
<ul>
<li>github</li>
<li>jntemplate</li>
</ul>
Function
var text = "$test.SayHello(\"jntemplate\")";
var template = Engine.CreateTemplate(text);
template.Set("test", new TestHelper());
var result = template.Render();
Console.WriteLine(result);
public class TestHelper
{
public string SayHello(string name)
{
return "hello " + name;
}
}
output:
hello jntemplate
License
Showing the top 20 packages that depend on JinianNet.JNTemplate.
| Packages | Downloads |
|---|---|
|
JinianNet.AspNetCoreViewEngine.Jntemplate
An Jntemplate view engine for ASP.NET Core MVC.
|
8 |
|
JinianNet.AspNetCoreViewEngine.Jntemplate
An Jntemplate view engine for ASP.NET Core MVC.
|
5 |
|
JinianNet.AspNetCoreViewEngine.Jntemplate
An Jntemplate view engine for ASP.NET Core MVC.
|
3 |
.NET Framework 2.0
- No dependencies.
.NET Framework 3.5
- No dependencies.
.NET Framework 4.0
- No dependencies.
.NET Framework 4.6
- No dependencies.
.NET Framework 4.8
- No dependencies.
.NET Core 3.1
- No dependencies.
.NET 5.0
- No dependencies.
.NET 6.0
- No dependencies.
.NET 7.0
- No dependencies.
.NET 8.0
- No dependencies.
.NET 9.0
- No dependencies.
.NET 10.0
- No dependencies.
.NET Standard 2.0
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
.NET Standard 2.1
- No dependencies.