Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Wikitext\Wikitext Class Reference

This class represents core wikitext concepts that are currently represented as methods of Parser.php (in core) OR Parsoid.php (here) or other classes. More...

Static Public Member Functions

static preprocess (Env $env, string $wt)
 Equivalent of 'preprocess' from Parser.php in core.
 

Detailed Description

This class represents core wikitext concepts that are currently represented as methods of Parser.php (in core) OR Parsoid.php (here) or other classes.

Care should be taken to have this class represent first-class wikitext concepts and operations and not so much implementation concepts, but that is understandably a hard line to draw. Given that, this suggestion is more of a guideline to help with code hygiene.

Member Function Documentation

◆ preprocess()

static Wikimedia\Parsoid\Wikitext\Wikitext::preprocess ( Env $env,
string $wt )
static

Equivalent of 'preprocess' from Parser.php in core.

  • expands templates
  • replaces magic variables

Notably, this doesn't support replacing template args from a frame, i.e. the preprocessing here is of standalone wikitext, not in reference to something else which is where a frame would be used.

This does not run any Parser hooks either, but support for which could eventually be added that is triggered by input options.

This also updates resource usage and returns an error if limits are breached.

Parameters
Env$env
string$wt
Returns
array
  • 'error' did we hit resource limits?
  • 'src' expanded wikitext OR error message to print FIXME: Maybe error message should be localizable

The documentation for this class was generated from the following file: