templateFormatter: add cases() template function; Tags: add set/get tag functions to store/retrieve variables within tags
This commit is contained in:
parent
a8d274c054
commit
96b2d33423
2 changed files with 14 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue