C# Class Stubble.Core.Writer

Represents the Writer for Tokens and a wrapper over the Parser
ファイルを表示 Open project: StubbleOrg/Stubble Class Usage Examples

Private Properties

Property Type Description
RenderTokens string
ResetCurrentDepth void

Public Methods

Method Description
ClearCache ( ) : void

Clears the Template Token Cache

Parse ( string template ) : IList

Parses a template, looks up the template in the template token cache and returns cached version if possible.

Parse ( string template, Tags tags ) : IList

Parses a template with the given tags, looks up the template in the template token cache and returns cached version if possible.

Render ( string template, Context context, string>.IDictionary partials ) : string

Takes a template, context and partials and Renders them using default tags

Render ( string template, Context context, string>.IDictionary partials, Tags tags ) : string

Takes a template, context, partials and tags and renders the template

Render ( string template, object view, string>.IDictionary partials, RenderSettings settings ) : string

Takes a template, view object, partials and render settings and Renders them using default tags

Writer ( ) : System

Initializes a new instance of the Writer class with a default Registry and a cache size of 15

Writer ( Registry registry ) : System

Initializes a new instance of the Writer class with a explicit registry and cacheSize of 15

Writer ( int cacheLimit, Registry registry ) : System

Initializes a new instance of the Writer class with a cacheLimit and explicit registry

Private Methods

Method Description
RenderTokens ( IList tokens, Context context, string>.IDictionary partials, string originalTemplate ) : string

Renders a list of tokens with the context, partials and passed original template

ResetCurrentDepth ( ) : void

Method Details

ClearCache() public method

Clears the Template Token Cache
public ClearCache ( ) : void
return void

Parse() public method

Parses a template, looks up the template in the template token cache and returns cached version if possible.
public Parse ( string template ) : IList
template string The template to parse
return IList

Parse() public method

Parses a template with the given tags, looks up the template in the template token cache and returns cached version if possible.
public Parse ( string template, Tags tags ) : IList
template string The template to parse
tags Stubble.Core.Classes.Tags The tags to parse the template with
return IList

Render() public method

Takes a template, context and partials and Renders them using default tags
public Render ( string template, Context context, string>.IDictionary partials ) : string
template string The template to parse and render
context Context The context object to use
partials string>.IDictionary The partials available to the template
return string

Render() public method

Takes a template, context, partials and tags and renders the template
public Render ( string template, Context context, string>.IDictionary partials, Tags tags ) : string
template string The template to parse and render
context Context The context object to use to render
partials string>.IDictionary The partials available to the template
tags Stubble.Core.Classes.Tags The tags to initalise the parser with
return string

Render() public method

Takes a template, view object, partials and render settings and Renders them using default tags
public Render ( string template, object view, string>.IDictionary partials, RenderSettings settings ) : string
template string The template to parse and render
view object The view object to use to render
partials string>.IDictionary The partials available to the template
settings Stubble.Core.Classes.RenderSettings The settings to use for rendering
return string

Writer() public method

Initializes a new instance of the Writer class with a default Registry and a cache size of 15
public Writer ( ) : System
return System

Writer() public method

Initializes a new instance of the Writer class with a explicit registry and cacheSize of 15
public Writer ( Registry registry ) : System
registry Stubble.Core.Classes.Registry The registry to use
return System

Writer() public method

Initializes a new instance of the Writer class with a cacheLimit and explicit registry
public Writer ( int cacheLimit, Registry registry ) : System
cacheLimit int The max size of the template token cache
registry Stubble.Core.Classes.Registry The registry to use
return System