User:Phuedx (WMF)/Extension:Cards

Cards is a small library that allows the developer to retrieve a summary of one or more wiki pages from a MediaWiki wiki. Eventually, the library will be used to replace similar behaviour in RelatedArticles, Gather, and MobileFrontend. As the library deals with presentation in the UA and is intended to be used only by MediaWiki extensions it is also packaged as a MediaWiki extension.

Operation
mw.loader.using( 'ext.cards.gateway', function {

new mw.cards.CardsGateway( { api: new mw.Api } )

.getCards( [ 'Maybeshewill' ] );

} ); Using the injected instance of,   makes an API request to the target wiki for the first sentence of the page in plain text, returned by TextExtracts, and a thumbnail, returned by PageImages. The API result is processed so that it can be rendered by the Hogan.js templating library.

N.B. that the plain text extract is escaped by Hogan.js.

Potential Attack Vectors
TBD