Wikidot drives its parser and renderer through the Wikidot\Utils\WikiTransformation
class, which has a large number of fields and methods, making it difficult to determine exactly what the contract of the class is intended to be.
Here we will document all the present usages of WikiTransformation
to see what expectations and usecases it has, to be able to design the interface of WikitextBackend
.
FeedModule.php
, FrontForumModule.php
:
$wt = new WikiTransformation(); $wt->setMode("feed"); $template = $wt->processSource($format);
ForumPreviewPostModule.php
, ForumAction.php
:
$wt = new WikiTransformation(); $wt->setMode('post'); $body = $wt->processSource($source);
ForumPostRevisionModule.php
:
$source = $revision->getText(); $wt = new WikiTransformation(); $body = $wt->processSource($source);
PMAction.php
, PMPreviewModule.php
:
$wt = new WikiTransformation(); $wt->setMode('pm'); $body = $wt->processSource($source);
PMDraftsMessageModule.php
:
$wt = new WikiTransformation(); $wt->setMode('pm'); $message->setBody($wt->processSource($message->getBody()));
PagePreviewModule.php
:
$wt = new WikiTransformation(); $wt->setPageUnixName($pl->getParameterValue("page_unix_name")); /* snip */ if ($templatePage) { $source = $wt->assemblyTemplate($source, $templatePage->getSource()); } $result = $wt->processSource($source);
PageVersionModule.php
:
$tr = new WikiTransformation(); $content = $tr->processSource($source);
ListPagesModule.php
:
if ($separation) { $wt = new WikiTransformation(); $wt->setMode("list"); $wt->setPage($page); $b = $wt->processSource($b); $b = "<div class=\"list-pages-item\">\n" . $b . "</div>"; //$b = "[[div class=\"list-pages-item\"]]\n".$b."\n[[/div]]"; }
if (!$separation) { $prependLine = $this->_readParameter('prependLine'); $appendLine = $this->_readParameter('appendLine'); $wt = new WikiTransformation(); $wt->setMode("list"); $glue = "\n"; $itemsContent = $wt->processSource(($prependLine ? ($prependLine . "\n") : ''). implode($glue, $items) . ($appendLine ? ("\n". $appendLine) : '')); } else { $itemsContent = implode("\n", $items); }
SocialBookmarksModule.php
:
// purify??? $wt = new WikiTransformation(); $out = $wt->purifyHtml($out); return $out;