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. | |
Public Attributes | |
const | OPT_LANG = ValueFormatter::OPT_LANG |
Options key for controlling the output language. | |
const | FORMAT_PLAIN = 'text/plain' |
Output format types. | |
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. | |
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. | |
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. | |
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\Client\DataAccess\Scribunto\WikitextPreprocessingSnakFormatter, Wikibase\Client\Usage\UsageTrackingSnakFormatter, Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter, Wikibase\Lib\Formatters\DispatchingSnakFormatter, Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter, Wikibase\Lib\Formatters\EscapingSnakFormatter, Wikibase\Lib\Formatters\MessageSnakFormatter, and Wikibase\Lib\Formatters\PropertyValueSnakFormatter.
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\Client\DataAccess\Scribunto\WikitextPreprocessingSnakFormatter, Wikibase\Client\Usage\UsageTrackingSnakFormatter, Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter, Wikibase\Lib\Formatters\DispatchingSnakFormatter, Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter, Wikibase\Lib\Formatters\EscapingSnakFormatter, Wikibase\Lib\Formatters\HtmlExternalIdentifierFormatter, Wikibase\Lib\Formatters\MessageSnakFormatter, Wikibase\Lib\Formatters\PropertyValueSnakFormatter, and Wikibase\Lib\Formatters\WikitextExternalIdentifierFormatter.
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.