PAGENAME for page instantiations
This commit is contained in:
@@ -42,10 +42,10 @@ export async function instantiateTemplateCommand() {
|
||||
let { text } = await readPage(selectedTemplate.name);
|
||||
|
||||
let parseTree = await parseMarkdown(text);
|
||||
let additionalPageMeta = extractMeta(parseTree, ["name"]);
|
||||
let additionalPageMeta = extractMeta(parseTree, ["PAGENAME"]);
|
||||
console.log("Page meta", additionalPageMeta);
|
||||
|
||||
let pageName = await prompt("Name of new page", additionalPageMeta.name);
|
||||
let pageName = await prompt("Name of new page", additionalPageMeta.PAGENAME);
|
||||
if (!pageName) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,10 @@ export function extractMeta(
|
||||
delete newData[key];
|
||||
}
|
||||
codeTextNode.children![0].text = stringifyYaml(newData).trim();
|
||||
// If nothing is left, let's just delete this thing
|
||||
if (Object.keys(newData).length === 0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user