JNTemplate is a .net template engine for generating html, xml, sql, or any other formatted text output.
- Easy to learn
- Easy to use
- Easy to expand
- 100% free
Get it on NuGet!
PM> Install-Package JinianNet.JNTemplate
or
> dotnet add package JinianNet.JNTemplate
Building the source
git clone https://github.com/jiniannet/jntemplate.git
Windows:After cloning the repository, run build/build.bat
Linux:After cloning the repository, run build/build.sh
Configuration
You can configure JNTemplate with the EngineConfig class.
var conf = Configuration.EngineConfig.CreateDefault();
// .. configure your instance
Engine.Configure(conf);
Basic Example
template code(index.html):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JNTemplate deomo</title>
</head>
<body>
hello,$name!
</body>
</html>
c# code:
var template = (Template)Engine.LoadTemplate("C:\\wwwwroot\index.html");
\\(Template)Engine.CreateTemplate("hello,$name!");
template.Set("name", "JNTemplate");
var result = template.Render();
output:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JNTemplate deomo</title>
</head>
<body>
hello,JNTemplate!
</body>
</html>
see: www.jiniannet.com
MIT