Parsoid
A bidirectional parser between wikitext and HTML5
|
This implements some of the functionality that the tests/ParserTests/MockAPIHelper.php provides. More...
Public Member Functions | ||||||||||
__construct (SiteConfig $siteConfig, array $opts) | ||||||||||
getPageInfo ( $pageConfigOrTitle, array $titles) | ||||||||||
Return target data for formatting links.Replaces Batcher.getPageProps()
| ||||||||||
getFileInfo (PageConfig $pageConfig, array $files) | ||||||||||
Return information about files (images)This replaces ImageInfoRequest and Batcher.imageinfo()
| ||||||||||
parseWikitext (PageConfig $pageConfig, ContentMetadataCollector $metadata, string $wikitext) | ||||||||||
Perform a parse on wikitext.This replaces PHPParseRequest with onlypst = false, and Batcher.parse()
| ||||||||||
preprocessWikitext (PageConfig $pageConfig, ContentMetadataCollector $metadata, string $wikitext) | ||||||||||
Preprocess wikitext.This replaces PreprocessorRequest and Batcher.preprocess()
| ||||||||||
fetchTemplateSource (PageConfig $pageConfig, LinkTarget $title) | ||||||||||
Fetch latest revision of article/template content for transclusion.Technically, the ParserOptions might select a different revision other than the latest via ParserOptions::getTemplateCallback() (used for FlaggedRevisions, etc), but the point is that template lookups are by title, not revision id.This replaces TemplateRequest
| ||||||||||
fetchTemplateData (PageConfig $pageConfig, LinkTarget $title) | ||||||||||
Fetch templatedata for a title.This replaces TemplateDataRequest
| ||||||||||
logLinterData (PageConfig $pageConfig, array $lints) | ||||||||||
Log linter data.
| ||||||||||
addTrackingCategory (PageConfig $pageConfig, ContentMetadataCollector $metadata, string $key) | ||||||||||
Add a tracking category with the given key to the metadata for the page.
| ||||||||||
Public Member Functions inherited from Wikimedia\Parsoid\Config\DataAccess | ||||||||||
__construct () | ||||||||||
Base constructor. | ||||||||||
This implements some of the functionality that the tests/ParserTests/MockAPIHelper.php provides.
While originally implemented to support ParserTests, this is no longer used by parser tests.
Wikimedia\Parsoid\Mocks\MockDataAccess::__construct | ( | SiteConfig | $siteConfig, |
array | $opts ) |
SiteConfig | $siteConfig | |
array | $opts |
Wikimedia\Parsoid\Mocks\MockDataAccess::addTrackingCategory | ( | PageConfig | $pageConfig, |
ContentMetadataCollector | $metadata, | ||
string | $key ) |
Add a tracking category with the given key to the metadata for the page.
PageConfig | $pageConfig | the page on which the tracking category is to be added |
ContentMetadataCollector | $metadata | The metadata for the page |
string | $key | Message key (not localized) |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::fetchTemplateData | ( | PageConfig | $pageConfig, |
LinkTarget | $title ) |
Fetch templatedata for a title.This replaces TemplateDataRequest
PageConfig | $pageConfig | |
LinkTarget | $title |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::fetchTemplateSource | ( | PageConfig | $pageConfig, |
LinkTarget | $title ) |
Fetch latest revision of article/template content for transclusion.Technically, the ParserOptions might select a different revision other than the latest via ParserOptions::getTemplateCallback() (used for FlaggedRevisions, etc), but the point is that template lookups are by title, not revision id.This replaces TemplateRequest
PageConfig | $pageConfig | |
LinkTarget | $title | Title of the page to fetch |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::getFileInfo | ( | PageConfig | $pageConfig, |
array | $files ) |
Return information about files (images)This replaces ImageInfoRequest and Batcher.imageinfo()
PageConfig | $pageConfig | |
array | $files | [ [string Name, array Dims] ]. The array may contain
|
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::getPageInfo | ( | $pageConfigOrTitle, | |
array | $titles ) |
Return target data for formatting links.Replaces Batcher.getPageProps()
PageConfig | LinkTarget | $pageConfigOrTitle | Either a PageConfig or else just the context title from the PageConfig (as a LinkTarget) |
string[] | $titles |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::logLinterData | ( | PageConfig | $pageConfig, |
array | $lints ) |
Log linter data.
PageConfig | $pageConfig | |
array | $lints |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::parseWikitext | ( | PageConfig | $pageConfig, |
ContentMetadataCollector | $metadata, | ||
string | $wikitext ) |
Perform a parse on wikitext.This replaces PHPParseRequest with onlypst = false, and Batcher.parse()
PageConfig | $pageConfig | |
ContentMetadataCollector | $metadata | Will collect metadata about the parsed content. |
string | $wikitext |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.
Wikimedia\Parsoid\Mocks\MockDataAccess::preprocessWikitext | ( | PageConfig | $pageConfig, |
ContentMetadataCollector | $metadata, | ||
string | $wikitext ) |
Preprocess wikitext.This replaces PreprocessorRequest and Batcher.preprocess()
PageConfig | $pageConfig | |
ContentMetadataCollector | $metadata | Will collect metadata about the preprocessed content. |
string | $wikitext |
Reimplemented from Wikimedia\Parsoid\Config\DataAccess.