mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-13 21:35:02 +00:00
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
|
@ -342,6 +342,12 @@ const baseValues = {
|
|||
return result / parseFloat(arg);
|
||||
}, args[0]);
|
||||
},
|
||||
cases(mod, ...cases) {
|
||||
if (cases.length === 0) return "";
|
||||
if (isNaN(mod)) return "";
|
||||
mod = parseInt(mod, 10) - 1;
|
||||
return cases[Math.max(0, mod % cases.length)];
|
||||
},
|
||||
};
|
||||
|
||||
export async function renderTemplate(template: string, values = {}, includeBaseValues = true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue