Requests for comment/ChangesList formatting

ChangesList
The list of changes on the Special:Recentchanges, Special:Watchlist and Special:RecentChangesLinked ("Related changes") are formatted using the ChangesList class or derivatives of it. There are several formats for ChangesList, including OldChangesList, EnhancedChangesList, as well, as CleanChanges provided by an extension and perhaps others.

ChangesList generally take a list or RecentChange records and one-by-one format them in a standard way, with special casing for log entries. As new types of changes become available, such as provided by extensions (e.g. Flow, Wikibase), the standard formatting does not always work well. For the OldChangesList, there is a hook for each change line, at the end, after formatting it in the standard way, where extensions can modify it or replace it. There is no equivalent hook(s) for EnhancedChanges and even if there were, certain aspects of formatting are hardcoded like formatting the recent changes flags.

The RecentChanges table now has a newish column, rc_source, which is more flexible for specifying different types of RecentChange entries. For example, 'mw.edit', 'mw.log', 'mw.new' for core RecentChange types and 'wb' and 'flow' provided by extensions.

A more flexible approach would be to define ChangeLineFormatter interface and allow registering ChangeLineFormatter implementations for each rc_source type.

ChangeLineEntry
The database records used for ChangesList includes information from the recentchanges table, as well as watchlist and change tags. Current approach is to directly set addition variables (counter, notificationtimestamp, numberofWatchingusers) on the RecentChange object:

Additional parameters (watched, linenumber) are also given to ChangesList for each line, as a method argument.

Steps

 * Separate all ChangesList formatting functionality from the ChangesList class so it is more reusable.

ChangesList

 * Date header
 * Check if to start new date section
 * if yes
 * close previous section
 * add date header
 * start new section

ChangesListEntry

 * ChangesListEntry (RecentChange)
 * EnhancedChangesListEntry

ChangeLine

 * ChangeLine (interface)
 * OldChangeLine
 * EnhancedChangesUngroupedLine
 * EnhancedChangesBlockGroupLine
 * flags
 * EnhancedChangesGroupNestedEntry

ChangeLineFormatter

 * ChangeLineFormatter (interface)
 * OldChangeLineFormatter
 * EnhancedChangesBlockGroupLineFormatter

EnhancedChangesBlockGroup

 * EnhancedChangesBlockGroup
 * EnhancedChangesBlockGroupSummaryLine
 * arrow
 * flags / timestamp
 * change summary
 * EnhancedChangesBlockGroupLine[]

Other formatters

 * flags
 * character difference
 * rollback