C# Class Scriban.Template

Entry point class to parse templates and render them.
Mostra file Open project: lunet-io/scriban Class Usage Examples

Public Methods

Method Description
Parse ( string text, string sourceFilePath = null, ParserOptions options = null ) : Template

Parses the specified scripting text into a Template .

Render ( object model = null ) : string

Renders this template using the specified object model.

Render ( TemplateContext context ) : void

Renders this template using the specified context. See remarks.

When using this method, the result of rendering this page is output to TemplateContext.Output

Private Methods

Method Description
ParseInternal ( string text, string sourceFilePath ) : void
Template ( ParserOptions options, string sourceFilePath ) : System

Method Details

Parse() public static method

Parses the specified scripting text into a Template .
public static Parse ( string text, string sourceFilePath = null, ParserOptions options = null ) : Template
text string The scripting text.
sourceFilePath string The source file path. Optional, used for better error reporting if the source file has a location on the disk
options Scriban.Parsing.ParserOptions The templating parsing options.
return Template

Render() public method

Renders this template using the specified object model.
public Render ( object model = null ) : string
model object The object model.
return string

Render() public method

Renders this template using the specified context. See remarks.
When using this method, the result of rendering this page is output to TemplateContext.Output
If context is null If the template . Check the property for more details
public Render ( TemplateContext context ) : void
context TemplateContext The template context.
return void