diff --git a/deno_dist/README.md b/deno_dist/README.md index 350dfde..449e088 100644 --- a/deno_dist/README.md +++ b/deno_dist/README.md @@ -1,3 +1,7 @@ +
+ +
+
diff --git a/deno_dist/config.ts b/deno_dist/config.ts
index 4a87e5b..233f316 100644
--- a/deno_dist/config.ts
+++ b/deno_dist/config.ts
@@ -38,7 +38,13 @@ export interface EtaConfig {
};
/** Array of plugins */
- plugins: Array<{ processFnString?: Function; processAST?: Function }>;
+ plugins: Array<
+ {
+ processFnString?: Function;
+ processAST?: Function;
+ processTemplate?: Function;
+ }
+ >;
/** Remove all safe-to-remove whitespace */
rmWhitespace: boolean;
diff --git a/deno_dist/parse.ts b/deno_dist/parse.ts
index dbd36a3..19e69fc 100644
--- a/deno_dist/parse.ts
+++ b/deno_dist/parse.ts
@@ -39,6 +39,15 @@ export default function parse(
var lastIndex = 0;
var parseOptions = config.parse;
+ if (config.plugins) {
+ for (var i = 0; i < config.plugins.length; i++) {
+ var plugin = config.plugins[i];
+ if (plugin.processTemplate) {
+ str = plugin.processTemplate(str, config);
+ }
+ }
+ }
+
/* Adding for EJS compatibility */
if (config.rmWhitespace) {
// Code taken directly from EJS
diff --git a/src/config.ts b/src/config.ts
index 3487ed2..7429959 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -38,7 +38,7 @@ export interface EtaConfig {
}
/** Array of plugins */
- plugins: Array<{ processFnString?: Function; processAST?: Function }>
+ plugins: Array<{ processFnString?: Function; processAST?: Function; processTemplate?: Function }>
/** Remove all safe-to-remove whitespace */
rmWhitespace: boolean
diff --git a/src/parse.ts b/src/parse.ts
index 812d296..df2d1df 100644
--- a/src/parse.ts
+++ b/src/parse.ts
@@ -35,6 +35,15 @@ export default function parse(str: string, config: EtaConfig): Array