deno.land / x / eta@v3.4.0 / src / config.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { XMLEscape } from "./utils.ts";
/* TYPES */
type trimConfig = "nl" | "slurp" | false;
export interface Options { /** Compile to async function */ async?: boolean;
/** Absolute path to template file */ filepath?: string;}
export interface EtaConfig { /** Whether or not to automatically XML-escape interpolations. Default true */ autoEscape: boolean;
/** Apply a filter function defined on the class to every interpolation or raw interpolation */ autoFilter: boolean;
/** Configure automatic whitespace trimming. Default `[false, 'nl']` */ autoTrim: trimConfig | [trimConfig, trimConfig];
/** Whether or not to cache templates if `name` or `filename` is passed */ cache: boolean;
/** Holds cache of resolved filepaths. Set to `false` to disable. */ cacheFilepaths: boolean;
/** Whether to pretty-format error messages (introduces runtime penalties) */ debug: boolean;
/** Function to XML-sanitize interpolations */ escapeFunction: (str: unknown) => string;
/** Function applied to all interpolations when autoFilter is true */ filterFunction: (val: unknown) => string;
/** Raw JS code inserted in the template function. Useful for declaring global variables for user templates */ functionHeader: string;
/** Parsing options */ parse: { /** Which prefix to use for evaluation. Default `""`, does not support `"-"` or `"_"` */ exec: string;
/** Which prefix to use for interpolation. Default `"="`, does not support `"-"` or `"_"` */ interpolate: string;
/** Which prefix to use for raw interpolation. Default `"~"`, does not support `"-"` or `"_"` */ raw: string; };
/** Array of plugins */ plugins: Array<{ processFnString?: Function; processAST?: Function; processTemplate?: Function }>;
/** Remove all safe-to-remove whitespace */ rmWhitespace: boolean;
/** Delimiters: by default `['<%', '%>']` */ tags: [string, string];
/** Make data available on the global object instead of varName */ useWith: boolean;
/** Name of the data object. Default `it` */ varName: string;
/** Directory that contains templates */ views?: string;
/** Control template file extension defaults. Default `.eta` */ defaultExtension?: string;}
/* END TYPES */
/** Eta's base (global) configuration */const defaultConfig: EtaConfig = { autoEscape: true, autoFilter: false, autoTrim: [false, "nl"], cache: false, cacheFilepaths: true, debug: false, escapeFunction: XMLEscape, // default filter function (not used unless enables) just stringifies the input filterFunction: (val) => String(val), functionHeader: "", parse: { exec: "", interpolate: "=", raw: "~", }, plugins: [], rmWhitespace: false, tags: ["<%", "%>"], useWith: false, varName: "it", defaultExtension: ".eta",};
export { defaultConfig };
eta

Version Info

Tagged at
2 months ago