import type { Config } from '../base'; export interface TitleOptions { temporary?: boolean | undefined; decode?: boolean | undefined; selfLink?: boolean | undefined; halfParsed?: boolean | undefined; page?: string | undefined; } /** * title object of a MediaWiki page * * MediaWiki页面标题对象 */ export declare class Title { #private; readonly valid: boolean; interwiki: string; /** namespace number / 命名空间 */ get ns(): number; /** 片段标识符 */ get fragment(): string | undefined; /** main part without the namespace / 不含命名空间的标题主体部分 */ get main(): string; set main(title: string); /** namespace prefix / 命名空间前缀 */ get prefix(): string; /** full title / 完整标题 */ get title(): string; /** * file extension * * 扩展名 * @since v1.1.0 */ get extension(): string | undefined; set extension(extension: string | undefined); /** @throws `RangeError` undefined namespace */ set ns(ns: number); set fragment(fragment: string | undefined); /** * display title * * 用于显示的标题 * @since v1.22.0 */ get displayTitle(): string; /** * @see MediaWikiTitleCodec::splitTitleString * * @param title 标题(含或不含命名空间前缀) * @param defaultNs 命名空间 * @param config * @param opt 选项 * @param opt.temporary 是否是临时标题 * @param opt.decode 是否需要解码 * @param opt.selfLink 是否允许selfLink * @param opt.page 当前页面标题 */ constructor(title: string, defaultNs: number, config: Config, { temporary, decode, selfLink, page }?: TitleOptions); /** * Check if the title is a redirect * * 检测是否是重定向 * @since v1.12.2 */ getRedirection(): [boolean, string]; /** * Get the URL of the title * * 生成URL * @param articlePath article path / 条目路径 * @since v1.10.0 */ getUrl(articlePath?: string): string; /** * Get the URL of the file * * 生成文件URL * @param width width / 宽度 * @param height height / 高度 * @since v1.32.0 * @throws `RangeError` invalid width or height * @throws `Error` not a file */ getFileUrl(width?: number | false, height?: number | false): string; /** * Perform unidirectional language conversion * * 执行单向转换 */ autoConvert(): void; /** * Get the title of its subject page * * 转换为主页面 * @since v1.1.0 */ toSubjectPage(): this; /** * Get the title of its talk page * * 转换为讨论页面 * @since v1.1.0 */ toTalkPage(): this; /** * Check if the title is a talk page * * 是否是讨论页 * @since v1.1.0 */ isTalkPage(): boolean; /** * Get the title of its base page * * 转换为上一级页面 * @since v1.1.0 */ toBasePage(): this; /** * Get the title of its root page * * 转换为根页面 * @since v1.1.0 */ toRootPage(): this; }