This commit is contained in:
Nick Stokoe
2022-12-28 13:47:11 +00:00
parent 843416ff27
commit 8a7187c803

View File

@@ -8,8 +8,8 @@ const nhm = new NodeHtmlMarkdown({
}); });
function toYaml(data, body) { function toYaml(data, body) {
const frontmatter = Object.keys(data).sort().map(key => key+': '+(data[key] ?? '')).join("\n"); const frontmatter = Object.keys(data).sort().map(key => key+': '+(data[key] ? '"'+data[key]+'"' : '')).join("\n");
return frontmatter + "\n---\n" + nhm.translate(body); return "---\n" + frontmatter + "\n---\n" + nhm.translate(body);
} }
function date(datestr) { function date(datestr) {
@@ -26,7 +26,7 @@ data.forEach((node, ix) => {
const lang = 'und'; const lang = 'und';
const filepath = path.join('out', node.type); const filepath = path.join('out', node.type);
const body = node.body.und[0].value; const body = node.body.und[0].value;
const filename = `${node.uuid}.yml`; const filename = `${node.uuid}.md`;
fs.mkdirSync(path.join(__dirname, filepath), { recursive: true }); fs.mkdirSync(path.join(__dirname, filepath), { recursive: true });
const item = { const item = {