Open source templating engine for .net framework/mono/.net core (.net/mono/.net core模板引擎,asp.net模板引擎)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vs/config
build
src
tool
.gitattributes
.gitignore
.travis.yml
Changelog.txt
Developer-ReadMe.txt
JinianNet.JNTemplate.sln
JinianNet.JNTemplate.v11.suo
JinianNet.JNTemplate_Standard.sln
JinianNet.JNTemplate_core.sln
License.txt
NuGet.Config
README-zh-CN.md
README.md
appveyor.yml
appveyor_core_conf.bat

README.md

JNTemplate

Build Status GitHub stars GitHub stars GitHub license GitHub issues

English | 中文

What is JNTemplate?

JNTemplate is a .net template engine for generating html, xml, sql, or any other formatted text output.

Features:

  • Easy to learn
  • Easy to use
  • Easy to expand
  • 100% free

Quickstart

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.win.bat

Mono:After cloning the repository, run build/build.mono.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>


API

see: www.jiniannet.com

Licenses

Apache License 2.0