Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory Class Reference

A factory for SnakFormatters in a client context, to be reused in different methods that "access repository data" from a client (typically parser functions and Lua scripts). More...

Public Member Functions

 __construct (LanguageFallbackChainFactory $languageFallbackChainFactory, OutputFormatSnakFormatterFactory $snakFormatterFactory, PropertyDataTypeLookup $propertyDataTypeLookup, EntityIdParser $repoItemUriParser, FallbackLabelDescriptionLookupFactory $fallbackLabelDescriptionLookupFactory, $trackUsagesInAllLanguages=false)
 
 newWikitextSnakFormatter (Language $language, UsageAccumulator $usageAccumulator, $type=self::TYPE_ESCAPED_PLAINTEXT)
 This returns a SnakFormatter that will return either "rich" wikitext, or wikitext escaped plain text.
 

Public Attributes

const TYPE_ESCAPED_PLAINTEXT = 'escaped-plaintext'
 A plain text format, escaped for wikitext.
 
const TYPE_RICH_WIKITEXT = 'rich-wikitext'
 A rich wikitext format.
 

Private Member Functions

 getRichWikitextSnakFormatterForOptions (FormatterOptions $options)
 
 getPlainTextSnakFormatterForOptions (FormatterOptions $options)
 Our output format is basically wikitext escaped plain text, except for URLs, these are not wikitext escaped.
 

Private Attributes

 $languageFallbackChainFactory
 
 $snakFormatterFactory
 
 $propertyDataTypeLookup
 
 $repoItemUriParser
 
 $fallbackLabelDescriptionLookupFactory
 
 $trackUsagesInAllLanguages
 

Detailed Description

A factory for SnakFormatters in a client context, to be reused in different methods that "access repository data" from a client (typically parser functions and Lua scripts).

Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::__construct ( LanguageFallbackChainFactory $languageFallbackChainFactory,
OutputFormatSnakFormatterFactory $snakFormatterFactory,
PropertyDataTypeLookup $propertyDataTypeLookup,
EntityIdParser $repoItemUriParser,
FallbackLabelDescriptionLookupFactory $fallbackLabelDescriptionLookupFactory,
$trackUsagesInAllLanguages = false )

Member Function Documentation

◆ getPlainTextSnakFormatterForOptions()

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::getPlainTextSnakFormatterForOptions ( FormatterOptions $options)
private

Our output format is basically wikitext escaped plain text, except for URLs, these are not wikitext escaped.

Parameters
FormatterOptions$options
Returns
BinaryOptionDispatchingSnakFormatter

◆ getRichWikitextSnakFormatterForOptions()

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::getRichWikitextSnakFormatterForOptions ( FormatterOptions $options)
private
Parameters
FormatterOptions$options
Returns
EscapingSnakFormatter

◆ newWikitextSnakFormatter()

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::newWikitextSnakFormatter ( Language $language,
UsageAccumulator $usageAccumulator,
$type = self::TYPE_ESCAPED_PLAINTEXT )

This returns a SnakFormatter that will return either "rich" wikitext, or wikitext escaped plain text.

The only exception are URLs, these are not escaped but plain text.

Parameters
Language$language
UsageAccumulator$usageAccumulator
string$typeOne of DataAccessSnakFormatterFactory::TYPE_*
Returns
SnakFormatter

Member Data Documentation

◆ $fallbackLabelDescriptionLookupFactory

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::$fallbackLabelDescriptionLookupFactory
private

◆ $languageFallbackChainFactory

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::$languageFallbackChainFactory
private

◆ $propertyDataTypeLookup

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::$propertyDataTypeLookup
private

◆ $repoItemUriParser

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::$repoItemUriParser
private

◆ $snakFormatterFactory

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::$snakFormatterFactory
private

◆ $trackUsagesInAllLanguages

Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::$trackUsagesInAllLanguages
private

◆ TYPE_ESCAPED_PLAINTEXT

const Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::TYPE_ESCAPED_PLAINTEXT = 'escaped-plaintext'

A plain text format, escaped for wikitext.

Values are formatted in simple, textual formats, and any wikitext syntax they might contain (e.g. in string values) is escaped. The only exception are URLs, which are not escaped.

◆ TYPE_RICH_WIKITEXT

const Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory::TYPE_RICH_WIKITEXT = 'rich-wikitext'

A rich wikitext format.

Values may contain markup, such as hyperlinks or <span>s with language tags. Individual formatters still wikitext-escape their contents as needed (e.g. for strings). The result is always wrapped in an outer <span>.


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