diff -Naur /root/Projects/dokuwiki/plugins/format.orig/syntax.php format/syntax.php --- /root/Projects/dokuwiki/plugins/format.orig/syntax.php 2008-03-08 20:45:28.000000000 +0000 +++ format/syntax.php 2008-03-09 13:24:39.000000000 +0000 @@ -19,7 +19,7 @@ * need to inherit from this class */ class syntax_plugin_format extends DokuWiki_Syntax_Plugin { - + private static $first_removal = true; // Used to work out the first time handle is called function getInfo(){ return array( @@ -65,6 +65,7 @@ function handle($match, $state, $pos) { global $conf; + global $ID; if ( $state == DOKU_LEXER_UNMATCHED ) { $matches = preg_split('/>/u',$match,2); $matches[0] = trim($matches[0]); @@ -73,6 +74,10 @@ } // $matches[0] is the format name // $matches[1] is the text inside the format block + if (self::$first_removal == true) { + $this->removeOld($matches[0]); + self::$first_removal = false; + } return array($matches[1],$matches[0]); } return TRUE; @@ -82,6 +87,7 @@ */ function render($mode, &$renderer, $data) { global $conf; + global $ID; $program = $data[1]; $text = $data[0]; if(($mode == 'xhtml' || $mode == 'latex' ) @@ -101,15 +107,16 @@ $multipart = false; } - // TODO: make directory mediadir/format/program/namespace/page - $dirname = $conf['mediadir'] . '/format/' . $program; + $ns_path = $ID; + $ns_path = str_replace(":","/",$ns_path); // Work out the namespace and page + $dirname = $conf['mediadir'].'/auto/format/'.$program.'/'.$ns_path; if( !is_dir($dirname) ) io_mkdir_p($dirname); //Using dokuwiki framework $hashname = md5(serialize($data)).'.'.$config[$mode]['ext']; $medianame = $dirname.'/'.$hashname; - $medians = ":format:".$program.":"; + $medians = "auto:format:".$program.":".$ID.":"; if($multipart) { $medians = $medians.$hashname.":"; } @@ -211,6 +218,34 @@ print("
".$data.""); } + /* The first time handle() is called for the page, we need to remove any existing created + files Within data/auto/format/