UNPKG

docutils-ts

Version:

Port of the Python Docutils library to TypeScript

23 lines (22 loc) 811 B
import FieldList from './fieldList.js'; import * as nodes from '../../../nodes.js'; class ExtensionOptions extends FieldList { /* Parse field_list fields for extension options. */ /* No nested parsing is done (including inline markup parsing). */ /** Override `Body.parse_field_body` for simpler parsing. */ parse_field_body(indented, offset, node) { const lines = []; for (const line of [...indented, '']) { if (line.trim()) { lines.push(line); } else if (lines.length) { const text = lines.join('\n'); node.add(new nodes.paragraph(text, text)); lines.length = 0; } } } } ExtensionOptions.stateName = 'ExtensionOptions'; export default ExtensionOptions;