mirror of
https://github.com/morten-olsen/http.md.git
synced 2026-02-08 00:46:28 +01:00
22 lines
461 B
TypeScript
22 lines
461 B
TypeScript
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 };
|