Templates 2.0 (#636)

Templates 2.0 and a whole bunch of other refactoring
This commit is contained in:
Zef Hemel
2024-01-20 19:16:07 +01:00
committed by GitHub
parent 0a6a0016a2
commit f30b1d3418
171 changed files with 2038 additions and 1628 deletions
+1
View File
@@ -54,6 +54,7 @@ export async function expandCodeWidgets(
// 'not found' is to be expected (no code widget configured for this language)
// Every other error should probably be reported
if (!e.message.includes("not found")) {
console.trace();
console.error("Error rendering code", e.message);
}
}
+8 -1
View File
@@ -330,6 +330,13 @@ function render(
const command = t.children![1].children![0].text!;
let commandText = command;
const aliasNode = findNodeOfType(t, "CommandLinkAlias");
const argsNode = findNodeOfType(t, "CommandLinkArgs");
let args: any = [];
if (argsNode) {
args = JSON.parse(`[${argsNode.children![0].text!}]`);
}
if (aliasNode) {
commandText = aliasNode.children![0].text!;
}
@@ -337,7 +344,7 @@ function render(
return {
name: "button",
attrs: {
"data-onclick": JSON.stringify(["command", command]),
"data-onclick": JSON.stringify(["command", command, args]),
},
body: commandText,
};