3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 15:45:03 +00:00

templateFormatter: add cases() template function; Tags: add set/get tag functions to store/retrieve variables within tags

This commit is contained in:
Dragory 2019-03-16 17:54:05 +02:00
parent 23b083e3ae
commit af073904a7
2 changed files with 14 additions and 0 deletions

View file

@ -196,9 +196,17 @@ export class TagsPlugin extends ZeppelinPlugin<ITagsPluginConfig, ITagsPluginPer
// Format the string
try {
const dynamicVars = {};
body = await renderTemplate(body, {
args: tagArgs,
...this.tagFunctions,
set(name, val) {
if (typeof name !== "string") return;
dynamicVars[name] = val;
},
get(name) {
return dynamicVars[name] == null ? "" : dynamicVars[name];
},
});
} catch (e) {
if (e instanceof TemplateParseError) {