docutils-ts
Version:
Port of the Python Docutils library to TypeScript
25 lines (24 loc) • 764 B
TypeScript
import Component from "./component.js";
import { Document, WriterParts } from "./types.js";
import Output from "./io/output.js";
/**
* Base class for all writers.
*/
export default abstract class Writer extends Component {
parts: WriterParts;
document?: Document;
private language?;
/**
* Final translated form of `document` (Unicode string for text, binary
* string for other forms); set by `translate`.
*/
output?: string | {};
/**
* `docutils.io` Output object; where to write the document.
* Set by `write`.
*/
private destination?;
write(document: Document, destination: Output<string> | undefined): Promise<string | {} | undefined>;
abstract translate(): void;
assembleParts(): void;
}