From 7cd535517d3366f0a42b0f42d128537098af2a45 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 11 Aug 2024 22:15:43 -0400 Subject: Fix atom generator starting before all posts have been rendered. --- generator/main.js | 10 +++++++--- generator/postrenderer.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'generator') diff --git a/generator/main.js b/generator/main.js index 3697dbd..87c5885 100755 --- a/generator/main.js +++ b/generator/main.js @@ -45,24 +45,28 @@ function ensure_dir(p) const post_dir=path.join(config.dest_dir,'post'); ensure_dir(post_dir); +const prps=[]; for(let j=0;j{console.log(`rendered: ${r}`);}) + .catch((e)=>{console.error(e);})); } const listrenderer=require('./listrenderer'); listrenderer.set_template(path.join(config.template_dir,'list_template')); list = list.filter((t) => (t.date.indexOf('UNLISTED') == -1)); -const gen_atom = require('./atomgen').gen_atom; -gen_atom(list, config); +Promise.all(prps).then((_) => { + const gen_atom = require('./atomgen').gen_atom; + gen_atom(list, config); +}); const list_dir=path.join(config.dest_dir,'list'); const ppp=config.posts_per_listpage; ensure_dir(list_dir); diff --git a/generator/postrenderer.js b/generator/postrenderer.js index 64cbb99..5a74d18 100644 --- a/generator/postrenderer.js +++ b/generator/postrenderer.js @@ -185,7 +185,7 @@ async function _render(inf,outf,np,pp) ); pp.stdin.end(); try { - trd.getElementById('article').innerHTML = await ppp; + trd.getElementById('article').innerHTML = await ppp; } catch (e) { console.log(`failed to render ${inf} : ${e}`); } -- cgit v1.2.3