1 | interface Velocity {
|
2 | parse(vmString: string, blocks?: { [blockName: string]: boolean }, ignoreSpace?: boolean): Array<VELOCITY_AST>
|
3 | render(vmString: string, context?: RenderContext, macros?: Macros, config?: CompileConfig): string
|
4 |
|
5 | Compile: Compile
|
6 | Helper: Helper
|
7 | }
|
8 |
|
9 | interface Compile {
|
10 | new (asts: Array<VELOCITY_AST>, config?: CompileConfig): Compile
|
11 | render(context?: RenderContext, macros?: Macros, silence?: boolean): string
|
12 |
|
13 | cost: number
|
14 | }
|
15 |
|
16 | interface Helper {
|
17 | getRefText(ast: VELOCITY_AST): string
|
18 | }
|
19 |
|
20 | type Macros = Object | { [macro: string]: Function }
|
21 |
|
22 | type RenderContext = Object | {
|
23 | [contextKey: string]: Function,
|
24 | eval(vmString: string, context?: RenderContext): string
|
25 | }
|
26 |
|
27 | type AST_TYPE = 'set' | 'elseif' | 'if' | 'else' | 'end' | 'foreach' | 'define' | 'content' | 'comment'
|
28 | | 'macro' | 'macro_call' | 'math' | 'references' | 'method' | 'index' | 'property'
|
29 | | 'bool' | 'interger' | 'decimal' | 'string' | 'array' | 'map'
|
30 |
|
31 | interface VELOCITY_AST {
|
32 | type: AST_TYPE
|
33 | value: any
|
34 | id: string
|
35 | pos: { first_line: number, first_column: number }
|
36 | }
|
37 |
|
38 | interface CompileConfig {
|
39 | escape: boolean
|
40 | unescape: { [varName: string]: boolean }
|
41 | }
|
42 |
|
43 | declare module 'velocityjs' {
|
44 | var velocityjs: Velocity;
|
45 | export = velocityjs
|
46 | }
|