X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/db7b464d701c7d48777ddd38a10f69093cd5442c..e54f8139d084e0c8b2ad67e084cbeda3a2e35c90:/lib/blog.js diff --git a/lib/blog.js b/lib/blog.js index 98efabd..27a440e 100644 --- a/lib/blog.js +++ b/lib/blog.js @@ -9,6 +9,7 @@ const { debuglog, promisify } = require('util'); const StaticGenerator = require('./generators/static'); const HTMLGenerator = require('./generators/html'); const RSSGenerator = require('./generators/rss'); +const TXTGenerator = require('./generators/txt'); const internals = { @@ -80,7 +81,7 @@ module.exports = class Blog { await this._copyPost(postLocation); await this._writeMetadata(metadata); - await this._generate(); + await this.generate(); } /** @@ -99,7 +100,7 @@ module.exports = class Blog { // Parses markdown for each page, copies assets and generates index. - async _generate() { + async generate() { internals.debuglog('Generating output'); @@ -108,6 +109,7 @@ module.exports = class Blog { await StaticGenerator(this.postsDirectory, this.staticDirectory, posts); await HTMLGenerator(this.templatesDirectory, this.staticDirectory, posts); await RSSGenerator(this.templatesDirectory, this.staticDirectory, posts); + await TXTGenerator(this.templatesDirectory, this.staticDirectory, posts); } // Reads the posts into an array @@ -134,7 +136,9 @@ module.exports = class Blog { internals.debuglog('Parsing markdown'); posts.push({ ...metadata, - html: Marked(postContent) + index: i, + html: Marked(postContent), + raw: postContent }); } catch (error) {