Wikibase
MediaWiki Wikibase extension
|
SnakFormatter is an interface for services that render Snaks to a specific output format. More...
Public Member Functions | |
formatSnak (Snak $snak) | |
getFormat () | |
Returns the format ID of the format this formatter generates. More... | |
Public Attributes | |
const | OPT_LANG = ValueFormatter::OPT_LANG |
Options key for controlling the output language. More... | |
const | FORMAT_PLAIN = 'text/plain' |
Output format types. More... | |
const | FORMAT_WIKI = 'text/x-wiki' |
const | FORMAT_HTML = 'text/html' |
const | FORMAT_HTML_DIFF = 'text/html; disposition=diff' |
const | FORMAT_HTML_VERBOSE = 'text/html; disposition=verbose' |
const | FORMAT_HTML_VERBOSE_PREVIEW = 'text/html; disposition=verbose-preview' |
const | OPT_ON_ERROR = 'on-error' |
Options key for controlling error handling. More... | |
const | ON_ERROR_WARN = 'warn' |
Value for the OPT_ON_ERROR option indicating that recoverable errors should cause a warning to be show to the user. More... | |
const | ON_ERROR_FAIL = 'fail' |
Value for the OPT_ON_ERROR option indicating that recoverable errors should cause the formatting to fail with an exception. More... | |
SnakFormatter is an interface for services that render Snaks to a specific output format.
A SnakFormatter may be able to work on any kind of Snak, or may be specialized on a single kind of snak.
Wikibase\Lib\Formatters\SnakFormatter::formatSnak | ( | Snak | $snak | ) |
Snak | $snak |
Implemented in Wikibase\Lib\Formatters\PropertyValueSnakFormatter, Wikibase\Lib\Formatters\MessageSnakFormatter, Wikibase\Lib\Formatters\EscapingSnakFormatter, Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter, Wikibase\Lib\Formatters\DispatchingSnakFormatter, Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter, Wikibase\Client\Usage\UsageTrackingSnakFormatter, and Wikibase\Client\DataAccess\Scribunto\WikitextPreprocessingSnakFormatter.
Wikibase\Lib\Formatters\SnakFormatter::getFormat | ( | ) |
Returns the format ID of the format this formatter generates.
This uses the FORMAT_XXX constants defined in OutputFormatSnakFormatterFactory.
Implemented in Wikibase\Lib\Formatters\WikitextExternalIdentifierFormatter, Wikibase\Lib\Formatters\PropertyValueSnakFormatter, Wikibase\Lib\Formatters\MessageSnakFormatter, Wikibase\Lib\Formatters\HtmlExternalIdentifierFormatter, Wikibase\Lib\Formatters\EscapingSnakFormatter, Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter, Wikibase\Lib\Formatters\DispatchingSnakFormatter, Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter, Wikibase\Client\Usage\UsageTrackingSnakFormatter, and Wikibase\Client\DataAccess\Scribunto\WikitextPreprocessingSnakFormatter.
const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML = 'text/html' |
const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML_DIFF = 'text/html; disposition=diff' |
const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML_VERBOSE = 'text/html; disposition=verbose' |
const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML_VERBOSE_PREVIEW = 'text/html; disposition=verbose-preview' |
const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_PLAIN = 'text/plain' |
Output format types.
Use SnakFormat::getBaseFormat or SnakFormat::isPossibleFormat when dispatching to a concrete formatter based on any of these (in order to support more nuanced formats in the future).
const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_WIKI = 'text/x-wiki' |
const Wikibase\Lib\Formatters\SnakFormatter::ON_ERROR_FAIL = 'fail' |
Value for the OPT_ON_ERROR option indicating that recoverable errors should cause the formatting to fail with an exception.
const Wikibase\Lib\Formatters\SnakFormatter::ON_ERROR_WARN = 'warn' |
Value for the OPT_ON_ERROR option indicating that recoverable errors should cause a warning to be show to the user.
const Wikibase\Lib\Formatters\SnakFormatter::OPT_LANG = ValueFormatter::OPT_LANG |
Options key for controlling the output language.
const Wikibase\Lib\Formatters\SnakFormatter::OPT_ON_ERROR = 'on-error' |
Options key for controlling error handling.