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 interface. It will obtain a chunk of HTML generated by the PHP parser.
The idea is that a future class could also implement this interface using a request to RESTBase
= Acceptance criteria
[] Define IContentFormatter which provides a basic interface that is implemented by MobileFormatter. The first version should have newFromContext, setText and format 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. It should not execute any transformations until format is called.
[] 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.
[] For development purposes introduce MwApiMobileFormatter 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 which will help us debug certain issues as proven by our work in T149852 and T151838
[] Make it possible to configure MobileFormatter or MwApiMobileFormatter as the default formatting engine for the wiki.
e.g. $wgMFMobileFormatterClass = 'MobileFormatter'
[] The URL used by MwApiMobileFormatter is configurable so we can use it for any wiki in any language
e.g. $wgMFMwApiMobileFormatterBaseUri = 'https://en.wikipedia.org/w/api.php'