meblog
Version:
A simple blog engine for personal blogging
32 lines (31 loc) • 1.08 kB
TypeScript
import DataSource from './DataSource';
import { Config, Tag } from '../model';
import { Post } from '../post/Post';
export default class FilesSource extends DataSource {
private readonly postsDirectoryPath;
private readonly dataDirectoryPath;
private readonly separator;
private readonly postParser;
private readonly postLayouts;
private posts;
private tags;
constructor(config: Config, postsDirectoryPath: string, separator?: string);
get postsJsonPath(): string;
get tagsJsonPath(): string;
private getLayouts;
private filterInvalidPostLayout;
private getSourcePostPaths;
private hasAnyChanges;
private parse;
private parsePosts;
private cacheData;
private filterUnpublishedPosts;
parsePostsFromPaths(filePaths: string[]): Post[];
loadData(force?: boolean): void;
private setupPostMap;
protected filterPost(post: Post, locale: string): boolean;
getPosts(locale?: string): Post[];
getAllPosts(): Post[];
getPostsByTag(tag: Tag, locale?: string): Post[];
getTags(): Tag[];
}