[REF] small cleanup for template helpers

This commit is contained in:
Géry Debongnie
2022-03-02 10:04:54 +01:00
committed by Samuel Degueldre
parent 2a1b99be2d
commit 79738e00c7
6 changed files with 44 additions and 35 deletions
+14
View File
@@ -71,3 +71,17 @@ export class Markup extends String {}
export function markup(value: any) {
return new Markup(value);
}
// -----------------------------------------------------------------------------
// xml tag helper
// -----------------------------------------------------------------------------
export const globalTemplates: { [key: string]: string | Element } = {};
export function xml(...args: Parameters<typeof String.raw>) {
const name = `__template__${xml.nextId++}`;
const value = String.raw(...args);
globalTemplates[name] = value;
return name;
}
xml.nextId = 1;