import type { compileTemplate } from 'pug'; import type { IFileWriter } from '../infobook/IFileWriter'; import type { IFluid } from '../infobook/IFluid'; import type { IInfoBook } from '../infobook/IInfoBook'; import type { IInfoSection } from '../infobook/IInfoSection'; import type { IItem } from '../infobook/IItem'; import type { ResourceHandler } from '../resource/ResourceHandler'; /** * Serializes an infobook to a collection of HTML files. */ export declare class HtmlInfoBookSerializer { readonly templateItem: compileTemplate; private readonly templateIndex; private readonly templateSection; private readonly appendixWrapper; private fileWriter; constructor(); serialize(infobook: IInfoBook, context: ISerializeContext, assetsPaths: string[]): Promise; serializeSectionIndex(infobook: IInfoBook, contextRoot: ISerializeContext, language: string, langPath: string): Promise; serializeSectionFiles(infobook: IInfoBook, contextRoot: ISerializeContext, language: string, langPath: string, sectionIndex: ISectionIndex): Promise; serializeSection(section: IInfoSection, context: ISerializeContext, onSection: (args: ISectionCallbackArgs) => Promise): Promise<{ filePath: string; sectionTitle: string; }>; createResourceLink(resourceHandler: ResourceHandler, context: ISerializeContext, resource: string, translationKey: string): { link: string; linkTarget: string; }; createItemDisplay(resourceHandler: ResourceHandler, context: ISerializeContext, fileWriter: IFileWriter, item: IItem, slot: boolean, annotation?: string): Promise; createFluidDisplay(resourceHandler: ResourceHandler, context: ISerializeContext, fileWriter: IFileWriter, fluid: IFluid, slot: boolean): Promise; tagFluid(context: ISerializeContext, fluidName: string): string; getLanguagePath(language: string, path?: string): string; /** * Convert Minecraft formatting codes to HTML formats. * * Based on https://minecraft.gamepedia.com/Formatting_codes * * @param {string} value A string value that can contain multiple formatting codes. * @returns {string} The re-formatted string value. */ formatString(value: string): string; protected ensureDirExists(dirPath: string): Promise; protected filePathToUrl(filePath: string, basePath: string, baseUrl: string): string; } export interface ISerializeContext { baseUrl: string; basePath?: string; breadcrumbs?: { url?: string; name: string; }[]; language?: string; path: string; modId: string; resourceHandler: ResourceHandler; colors: Record; headSuffixGetters: ((context: ISerializeContext) => string)[]; sectionIndex?: ISectionIndex; root: boolean; modName: string; modUrl: string; bookName: string; mods: string[]; googleAnalytics: string; googleAdsense: { client: string; format: string; slot: string; }; icon: string; } export interface ISectionCallbackArgs { index: boolean; breadcrumbs?: { url?: string; name: string; }[]; context: ISerializeContext; sectionTitle: string; section: IInfoSection; subSectionDatas: { url: string; sectionTitle: string; }[]; filePath: string; fileUrl: string; } export interface ISectionIndex { /** * The array of pages, with defined order. */ linkedPagesList: { name: string; url: string; }[]; /** * Mapping from url to page index within linkedPagesList. */ urlIndex: Record; /** * Mapping from tag to page URL. */ tags: Record; }