Implement Scanner, Context and Writer-classes

This commit is contained in:
Manuel Thalmann
2018-06-19 23:22:50 +02:00
parent d913f2fa72
commit b55473c423
+20
View File
@@ -22,6 +22,23 @@ interface MustacheStatic {
*/
tags: string;
/**
* A simple string scanner that is used by the template parser to find tokens in template strings.
*/
Scanner: typeof MustacheScanner
/**
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
*/
Context: typeof MustacheContext;
/**
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
*
* It also maintains a cache of templates to avoid the need to parse the same template twice.
*/
Writer: typeof MustacheWriter;
/**
* Escapes HTML-characters.
*
@@ -222,6 +239,9 @@ declare class MustacheWriter {
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
}
/**
* Provides the functionality to render templates with `{{mustaches}}`.
*/
declare var Mustache: MustacheStatic;
export = Mustache;
export as namespace Mustache;