Esempio n. 1
0
 /**
  * Parse provided wikitext to HTML using RTE parser
  */
 public static function rteparse()
 {
     global $wgTitle, $wgRequest, $wgUser;
     wfProfileIn(__METHOD__);
     $wikitext = $wgRequest->getVal('wikitext', '');
     $parserOptions = new ParserOptions();
     // don't show [edit] link for sections
     $parserOptions->setEditSection(false);
     // disable headings numbering
     $parserOptions->setNumberHeadings(false);
     $parser = new RTEParser();
     // call preSaveTransform so signatures, {{subst:foo}}, etc. will work
     $wikitext = $parser->preSaveTransform($wikitext, $wgTitle, $wgUser, $parserOptions);
     // parse wikitext using RTE parser
     $html = $parser->parse($wikitext, $wgTitle, $parserOptions)->getText();
     $res = array('html' => $html);
     wfProfileOut(__METHOD__);
     return $res;
 }
Esempio n. 2
0
 /**
  * Parse given wikitext to HTML for CK
  */
 public static function WikitextToHtml($wikitext)
 {
     global $wgTitle;
     wfProfileIn(__METHOD__);
     $options = new ParserOptions();
     // don't show [edit] link for sections
     $options->setEditSection(false);
     // disable headings numbering
     $options->setNumberHeadings(false);
     RTE::$parser = new RTEParser();
     $html = RTE::$parser->parse($wikitext, $wgTitle, $options)->getText();
     wfProfileOut(__METHOD__);
     return $html;
 }