Interface should define what is needed to render the mobile (Minerva) skin and should be agnostic of where it comes from. It is passed into the skin or used by the skin during construction.
MobileFormatter (or a new class based on MobileFormatter) will implement this interfacThe MobileFormatter::newFromContext method will be passed an implementation of the IContentProvider which will provide access to the HTML for the current page. ItA DefaultContentProvider will obtain athe chunk of HTML generated by the PHP parser.
The idea is that future implementations of IContentProvider can provide content from places such as RESTBase and the MediaWiki API.
The idea is that a future class could also implement this interface using a request to RESTBase
= Motivations
* The developer tool using the live mediawiki api will be an alternative solution to T104561
* It will help us debug certain issues as proven by our work in T149852 and T151838
= Acceptance criteria
[] Define IContentFormatterProvider which provides a basic interface that is implemented by MobileFormatter. The first version should have newFromDefaultContentProvider which is passed to MobileFormatter.
[] IContext, setText and formatntProvider provides a getHTML methods. The new format method returns the formatted text of the class.
[] Refactor ExtMobileFrontend::DOMParse so that it calls:
```
$formatter = MobileFormatter::newFromContext( $context );
if ( $text ) {
$formatter->setText( $text );
}
return $formatter->format();
```
[] Refactor newFromContext method so this it creates an instance of MobileFormatter.constructor is passed an instance of GlobalVarConfig and OutputPage to allow calls to addModule, It should not execute any transformations until format is called.addModuleStyles and getTitle
[] Make MobileFormatter::filterContent protected and move the parameters to setters and getters that are defined inside newFromContext. filterContent should be called by the new format method.ExtMobileFrontend::DOMParse will be refactored so it uses IContentProvider to obtain the HTML that should be formatted by MobileFormatter
[] For development purposes introduce MwApiMobileFormatterContentProvider which obtains its HTML from a foreign (or local) mediawiki api. The api should be configurable so we can point to any wiki of our choosing. This will allow us to test MobileFormatter and styles on live Wikipedia articles.
[] Make it possible to configure MobileFormattDefaultContentProvider or MwApiMobileFormatterContentProvider as the default formatting engine for the wiki.
e.g. $wgMFMobileFormatterClass = 'MobileFormatter'
[] The URL used by MwApiMobileFormatterContentProvider is configurable so we can use it for any wiki in any language
e.g. $wgMFMwApiMobileFormatterBaseUri = 'https://en.wikipedia.org/w/api.php'