diff --git a/atom_generator/src/main.ts b/atom_generator/src/main.ts index b1b6e7e..64207a0 100644 --- a/atom_generator/src/main.ts +++ b/atom_generator/src/main.ts @@ -79,13 +79,13 @@ function generateAtom(path: string): string { // process html const html: string = Fs.readFileSync(path, { encoding: 'utf8' }); - for (let endIdx = 0; endIdx >= 0; ) { - const startIdx = html.indexOf('

= 0; ) { + const endIdx = html.indexOf('

= 0) ? endIdx : html.indexOf('', (startIdx + 4))); // don't include footer in the last post const post = html.slice(startIdx, postEndIdx); + startIdx = endIdx; // parse const $ = Cheerio.load(post, undefined, false);