@mdfriday/foundry
Version:
The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.
38 lines • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Standalone = exports.STANDALONE_PAGE_SITEMAP_BASE = exports.STANDALONE_PAGE_404_BASE = void 0;
const pagetrees_1 = require("./pagetrees");
const fileinfo_1 = require("../vo/fileinfo");
const pagesource_1 = require("./pagesource");
/**
* Constants - exact replica of Go's constants
*/
exports.STANDALONE_PAGE_404_BASE = "404";
exports.STANDALONE_PAGE_SITEMAP_BASE = "_sitemap";
/**
* Standalone class - exact replica of Go's Standalone struct
*/
class Standalone {
constructor(fsSvc) {
this.fsSvc = fsSvc;
}
/**
* Assemble - exact replica of Go's Assemble method
*/
async assemble(pages, pb) {
const key404 = "/" + exports.STANDALONE_PAGE_404_BASE;
const page404 = await this.addStandalone(key404, pb);
pages.insertIntoValuesDimension(key404, (0, pagetrees_1.newPageTreesNode)(page404));
const keySitemap = "/" + exports.STANDALONE_PAGE_SITEMAP_BASE;
const pageSitemap = await this.addStandalone(keySitemap, pb);
pages.insertIntoValuesDimension(keySitemap, (0, pagetrees_1.newPageTreesNode)(pageSitemap));
}
async addStandalone(key, pb) {
const fmi = this.fsSvc.newFileMetaInfo(key + '.md');
const f = (0, fileinfo_1.newFileInfo)(fmi);
const ps = (0, pagesource_1.newPageSource)(f);
return await pb.withSource(ps).kindBuild();
}
}
exports.Standalone = Standalone;
//# sourceMappingURL=standalone.js.map