UNPKG

docutils-ts

Version:

Port of the Python Docutils library to TypeScript

40 lines (39 loc) 1.87 kB
import { Attributes, NodeInterface, ReporterInterface, Systemmessage, WritableStream } from "./types.js"; /** * Return the "source" and "line" attributes from the `node` given or from * its closest ancestor. */ declare function getSourceLine(node: NodeInterface): [string | undefined, number | undefined]; interface ReporterObserverCallback { (msg: Systemmessage): void; } declare class Reporter implements ReporterInterface { private source; private observers; maxLevel: number; private debugLevel; DEBUG_LEVEL: number; INFO_LEVEL: number; WARNING_LEVEL: number; ERROR_LEVEL: number; private SEVERE_LEVEL; debugFlag?: boolean; reportLevel: number; private haltLevel; private errorHandler; private stream?; private encoding?; constructor(source: string, reportLevel: number, haltLevel?: number, stream?: WritableStream, debug?: boolean, encoding?: string, errorHandler?: string); setConditions(): void | never; systemMessage(level: number, message: string | Error, children?: NodeInterface[], kwargs?: Attributes): NodeInterface; notifyObservers(message: Systemmessage): void; attachObserver(observer: ReporterObserverCallback): void; debug(message: string | Error, children?: NodeInterface[], kwargs?: Attributes): NodeInterface | undefined; info(message: string | Error, children?: NodeInterface[], kwargs?: Attributes): NodeInterface; warning(message: string | Error, children?: NodeInterface[], kwargs?: Attributes): NodeInterface; error(message: string | Error, children?: NodeInterface[], kwargs?: Attributes): NodeInterface; severe(message: string | Error, children?: NodeInterface[], kwargs?: Attributes): NodeInterface; getSourceAndLine?: (lineno?: number) => [string, number] | undefined; } export default Reporter; export { getSourceLine };