public function execute($par) { $this->setHeaders(); $out = $this->getContext()->getOutput(); $out->addModules('ext.wikihiero.Special'); $out->addModuleStyles('ext.wikihiero.Special'); // apply CSS during slow load $out->addWikiMsg('wikihiero-special-page-text'); $out->addHTML('<div id="hiero-result">'); $text = trim($this->getContext()->getRequest()->getVal('text', '')); if ($text !== '') { $hiero = new WikiHiero(); $out->addHTML('<table class="wikitable">' . '<tr><th>' . wfMsg('wikihiero-input') . '</th><th>' . wfMsg('wikihiero-result') . '</th></tr>' . '<tr><td><code><hiero>' . nl2br(htmlspecialchars($text)) . "</hiero></code></td><td>{$hiero->render($text)}</td></tr></table>"); } $out->addHTML('</div>'); // id="hiero-result" $out->addHTML(Html::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLinkUrl())) . Html::element('textarea', array('id' => 'hiero-text', 'name' => 'text'), $text) . Html::element('input', array('type' => 'submit', 'id' => 'hiero-submit', 'name' => 'submit')) . Html::closeElement('form')); $this->hiero = new WikiHiero(); $out->addHTML('<table><tr><td>'); $out->addHTML('<div class="mw-hiero-list">'); $out->addHTML($this->listHieroglyphs()); $out->addHTML('</div></td><td>'); $out->addHTML($this->getToc()); $out->addHTML('</td></tr></table>'); }
/** * */ public static function parserHook($input) { $hiero = new WikiHiero(); // Strip newlines to avoid breakage in the wiki parser block pass return str_replace("\n", " ", $hiero->render($input)); }