Skip to content

Open source templating engine for .net framework/mono/.net core (.net/mono/.net core模板引擎,asp.net模板引擎)

License

Notifications You must be signed in to change notification settings

codecopy/jntemplate

 
 

Repository files navigation

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


API

see: www.jiniannet.com

Licenses

MIT

About

Open source templating engine for .net framework/mono/.net core (.net/mono/.net core模板引擎,asp.net模板引擎)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 92.3%
  • CSS 2.7%
  • HTML 2.3%
  • Batchfile 1.4%
  • Other 1.3%