Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Formatters\SnakFormatter Interface Reference

SnakFormatter is an interface for services that render Snaks to a specific output format. More...

+ Inheritance diagram for Wikibase\Lib\Formatters\SnakFormatter:

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...
 

Detailed Description

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.

Author
Daniel Kinzler

Member Function Documentation

◆ formatSnak()

◆ getFormat()

Member Data Documentation

◆ FORMAT_HTML

const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML = 'text/html'

◆ FORMAT_HTML_DIFF

const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML_DIFF = 'text/html; disposition=diff'

◆ FORMAT_HTML_VERBOSE

const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML_VERBOSE = 'text/html; disposition=verbose'

◆ FORMAT_HTML_VERBOSE_PREVIEW

const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_HTML_VERBOSE_PREVIEW = 'text/html; disposition=verbose-preview'

◆ FORMAT_PLAIN

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).

◆ FORMAT_WIKI

const Wikibase\Lib\Formatters\SnakFormatter::FORMAT_WIKI = 'text/x-wiki'

◆ ON_ERROR_FAIL

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.

◆ ON_ERROR_WARN

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.

◆ OPT_LANG

const Wikibase\Lib\Formatters\SnakFormatter::OPT_LANG = ValueFormatter::OPT_LANG

Options key for controlling the output language.

◆ OPT_ON_ERROR

const Wikibase\Lib\Formatters\SnakFormatter::OPT_ON_ERROR = 'on-error'

Options key for controlling error handling.


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