mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-13 21:35:02 +00:00
templateFormatter: fix empty string args not getting counted as arguments; add concat base template function
This commit is contained in:
parent
f7f08ffd3b
commit
8f898ed972
2 changed files with 14 additions and 1 deletions
|
@ -59,7 +59,7 @@ export function parseTemplate(str: string): ParsedTemplate {
|
|||
const dumpArg = () => {
|
||||
if (!currentVar) return;
|
||||
|
||||
if (currentVar._state.currentArg !== null && currentVar._state.currentArg !== "") {
|
||||
if (currentVar._state.currentArgType) {
|
||||
if (currentVar._state.currentArgType === "number") {
|
||||
if (isNaN(currentVar._state.currentArg as any)) {
|
||||
throw new TemplateParseError(`Invalid numeric argument: ${currentVar._state.currentArg}`);
|
||||
|
@ -272,6 +272,9 @@ const baseValues = {
|
|||
not(arg) {
|
||||
return !arg;
|
||||
},
|
||||
concat(...args) {
|
||||
return [...args].join("");
|
||||
},
|
||||
};
|
||||
|
||||
export async function renderTemplate(template: string, values = {}, includeBaseValues = true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue