UNPKG

md-toy-blog

Version:

Very simple Markdown blog: serves your md as html without fancy databases. You will only spend time writing the actual data.

34 lines (33 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AppPathResolverService = /** @class */ (function () { function AppPathResolverService(config) { this.compiledUserContentDir = config.compiledUserContentDir; this.mdBlogPostsDir = config.mdBlogPostsDir; this.staticFilesDir = config.staticFilesDir; this.pagesDir = config.pagesDir; this.viewTemplatesDir = config.viewTemplatesDir; this.getMarkdownFilePath = this.getMarkdownFilePath.bind(this); this.getViewTemplateFilePath = this.getViewTemplateFilePath.bind(this); } // md post AppPathResolverService.prototype.getMarkdownFilePath = function (postSlug) { var filepath = this.mdBlogPostsDir + "/" + postSlug + ".md"; return filepath; }; AppPathResolverService.prototype.getViewTemplateFilePath = function (controllerName) { var filepath = this.viewTemplatesDir + "/" + this.getViewTemplateBaseName(controllerName) + ".html"; return filepath; }; AppPathResolverService.prototype.getViewTemplateBaseName = function (controllerName) { //const fullName = this.constructor.name; var withoutController = controllerName .substring(0, controllerName.length - 'Controller'.length); var UCToLowerDashed = withoutController .replace(/[A-Z]/g, function (m) { return "-" + m.toLowerCase(); }) .substring(1); return UCToLowerDashed; }; return AppPathResolverService; }()); exports.default = AppPathResolverService;