UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

55 lines (54 loc) 2.15 kB
import { PathProcessor, PathParserConfig, PathNormalizer, FileExtensionChecker, StringIdentity } from '../type'; import { Path } from '../entity/path'; export declare class PathProcessorImpl implements PathProcessor { private normalizer; private extChecker; constructor(normalizer?: PathNormalizer, extChecker?: FileExtensionChecker); parse(component: string, path: string): Path; parseIdentity(component: string, path: string): StringIdentity; parseBaseAndBaseNameNoIdentifier(component: string, path: string): [string, string]; private createPathComponents; private detectBundleType; private isContentFile; private getFileExtension; private calculatePathPositions; private extractIdentifiers; } export declare class PathParsingNormalizer implements PathNormalizer { readonly toLowerCase: boolean; readonly replaceSpaces: boolean; constructor(toLowerCase?: boolean, replaceSpaces?: boolean); normalize(path: string): string; } export declare class BasicPathNormalizer implements PathNormalizer { readonly toLowerCase: boolean; readonly replaceSpaces: boolean; constructor(toLowerCase?: boolean, replaceSpaces?: boolean); normalize(path: string): string; } export declare class DefaultFileExtensionChecker implements FileExtensionChecker { isContentExt(ext: string): boolean; isHTML(ext: string): boolean; hasExt(path: string): boolean; } export declare class ConfigurablePathNormalizer implements PathNormalizer { private rules; constructor(config?: PathParserConfig); normalize(path: string): string; addRule(rule: (path: string) => string): void; clearRules(): void; } export declare class PathParserUtils { static parseBasic(path: string): { dir: string; name: string; ext: string; nameWithoutExt: string; }; static join(...segments: string[]): string; static normalizeBasic(path: string): string; static isBundle(path: string): boolean; static extractSection(path: string): string; static removeExtension(path: string): string; static hasExtension(path: string): boolean; }