html2wt/ConstrainedText~RegExpConstrainedText(args)

This subclass allows specification of a regular expression for acceptable (or prohibited) leading (and/or trailing) contexts.

This is an abstract class; it's intended to be subclassed, not used directly, and so it not included in the lists of types tried by fromSelSer.

Show:

Constructor

new RegExpConstrainedText(args)

...
Parameters:
Name Type Description
args Object
Properties
Name Type Description
goodPrefix RegExp
goodSuffix RegExp
Source:

Extends

Methods

equals(ct) → {boolean}

Simple equality.

Simple equality. This enforces type equality (ie subclasses are not equal).

Parameters:
Name Type Description
ct Object
Inherited From:
Source:
Returns:
Type
boolean

escape(state) → {Object|string|string|string}

Use the provided state, which gives context and access to the entire list of chunks, to determine the proper escape prefix/suffix.

Use the provided state, which gives context and access to the entire list of chunks, to determine the proper escape prefix/suffix. Returns an object with a text property as well as optional prefix and 'suffix' properties giving desired escape strings.

Parameters:
Name Type Description
state Object
Overrides:
Source:
Returns:
  • Type
    Object
  • Return.text.

    Type
    string
  • [return.prefix].

    Type
    string
  • [return.suffix].

    Type
    string

match(re) → {Array|null}

Useful shortcut: execute a regular expression on the raw wikitext.

Useful shortcut: execute a regular expression on the raw wikitext.

Parameters:
Name Type Description
re RegExp
Inherited From:
Source:
Returns:

An Array containing the matched results or null if there were no matches.

Type
Array | null