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

Registers and defines functions to access Wikibase through the Scribunto extension. More...

+ Inheritance diagram for Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary:
+ Collaboration diagram for Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary:

Public Member Functions

 getUsageAccumulator ()
 
 addStatementUsage (string $entityId, string $propertyId)
 Add a statement usage (called once specific statements are accessed).
 
 addLabelUsage (string $entityId, ?string $langCode)
 Add a label usage (called once specific labels are accessed).
 
 addDescriptionUsage (string $entityId, ?string $langCode)
 Add a description usage (called once specific descriptions are accessed).
 
 addSiteLinksUsage (string $entityId)
 Add a sitelinks usage (called once specific sitelinks are accessed).
 
 addOtherUsage (string $entityId)
 Add an other (O) usage (called once the otherwise not covered aspect is used).
 
 register ()
 Register mw.wikibase.entity.lua library.
 
 formatPropertyValues (string $entityId, string $propertyLabelOrId, array $acceptableRanks=null)
 Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as wikitext escaped plain text.
 
 formatStatements (string $entityId, string $propertyLabelOrId, array $acceptableRanks=null)
 Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as rich wikitext.
 
 incrementStatsKey (string $key)
 Increment the given stats key.
 
 getParserOutput ()
 

Private Member Functions

 getImplementation ()
 
 newImplementation ()
 
 newRichWikitextSnakFormatter (DataAccessSnakFormatterFactory $snakFormatterFactory, Language $lang)
 
 getLuaFunctionCallTracker ()
 
 getLanguage ()
 Returns the language to use.
 
 allowDataAccessInUserLanguage ()
 

Private Attributes

 $wbLibrary
 
 $luaFunctionCallTracker = null
 

Detailed Description

Registers and defines functions to access Wikibase through the Scribunto extension.

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >
Andrew Hall

Member Function Documentation

◆ addDescriptionUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addDescriptionUsage ( string $entityId,
?string $langCode )

Add a description usage (called once specific descriptions are accessed).

Parameters
string$entityIdThe Entity from which the descriptions were accessed.
string | null$langCodeLanguage code of the descriptions accessed.

◆ addLabelUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addLabelUsage ( string $entityId,
?string $langCode )

Add a label usage (called once specific labels are accessed).

Parameters
string$entityIdThe Entity from which the labels were accessed.
string | null$langCodeLanguage code of the labels accessed.

◆ addOtherUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addOtherUsage ( string $entityId)

Add an other (O) usage (called once the otherwise not covered aspect is used).

Parameters
string$entityIdThe Entity from which something was accessed.

◆ addSiteLinksUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addSiteLinksUsage ( string $entityId)

Add a sitelinks usage (called once specific sitelinks are accessed).

Parameters
string$entityIdThe Entity from which the sitelinks were accessed.

◆ addStatementUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addStatementUsage ( string $entityId,
string $propertyId )

Add a statement usage (called once specific statements are accessed).

Parameters
string$entityIdThe Entity from which the statements were accessed.
string$propertyIdProperty id of the statements accessed.

◆ allowDataAccessInUserLanguage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::allowDataAccessInUserLanguage ( )
private

◆ formatPropertyValues()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::formatPropertyValues ( string $entityId,
string $propertyLabelOrId,
array $acceptableRanks = null )

Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as wikitext escaped plain text.

Parameters
string$entityId
string$propertyLabelOrId
int[] | null$acceptableRanks
Exceptions
ScribuntoException
Returns
string[]|null[]

◆ formatStatements()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::formatStatements ( string $entityId,
string $propertyLabelOrId,
array $acceptableRanks = null )

Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as rich wikitext.

Parameters
string$entityId
string$propertyLabelOrId
int[] | null$acceptableRanks
Exceptions
ScribuntoException
Returns
string[]|null[]

◆ getImplementation()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getImplementation ( )
private

◆ getLanguage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getLanguage ( )
private

Returns the language to use.

If we are on a multilingual wiki (allowDataAccessInUserLanguage is true) this will be the user's interface language, otherwise it will be the content language. In a perfect world, this would equal Parser::getTargetLanguage.

This can probably be removed after T114640 has been implemented.

Please note, that this splits the parser cache by user language, if allowDataAccessInUserLanguage is true.

◆ getLuaFunctionCallTracker()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getLuaFunctionCallTracker ( )
private

◆ getParserOutput()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getParserOutput ( )

◆ getUsageAccumulator()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getUsageAccumulator ( )

◆ incrementStatsKey()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::incrementStatsKey ( string $key)

Increment the given stats key.

◆ newImplementation()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::newImplementation ( )
private

◆ newRichWikitextSnakFormatter()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::newRichWikitextSnakFormatter ( DataAccessSnakFormatterFactory $snakFormatterFactory,
Language $lang )
private

◆ register()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::register ( )

Register mw.wikibase.entity.lua library.

Returns
array

Member Data Documentation

◆ $luaFunctionCallTracker

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::$luaFunctionCallTracker = null
private

◆ $wbLibrary

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::$wbLibrary
private

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