UNPKG

@rr0/cms

Version:

RR0 Content Management System (CMS)

45 lines (44 loc) 1.49 kB
import { HtmlFileContents } from "ssg-api"; import { HtmlRR0Context } from "../RR0Context.js"; import fs from "fs"; import { TimeTextBuilder } from "../time/text/TimeTextBuilder.js"; import { FileVisitor } from "../RR0ContentStep.js"; export type PageInfo = { title: string; url: string; time: string; html?: string; }; type WordCount = { pageIndex: number; count: number; }; export type SearchIndex = { pages: PageInfo[]; words: { [key: string]: WordCount[]; }; }; export type SearchCommandConfig = { notIndexedUrls: string[]; indexWords: boolean; indexContent?: string; }; /** * Builds an index of pages. */ export declare class SearchVisitor implements FileVisitor { protected config: SearchCommandConfig; protected timeTextBuilder: TimeTextBuilder; readonly index: SearchIndex; protected readonly contentStream: fs.WriteStream | undefined; constructor(config: SearchCommandConfig, timeTextBuilder: TimeTextBuilder); contentStepEnd(): Promise<void>; visit(context: HtmlRR0Context): Promise<void>; protected handleAlreadyIndexed(title: string, url: string, titleIndexed: PageInfo): void; protected getContents(doc: Document): string; protected indexContent(context: HtmlRR0Context, outputFile: HtmlFileContents): void; protected indexWords(context: HtmlRR0Context, outputFile: HtmlFileContents): void; protected removeTags(div: HTMLDivElement, selector: string): void; } export {};