docutils-ts
Version:
Port of the Python Docutils library to TypeScript
33 lines (30 loc) • 1.41 kB
TypeScript
import SpecializedBody from './specializedBody.js';
import { RegexpResult, ContextArray, StateInterface, ParseMethodReturnType } from '../../../types.js';
/**
* Second and subsequent enumerated_list list_items.
*/
declare class EnumeratedList extends SpecializedBody {
private lastordinal;
private auto?;
private format?;
/** Enumerated list item. */
enumerator(match: RegexpResult, context: ContextArray, nextState: StateInterface): ParseMethodReturnType;
private is_enumerated_list_item;
/**
Analyze an enumerator and return the results.
:Return:
- the enumerator format ('period', 'parens', or 'rparen'),
- the sequence used ('arabic', 'loweralpha', 'upperroman', etc.),
- the text of the enumerator, stripped of formatting, and
- the ordinal value of the enumerator ('a' -> 1, 'ii' -> 2, etc.;
``None`` is returned for invalid enumerator text).
The enumerator format has already been determined by the regular
expression match. If `expected_sequence` is given, that sequence is
tried first. If not, we check for Roman numeral 1. This way,
single-character Roman numerals (which are also alphabetical) can be
matched. If no sequence has been matched, all sequences are checked in
order.
*/
private parse_enumerator;
}
export default EnumeratedList;