HomePhabricator

skins: Port SkinFallback and SkinApiOutput to a generic SkinMustache class

Description

skins: Port SkinFallback and SkinApiOutput to a generic SkinMustache class

The new SkinMustache class is based on the emerging class in Vector.
Having this in core, will allow Vector to make use of this class
immediately and provide a minimal generic mechanism going forward
for rendering skins using Mustache. For now, I've fleshed out the minimum
possible data in getTemplateData which are based on existing functions in
Vector.

The Skin class now takes a generic options parameter which allows
registration of a skin using the SkinMustache class with a templateDirectory
option pointing to the associated template. A styles option can be passed
to define stylesheets that should be associated with the skin.

The SkinApi and SkinFallback classes are reduced significantly.

There are no known uses of SkinApiTemplate and it is thus removed.

SkinFallbackTemplate is removed and its functions copied across to
SkinFallback

End user changes:

  • The fallback skin no longer prints the confusing warning message if the default skin is setup incorrectly. Previously viewing the fallback skin with useskin indicated that wgDefaultSkin was not set correctly which was misleading and confusing.
  • Factory functions now receive skin options as a second parameter and the service as a first - this is due to how ObjectFactory handles the extraArgs key for 'factory' key
    • placing it at the beginning.

Bug: T254048
Change-Id: Ibbabd1d0f26efebf8f8ff068966685dc2191c527

Details

Provenance
JdlrobsonAuthored on May 29 2020, 11:00 PM
Parents
rMWd7e2a20785ab: resourceloader: Improve packageFiles/skinScripts error message
Branches
Unknown
Tags
Unknown
ChangeId
Ibbabd1d0f26efebf8f8ff068966685dc2191c527