WikitextBackend Interface Notes
Based on the research carried out in WikiTransformation Usages, this document seeks to draw up with a PHP interface for exposing equivalent functionality to how WikiTransformation
is used. This way, we can abstract the wikitext backend used based on a configuration flag, easing our transition into using ftml instead of Text_Wiki.
See WJ-363: Integrate ftml as a parser/renderer within WikijumpDone.
The proposed interface, in PHP psuedo-code, could look like this:
This is intended less as a formal proposal than a scratch location for writing out thoughts as I look at usages of WikiTransformation
.
enum WikitextMode {
FEED,
LIST,
PAGE,
FORUM_POST,
DIRECT_MESSAGE,
TABLE_OF_CONTENTS,
}
function __construct(WikitextMode $mode, PageInfo $pageInfo);
function renderHtml(string $wikitext): HtmlOutput;
function renderText(string $wikitext): TextOutput;
The WikiTransformation::purifyHtml
static method will be moved to a new HTML utility class.
We will need to output backlinks and include numbers up to the main page compilation in Outdater
.
Â