|
| __construct (SiteConfig $siteConfig, DataAccess $dataAccess) |
|
| wikitext2html (PageConfig $pageConfig, array $options=[], ?array &$headers=null, ?ContentMetadataCollector $metadata=null) |
| Parse the wikitext supplied in a PageConfig to HTML.
|
|
| wikitext2lint (PageConfig $pageConfig, array $options=[]) |
| Lint the wikitext supplied in a PageConfig .
|
|
| dom2wikitext (PageConfig $pageConfig, Document $doc, array $options=[], ?SelserData $selserData=null) |
| Serialize DOM to wikitext.
|
|
| html2wikitext (PageConfig $pageConfig, string $html, array $options=[], ?SelserData $selserData=null) |
| Serialize HTML to wikitext.
|
|
| pb2pb (PageConfig $pageConfig, string $update, PageBundle $pb, array $options=[]) |
| Update the supplied PageBundle based on the $update type.
|
|
| substTopLevelTemplates (PageConfig $pageConfig, string $wikitext) |
| Perform pre-save transformations with top-level templates subst'd.
|
|
| implementsLanguageConversionBcp47 (PageConfig $pageConfig, Bcp47Code $htmlVariant) |
| Check if language variant conversion is implemented for a language.
|
|
|
static | version () |
| Returns the currently-installed version of Parsoid.
|
|
static | defaultHTMLVersion () |
| Returns the default HTML content version.
|
|
static | resolveContentVersion (string $version) |
| See if any content version Parsoid knows how to produce satisfies the the supplied version, when interpreted with semver caret semantics.
|
|
static | supportsLanguageConversion () |
| Determine if language conversion is enabled, aka if the optional wikimedia/langconv library is installed.
|
|
static | findDowngrade (string $from, string $to) |
| Check whether a given content version can be downgraded to the requested content version.
|
|
static | downgrade (array $dg, PageBundle $pageBundle) |
| Downgrade a document to an older content version.
|
|
◆ defaultHTMLVersion()
static Wikimedia\Parsoid\Parsoid::defaultHTMLVersion |
( |
| ) |
|
|
static |
Returns the default HTML content version.
- Returns
- string
◆ dom2wikitext()
Serialize DOM to wikitext.
- Parameters
-
PageConfig | $pageConfig | |
Document | $doc | Data attributes are expected to have been applied already. Loading them will happen once the environment is created. |
array | $options | [ 'inputContentVersion' => (string) The content version of the input. Necessary if it differs from the current default in order to account for any serialization differences. 'offsetType' => (string) ucs2, char, byte are valid values what kind of source offsets are present in the HTML? 'contentmodel' => (string|null) The content model of the input. 'htmlVariantLanguage' => (Bcp47Code) If non-null, the language variant used for Parsoid HTML. 'wtVariantLanguage' => (Bcp47Code) If non-null, the language variant used for wikitext. 'traceFlags' => (array) associative array with tracing options 'dumpFlags' => (array) associative array with dump options 'debugFlags' => (array) associative array with debug options 'logLevels' => (string[]) Levels to log 'htmlSize' => (int) Size of the HTML that generated $doc ] |
?SelserData | $selserData | |
- Returns
- string
◆ downgrade()
static Wikimedia\Parsoid\Parsoid::downgrade |
( |
array | $dg, |
|
|
PageBundle | $pageBundle ) |
|
static |
Downgrade a document to an older content version.
- Parameters
-
string[] | $dg | Value returned by findDowngrade(). |
PageBundle | $pageBundle | |
◆ findDowngrade()
static Wikimedia\Parsoid\Parsoid::findDowngrade |
( |
string | $from, |
|
|
string | $to ) |
|
static |
Check whether a given content version can be downgraded to the requested content version.
- Parameters
-
string | $from | Current content version |
string | $to | Requested content version |
- Returns
- string[]|null The downgrade that will fulfill the request, as [ 'from' => <old version>, 'to' => <new version> ], or null if it can't be fulfilled.
◆ html2wikitext()
Wikimedia\Parsoid\Parsoid::html2wikitext |
( |
PageConfig | $pageConfig, |
|
|
string | $html, |
|
|
array | $options = [], |
|
|
?SelserData | $selserData = null ) |
Serialize HTML to wikitext.
Convenience method for dom2wikitext.
- Parameters
-
PageConfig | $pageConfig | |
string | $html | |
array | $options | |
?SelserData | $selserData | |
- Returns
- string
◆ pb2pb()
Wikimedia\Parsoid\Parsoid::pb2pb |
( |
PageConfig | $pageConfig, |
|
|
string | $update, |
|
|
PageBundle | $pb, |
|
|
array | $options = [] ) |
Update the supplied PageBundle based on the $update
type.
'convertoffsets': Convert offsets between formats (byte, char, ucs2) 'redlinks': Refreshes the classes of known, missing, etc. links. 'variant': Converts the HTML based on the supplied variant.
Note that these are DOM transforms, and not roundtrips through wikitext.
- Parameters
-
PageConfig | $pageConfig | |
string | $update | 'redlinks'|'variant' |
PageBundle | $pb | |
array | $options | |
- Returns
- PageBundle
◆ resolveContentVersion()
static Wikimedia\Parsoid\Parsoid::resolveContentVersion |
( |
string | $version | ) |
|
|
static |
See if any content version Parsoid knows how to produce satisfies the the supplied version, when interpreted with semver caret semantics.
This will allow us to make backwards compatible changes, without the need for clients to bump the version in their headers all the time.
- Parameters
-
- Returns
- string|null
◆ substTopLevelTemplates()
Wikimedia\Parsoid\Parsoid::substTopLevelTemplates |
( |
PageConfig | $pageConfig, |
|
|
string | $wikitext ) |
Perform pre-save transformations with top-level templates subst'd.
- Parameters
-
PageConfig | $pageConfig | |
string | $wikitext | |
- Returns
- string
◆ supportsLanguageConversion()
static Wikimedia\Parsoid\Parsoid::supportsLanguageConversion |
( |
| ) |
|
|
static |
Determine if language conversion is enabled, aka if the optional wikimedia/langconv library is installed.
- Returns
- bool True if the wikimedia/langconv library is available
◆ version()
static Wikimedia\Parsoid\Parsoid::version |
( |
| ) |
|
|
static |
Returns the currently-installed version of Parsoid.
- Returns
- string
◆ wikitext2html()
Parse the wikitext supplied in a PageConfig
to HTML.
- Parameters
-
PageConfig | $pageConfig | |
array | $options | [ 'wrapSections' => (bool) Whether <section> wrappers should be added. 'pageBundle' => (bool) Sets ids on nodes and stores data-* attributes in a JSON blob. 'body_only' => (bool|null) Only return the <body> children (T181657) 'outputContentVersion' => (string|null) Version of HTML to output. null returns the default version. 'contentmodel' => (string|null) The content model of the input. 'discardDataParsoid' => (bool) Drop all data-parsoid annotations. 'offsetType' => (string) ucs2, char, byte are valid values what kind of source offsets should be emitted? 'skipLanguageConversionPass' => (bool) Skip the language variant conversion pass (defaults to false) 'htmlVariantLanguage' => (Bcp47Code) If non-null, the language variant used for Parsoid HTML. 'wtVariantLanguage' => (Bcp47Code) If non-null, the language variant used for wikitext. 'logLinterData' => (bool) Should we log linter data if linting is enabled? 'traceFlags' => (array) associative array with tracing options 'dumpFlags' => (array) associative array with dump options 'debugFlags' => (array) associative array with debug options 'logLevels' => (string[]) Levels to log ] |
?array | &$headers | |
?ContentMetadataCollector | $metadata | Pass in a CMC in order to collect and retrieve metadata about the parse. |
- Returns
- PageBundle|string
◆ wikitext2lint()
Wikimedia\Parsoid\Parsoid::wikitext2lint |
( |
PageConfig | $pageConfig, |
|
|
array | $options = [] ) |
Lint the wikitext supplied in a PageConfig
.
- Parameters
-
PageConfig | $pageConfig | |
array | $options | See wikitext2html. |
- Returns
- array
◆ AVAILABLE_VERSIONS
const Wikimedia\Parsoid\Parsoid::AVAILABLE_VERSIONS = [ '2.8.0', '999.0.0' ] |
The documentation for this class was generated from the following file: