From ab1d0f84c8e063c07bd88d281c49e9b45fcedc09 Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Mon, 20 Dec 2004 13:50:33 +0000 Subject: [PATCH] finally, a working version (needs flexbisonparse, cli mode) --- includes/ParserXML.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/includes/ParserXML.php b/includes/ParserXML.php index a4c30b1cce..130b4e581c 100644 --- a/includes/ParserXML.php +++ b/includes/ParserXML.php @@ -4,6 +4,11 @@ require_once ( "Parser.php" ) ; /** * This should one day become the XML->(X)HTML parser * Based on work by Jan Hidders and Magnus Manske + * To use, set + * $wgUseXMLparser = true ; + * $wgEnableParserCache = false ; + * $wgWiki2xml to the path and executable of the command line version (cli) + * in LocalSettings.php * @package MediaWiki * @subpackage Experimental */ @@ -127,6 +132,14 @@ class element { { $ret .= $this->sub_makeXHTML ( $parser , "td" ) ; } + else if ( $n == "TABLEHEAD" ) + { + $ret .= $this->sub_makeXHTML ( $parser , "th" ) ; + } + else if ( $n == "CAPTION" ) + { + $ret .= $this->sub_makeXHTML ( $parser , "caption" ) ; + } else if ( $n == "LISTITEM" ) @@ -315,9 +328,18 @@ class ParserXML EXTENDS Parser } function parse( $text, &$title, $options, $linestart = true, $clearState = true ) { - global $dummytext ; - $text = $dummytext ; - + global $wgWiki2xml ; + $tmpfname = tempnam("/tmp", "FOO"); + + $handle = fopen($tmpfname, "w"); + fwrite($handle, $text); + fclose($handle); + + exec ( $wgWiki2xml . " < " . $tmpfname , $a ) ; + $text = implode ( "\n" , $a ) ; + + unlink($tmpfname); + $w = new xml2php; $result = $w->scanString( $text ); $text .= "
" . $result->makeXHTML ( $this ); -- 2.20.1