mirror of
https://github.com/morten-olsen/http.md.git
synced 2026-02-08 00:46:28 +01:00
init
This commit is contained in:
21
src/execution/handlers/handlers.text.ts
Normal file
21
src/execution/handlers/handlers.text.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { type ExecutionHandler } from '../execution.js';
|
||||
import Handlebars from "handlebars";
|
||||
|
||||
const textHandler: ExecutionHandler = ({
|
||||
addStep,
|
||||
node,
|
||||
}) => {
|
||||
if (node.type === 'text') {
|
||||
addStep({
|
||||
type: 'parse-text',
|
||||
node,
|
||||
action: async ({ context }) => {
|
||||
const template = Handlebars.compile(node.value);
|
||||
const content = template(context);
|
||||
node.value = content;
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export { textHandler };
|
||||
Reference in New Issue
Block a user