[pLog-svn] r1323 - in plugins/trunk/textparser: . class/data class/data/Text class/data/Text/Wiki class/data/Text/Wiki/Parse class/data/Text/Wiki/Parse/Default class/data/Text/Wiki/Render class/data/Text/Wiki/Render/Latex class/data/Text/Wiki/Render/Plain class/data/Text/Wiki/Render/Xhtml class/data/textile

mark at devel.plogworld.net mark at devel.plogworld.net
Sat Mar 5 16:20:23 GMT 2005


Author: mark
Date: 2005-03-05 16:20:22 +0000 (Sat, 05 Mar 2005)
New Revision: 1323

Added:
   plugins/trunk/textparser/class/data/Text/
   plugins/trunk/textparser/class/data/Text/Wiki.php
   plugins/trunk/textparser/class/data/Text/Wiki/
   plugins/trunk/textparser/class/data/Text/Wiki/Parse.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Anchor.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Blockquote.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Bold.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Break.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Center.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Code.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Colortext.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Deflist.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Delimiter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Embed.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Emphasis.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Freelink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Function.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Heading.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Horiz.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Html.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Image.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Include.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Interwiki.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Italic.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/List.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Newline.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Paragraph.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Phplookup.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Prefilter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Raw.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Revise.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Strong.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Superscript.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Table.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tighten.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Toc.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tt.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Url.php
   plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Wikilink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Anchor.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Blockquote.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Bold.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Break.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Center.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Code.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Colortext.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Deflist.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Delimiter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Embed.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Emphasis.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Freelink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Function.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Heading.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Horiz.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Html.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Image.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Include.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Interwiki.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Italic.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/List.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Newline.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Paragraph.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Phplookup.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Prefilter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Raw.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Revise.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Strong.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Superscript.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Table.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tighten.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Toc.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tt.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Url.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Wikilink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Anchor.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Blockquote.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Bold.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Break.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Center.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Code.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Colortext.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Deflist.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Delimiter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Embed.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Emphasis.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Freelink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Function.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Heading.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Horiz.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Html.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Image.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Include.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Interwiki.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Italic.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/List.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Newline.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Paragraph.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Phplookup.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Prefilter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Raw.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Revise.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Strong.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Superscript.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Table.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tighten.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Toc.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tt.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Url.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Wikilink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Anchor.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Blockquote.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Bold.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Break.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Center.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Code.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Colortext.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Deflist.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Delimiter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Embed.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Emphasis.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Freelink.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Function.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Heading.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Horiz.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Html.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Image.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Include.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Interwiki.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Italic.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/List.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Newline.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Paragraph.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Phplookup.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Prefilter.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Raw.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Revise.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Strong.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Superscript.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Table.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tighten.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Toc.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tt.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Url.php
   plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Wikilink.php
Removed:
   plugins/trunk/textparser/class/data/Wiki.php
   plugins/trunk/textparser/class/data/Wiki/
Modified:
   plugins/trunk/textparser/class/data/textile/textile2.php
   plugins/trunk/textparser/plugintextparser.class.php
Log:
Finally, I fixed Text_Wiki and Textile works for UTF-8 Chinese, and also should work for other characters.

And also upgrade the Text_wiki package to 1.0 RC1.

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Anchor.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Anchor.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Anchor.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,87 @@
+<?php
+
+/**
+* 
+* Parses for anchor targets.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Manuel Holtgrewe <purestorm at ggnore dot net>
+*
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Anchor.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* This class implements a Text_Wiki_Parse to add an anchor target name
+* in the wiki page.
+*
+* @author Manuel Holtgrewe <purestorm at ggnore dot net>
+*
+* @author Paul M. Jones <pmjones at ciaweb dot net>
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+*/
+
+class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.  Looks like a macro: [[# anchor_name]]
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i';
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'text' => The full matched text, not including the <code></code> tags.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches) {
+    
+        $name = $matches[2];
+        $text = $matches[3];
+        
+        $start = $this->wiki->addToken(
+            $this->rule,
+            array('type' => 'start', 'name' => $name)
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule,
+            array('type' => 'end', 'name' => $name)
+        );
+        
+        // done, place the script output directly in the source
+        return $start . trim($text) . $end;
+    }
+}
+?>

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Blockquote.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Blockquote.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Blockquote.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,179 @@
+<?php
+
+/**
+* 
+* Parse for block-quoted text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Blockquote.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parse for block-quoted text.
+* 
+* Find source text marked as a blockquote, identified by any number of
+* greater-than signs '>' at the start of the line, followed by a space,
+* and then the quote text; each '>' indicates an additional level of
+* quoting.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * Regex for parsing the source text.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/\n((\>).*\n)(?!(\>))/Us';
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.
+    * 
+    * Token options are:
+    * 
+    * 'type' =>
+    *     'start' : the start of a blockquote
+    *     'end'   : the end of a blockquote
+    *
+    * 'level' => the indent level (0 for the first level, 1 for the
+    * second, etc)
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A series of text and delimited tokens marking the different
+    * list text and list elements.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // the replacement text we will return to parse()
+        $return = '';
+        
+        // the list of post-processing matches
+        $list = array();
+        
+        // $matches[1] is the text matched as a list set by parse();
+        // create an array called $list that contains a new set of
+        // matches for the various list-item elements.
+        preg_match_all(
+            '=^(\>+) (.*\n)=Ums',
+            $matches[1],
+            $list,
+            PREG_SET_ORDER
+        );
+        
+        // a stack of starts and ends; we keep this so that we know what
+        // indent level we're at.
+        $stack = array();
+        
+        // loop through each list-item element.
+        foreach ($list as $key => $val) {
+            
+            // $val[0] is the full matched list-item line
+            // $val[1] is the number of initial '>' chars (indent level)
+            // $val[2] is the quote text
+            
+            // we number levels starting at 1, not zero
+            $level = strlen($val[1]);
+            
+            // get the text of the line
+            $text = $val[2];
+            
+            // add a level to the list?
+            while ($level > count($stack)) {
+                
+                // the current indent level is greater than the number
+                // of stack elements, so we must be starting a new
+                // level.  push the new level onto the stack with a 
+                // dummy value (boolean true)...
+                array_push($stack, true);
+                
+                $return .= "\n";
+                
+                // ...and add a start token to the return.
+                $return .= $this->wiki->addToken(
+                    $this->rule, 
+                    array(
+                        'type' => 'start',
+                        'level' => $level - 1
+                    )
+                );
+                
+                $return .= "\n\n";
+            }
+            
+            // remove a level?
+            while (count($stack) > $level) {
+                
+                // as long as the stack count is greater than the
+                // current indent level, we need to end list types.
+                // continue adding end-list tokens until the stack count
+                // and the indent level are the same.
+                array_pop($stack);
+                
+                $return .= "\n\n";
+                
+                $return .= $this->wiki->addToken(
+                    $this->rule, 
+                    array (
+                        'type' => 'end',
+                        'level' => count($stack)
+                    )
+                );
+                
+                $return .= "\n";
+            }
+            
+            // add the line text.
+            $return .= $text;
+        }
+        
+        // the last line may have been indented.  go through the stack
+        // and create end-tokens until the stack is empty.
+        $return .= "\n";
+        
+        while (count($stack) > 0) {
+            array_pop($stack);
+            $return .= $this->wiki->addToken(
+                $this->rule, 
+                array (
+                    'type' => 'end',
+                    'level' => count($stack)
+                )
+            );
+        }
+        
+        // we're done!  send back the replacement text.
+        return "\n$return\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Bold.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Bold.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Bold.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,79 @@
+<?php
+
+/**
+* 
+* Parses for bold text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Bold.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for bold text.
+* 
+* This class implements a Text_Wiki_Rule to find source text marked for
+* strong emphasis (bold) as defined by text surrounded by three
+* single-quotes. On parsing, the text itself is left in place, but the
+* starting and ending instances of three single-quotes are replaced with
+* tokens.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Bold extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex =  "/'''(()|[^'].*)'''/U";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * emphasized text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A pair of delimited tokens to be used as a placeholder in
+    * the source text surrounding the text to be emphasized.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
+        $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
+        return $start . $matches[1] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Break.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Break.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Break.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,72 @@
+<?php
+
+/**
+* 
+* Parses for explicit line breaks.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Break.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for explicit line breaks.
+* 
+* This class implements a Text_Wiki_Parse to mark forced line breaks in the
+* source text.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Break extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/ _\n/';
+    
+    
+    /**
+    * 
+    * Generates a replacement token for the matched text.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A delimited token to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {    
+        return $this->wiki->addToken($this->rule);
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Center.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Center.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Center.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,78 @@
+<?php
+
+/**
+* 
+* Parses for centered lines of text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Center.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for centered lines of text.
+* 
+* This class implements a Text_Wiki_Parse to find lines marked for centering.
+* The line must start with "= " (i.e., an equal-sign followed by a space).
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = '/\n\= (.*?)\n/';
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule,
+            array('type' => 'start')
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule,
+            array('type' => 'end')
+        );
+        
+        return "\n" . $start . $matches[1] . $end . "\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Code.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Code.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Code.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,99 @@
+<?php
+
+/**
+* 
+* Parses for text marked as a code example block.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Code.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for text marked as a code example block.
+* 
+* This class implements a Text_Wiki_Parse to find sections marked as code
+* examples.  Blocks are marked as the string <code> on a line by itself,
+* followed by the inline code example, and terminated with the string
+* </code> on a line by itself.  The code example is run through the
+* native PHP highlight_string() function to colorize it, then surrounded
+* with <pre>...</pre> tags when rendered as XHTML.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'text' => The full matched text, not including the <code></code> tags.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // are there additional attribute arguments?
+        $args = trim($matches[2]);
+        
+        if ($args == '') {
+            $options = array(
+                'text' => $matches[3],
+                'attr' => array('type' => '')
+            );
+        } else {
+        	// get the attributes...
+        	$attr = $this->getAttrs($args);
+        	
+        	// ... and make sure we have a 'type'
+        	if (! isset($attr['type'])) {
+        		$attr['type'] = '';
+        	}
+        	
+        	// retain the options
+            $options = array(
+                'text' => $matches[3],
+                'attr' => $attr
+            );
+        }
+        
+        return $this->wiki->addToken($this->rule, $options) . $matches[5];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Colortext.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Colortext.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Colortext.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,89 @@
+<?php
+
+/**
+* 
+* Parses for colorized text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Colortext.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for colorized text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/\#\#(.+?)\|(.+?)\#\#/";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * emphasized text.  The text itself is left in the source.
+    * 
+    * 'color' => the color indicator
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the text to be
+    * emphasized.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule, 
+            array(
+                'type' => 'start',
+                'color' => $matches[1]
+            )
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, 
+            array(
+                'type' => 'end',
+                'color' => $matches[1]
+            )
+        );
+        
+        return $start . $matches[2] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Deflist.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Deflist.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Deflist.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,122 @@
+<?php
+
+/**
+* 
+* Parses for definition lists.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Deflist.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for definition lists.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked as a
+* definition list.  In short, if a line starts with ':' then it is a
+* definition list item; another ':' on the same line indicates the end
+* of the definition term and the beginning of the definition narrative.
+* The list items must be on sequential lines (no blank lines between
+* them) -- a blank line indicates the beginning of a new list.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/\n((: ).*\n)(?!(: |\n))/Us';
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' =>
+    *     'list_start'    : the start of a definition list
+    *     'list_end'      : the end of a definition list
+    *     'term_start'    : the start of a definition term
+    *     'term_end'      : the end of a definition term
+    *     'narr_start'    : the start of definition narrative
+    *     'narr_end'      : the end of definition narrative
+    *     'unknown'       : unknown type of definition portion
+    *
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A series of text and delimited tokens marking the different
+    * list text and list elements.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // the replacement text we will return to parse()
+        $return = '';
+        
+        // the list of post-processing matches
+        $list = array();
+        
+        // start the deflist
+        $options = array('type' => 'list_start');
+        $return .= $this->wiki->addToken($this->rule, $options);
+        
+        // $matches[1] is the text matched as a list set by parse();
+        // create an array called $list that contains a new set of
+        // matches for the various definition-list elements.
+        preg_match_all(
+            '/^(: )(.*)?( : )(.*)?$/Ums',
+            $matches[1],
+            $list,
+            PREG_SET_ORDER
+        );
+        
+        // add each term and narrative
+        foreach ($list as $key => $val) {
+            $return .= (
+                $this->wiki->addToken($this->rule, array('type' => 'term_start')) .
+                trim($val[2]) .
+                $this->wiki->addToken($this->rule, array('type' => 'term_end')) .
+                $this->wiki->addToken($this->rule, array('type' => 'narr_start')) .
+                trim($val[4]) . 
+                $this->wiki->addToken($this->rule, array('type' => 'narr_end'))
+            );
+        }
+        
+        
+        // end the deflist
+        $options = array('type' => 'list_end');
+        $return .= $this->wiki->addToken($this->rule, $options);
+        
+        // done!
+        return "\n" . $return . "\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Delimiter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Delimiter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Delimiter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,80 @@
+<?php
+
+/**
+* 
+* Parses for Text_Wiki delimiter characters already in the source text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Delimiter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for Text_Wiki delimiter characters already in the source text.
+* 
+* This class implements a Text_Wiki_Parse to find instances of the delimiter
+* character already embedded in the source text; it extracts them and replaces
+* them with a delimited token, then renders them as the delimiter itself
+* when the target format is XHTML.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
+    
+    /**
+    * 
+    * Constructor.  Overrides the Text_Wiki_Parse constructor so that we
+    * can set the $regex property dynamically (we need to include the
+    * Text_Wiki $delim character.
+    * 
+    * @param object &$obj The calling "parent" Text_Wiki object.
+    * 
+    * @param string $name The token name to use for this rule.
+    * 
+    */
+    
+    function Text_Wiki_Parse_delimiter(&$obj)
+    {
+        parent::Text_Wiki_Parse($obj);
+        $this->regex = '/' . $this->wiki->delim . '/';
+    }
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'text' => The full matched text.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {    
+        return $this->wiki->addToken(
+            $this->rule,
+            array('text' => $this->wiki->delim)
+        );
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Embed.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Embed.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Embed.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,106 @@
+<?php
+
+/**
+* 
+* Embeds the results of a PHP script at render-time.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Embed.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Embeds the results of a PHP script at render-time.
+* 
+* This class implements a Text_Wiki_Parse to embed the contents of a URL
+* inside the page at render-time.  Typically used to get script output.
+* This differs from the 'include' rule, which incorporates results at
+* parse-time; 'embed' output does not get parsed by Text_Wiki, while
+* 'include' ouput does.
+*
+* This rule is inherently not secure; it allows cross-site scripting to
+* occur if the embedded output has <script> or other similar tags.  Be
+* careful.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Embed extends Text_Wiki_Parse {
+    
+    var $conf = array(
+        'base' => '/path/to/scripts/'
+    );
+    
+    var $file = null;
+
+    var $output = null;
+
+    var $vars = null;
+
+
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = '/(\[\[embed )(.+?)( .+?)?(\]\])/i';
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'text' => The full matched text, not including the <code></code> tags.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {    
+        // save the file location
+        $this->file = $this->getConf('base', './') . $matches[2];
+        
+        // extract attribs as variables in the local space
+        $this->vars = $this->getAttrs($matches[3]);
+        unset($this->vars['this']);
+        extract($this->vars);
+        
+        // run the script
+        ob_start();
+        include($this->file);
+        $this->output = ob_get_contents();
+        ob_end_clean();
+        
+        // done, place the script output directly in the source
+        return $this->wiki->addToken(
+            $this->rule,
+            array('text' => $this->output)
+        );
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Emphasis.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Emphasis.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Emphasis.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,85 @@
+<?php
+
+/**
+* 
+* Parses for emphasized text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Emphasis.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for emphasized text.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked for
+* emphasis (italics) as defined by text surrounded by two single-quotes.
+* On parsing, the text itself is left in place, but the starting and ending
+* instances of two single-quotes are replaced with tokens.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_emphasis extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/\/\/(.*?)\/\//";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * emphasized text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the text to be
+    * emphasized.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule, array('type' => 'start')
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, array('type' => 'end')
+        );
+        
+        return $start . $matches[1] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Freelink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Freelink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Freelink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,129 @@
+<?php
+
+/**
+* 
+* Parses for wiki freelink text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Freelink.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for freelinked page links.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked as a
+* wiki freelink, and automatically create a link to that page.
+* 
+* A freelink is any page name not conforming to the standard
+* StudlyCapsStyle for a wiki page name.  For example, a page normally
+* named MyHomePage can be renamed and referred to as ((My Home Page)) --
+* note the spaces in the page name.  You can also make a "nice-looking"
+* link without renaming the target page; e.g., ((MyHomePage|My Home
+* Page)).  Finally, you can use named anchors on the target page:
+* ((MyHomePage|My Home Page#Section1)).
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * Constructor.  We override the Text_Wiki_Parse constructor so we can
+    * explicitly comment each part of the $regex property.
+    * 
+    * @access public
+    * 
+    * @param object &$obj The calling "parent" Text_Wiki object.
+    * 
+    */
+    
+    function Text_Wiki_Parse_Freelink(&$obj)
+    {
+        parent::Text_Wiki_Parse($obj);
+        
+        $this->regex =
+            '/' .                                                   // START regex
+            "\\(\\(" .                                               // double open-parens
+            "(" .                                                   // START freelink page patter
+            "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character
+            ")" .                                                   // END  freelink page pattern
+            "(" .                                                   // START display-name
+            "\|" .                                                   // a pipe to start the display name
+            "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character
+            ")?" .                                                   // END display-name pattern 0 or 1
+            "(" .                                                   // START pattern for named anchors
+            "\#" .                                                   // a hash mark
+            "[A-Za-z]" .                                           // 1 alpha
+            "[-A-Za-z0-9_:.]*" .                                   // 0 or more alpha, digit, underscore
+            ")?" .                                                   // END named anchors pattern 0 or 1
+            "()\\)\\)" .                                           // double close-parens
+            '/';                                                   // END regex
+    }
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'page' => the wiki page name (e.g., HomePage).
+    * 
+    * 'text' => alternative text to be displayed in place of the wiki
+    * page name.
+    * 
+    * 'anchor' => a named anchor on the target wiki page
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token to be used as a placeholder in
+    * the source text, plus any text priot to the match.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // use nice variable names
+        $page = $matches[1];
+        $text = $matches[2];
+        
+        // get rid of the leading # from the anchor, if any
+        $anchor = substr($matches[3], 1);
+        
+        // is the page given a new text appearance?
+        if (trim($text) == '') {
+            // no
+            $text = $page;
+        } else {
+            // yes, strip the leading | character
+            $text = substr($text, 1);
+        }
+        
+        // set the options
+        $options = array(
+            'page'   => $page,
+            'text'   => $text,
+            'anchor' => $anchor
+        );
+        
+        // return a token placeholder
+        return $this->wiki->addToken($this->rule, $options);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Function.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Function.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Function.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,141 @@
+<?php
+
+/**
+* 
+* Parses for an API function documentation block.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Function.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for an API function documentation block.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
+
+    var $regex = '/^(\<function\>)\n(.+)\n(\<\/function\>)(\s|$)/Umsi';
+    
+    function process(&$matches)
+    {
+        // default options
+        $opts = array(
+            'name' => null,
+            'access' => null,
+            'return' => null,
+            'params' => array(),
+            'throws' => array()
+        );
+        
+        // split apart the markup lines and loop through them
+        $lines = explode("\n", $matches[2]);
+        foreach ($lines as $line) {
+            
+            // skip blank lines
+            if (trim($line) == '') {
+                continue;
+            }
+            
+            // find the first ':' on the line; the left part is the 
+            // type, the right part is the value. skip lines without
+            // a ':' on them.
+            $pos = strpos($line, ':');
+            if ($pos === false) {
+                continue;
+            }
+            
+            // $type is the line type: name, access, return, param, throws
+            // 012345678901234
+            // name: something
+            $type = trim(substr($line, 0, $pos));
+            $val = trim(substr($line, $pos+1));
+            
+            switch($type) {
+            
+            case 'a':
+            case 'access':
+                $opts['access'] = $val;
+                break;
+                
+            case 'n':
+            case 'name':
+                $opts['name'] = $val;
+                break;
+                
+            case 'p':
+            case 'param':
+                $tmp = explode(',', $val);
+                $k = count($tmp);
+                if ($k == 1) {
+                    $opts['params'][] = array(
+                        'type' => $tmp[0],
+                        'descr' => null,
+                        'default' => null
+                    );
+                } elseif ($k == 2) {
+                    $opts['params'][] = array(
+                        'type' => $tmp[0],
+                        'descr' => $tmp[1],
+                        'default' => null
+                    );
+                } else {
+                    $opts['params'][] = array(
+                        'type' => $tmp[0],
+                        'descr' => $tmp[1],
+                        'default' => $tmp[2]
+                    );
+                }
+                break;
+            
+            case 'r':
+            case 'return':
+            case 'returns':
+                $opts['return'] = $val;
+                break;
+            
+            case 't':
+            case 'throws':
+                $tmp = explode(',', $val);
+                $k = count($tmp);
+                if ($k == 1) {
+                    $opts['throws'][] = array(
+                        'type' => $tmp[0],
+                        'descr' => null
+                    );
+                } else {
+                    $opts['throws'][] = array(
+                        'type' => $tmp[0],
+                        'descr' => $tmp[1]
+                    );
+                }
+                break;
+        
+            default:
+                $opts[$type] = $val;
+                break;
+            
+            }
+        }
+        
+        // add the token back in place
+        return $this->wiki->addToken($this->rule, $opts) . $matches[4];
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Heading.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Heading.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Heading.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,107 @@
+<?php
+
+/**
+* 
+* Parses for heading text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Heading.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for heading text.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked to
+* be a heading element, as defined by text on a line by itself prefixed
+* with a number of plus signs (+). The heading text itself is left in
+* the source, but is prefixed and suffixed with delimited tokens marking
+* the start and end of the heading.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/^(\+{1,6}) (.*)/m';
+    
+    var $conf = array(
+        'id_prefix' => 'toc'
+    );
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * heading text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the heading text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // keep a running count for header IDs.  we use this later
+        // when constructing TOC entries, etc.
+        static $id;
+        if (! isset($id)) {
+            $id = 0;
+        }
+        
+        $prefix = htmlspecialchars($this->getConf('id_prefix'));
+        
+        $start = $this->wiki->addToken(
+            $this->rule, 
+            array(
+                'type' => 'start',
+                'level' => strlen($matches[1]),
+                'text' => $matches[2],
+                'id' => $prefix . $id ++
+            )
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, 
+            array(
+                'type' => 'end',
+                'level' => strlen($matches[1])
+            )
+        );
+        
+        return $start . $matches[2] . $end . "\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Horiz.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Horiz.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Horiz.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,70 @@
+<?php
+
+/**
+* 
+* Parses for horizontal ruling lines.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Horiz.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for horizontal ruling lines.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked to
+* be a horizontal rule, as defined by four dashed on their own line.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/^([-]{4,})$/m';
+    
+    
+    /**
+    * 
+    * Generates a replacement token for the matched text.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A token marking the horizontal rule.
+    *
+    */
+    
+    function process(&$matches)
+    {    
+        return $this->wiki->addToken($this->rule);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Html.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Html.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Html.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+* 
+* Parses for blocks of HTML code.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Html.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for blocks of HTML code.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked as
+* HTML to be redndred as-is.  The block start is marked by <html> on its
+* own line, and the block end is marked by </html> on its own line.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Html extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/^\<html\>\n(.+)\n\<\/html\>(\s|$)/Umsi';
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'text' => The text of the HTML to be rendered as-is.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token to be used as a placeholder in
+    * the source text, plus any text following the HTML block.
+    *
+    */
+    
+    function process(&$matches)
+    {    
+        $options = array('text' => $matches[1]);
+        return $this->wiki->addToken($this->rule, $options) . $matches[2];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Image.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Image.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Image.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,84 @@
+<?php
+
+/**
+* 
+* Parses for image placement.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Image.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for image placement.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = '/(\[\[image )(.+?)(\]\])/i';
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'src' => The image source, typically a relative path name.
+    *
+    * 'opts' => Any macro options following the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $pos = strpos($matches[2], ' ');
+        
+        if ($pos === false) {
+            $options = array(
+                'src' => $matches[2],
+                'attr' => array());
+        } else {
+            // everything after the space is attribute arguments
+            $options = array(
+                'src' => substr($matches[2], 0, $pos),
+                'attr' => $this->getAttrs(substr($matches[2], $pos+1))
+            );
+        }
+        
+        return $this->wiki->addToken($this->rule, $options);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Include.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Include.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Include.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,100 @@
+<?php
+
+/**
+* 
+* Includes the contents of another PHP script into the source text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Include.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* This class implements a Text_Wiki_Parse to include the results of a
+* script directly into the source at parse-time; thus, the output of the
+* script will be parsed by Text_Wiki.  This differs from the 'embed'
+* rule, which incorporates the results at render-time, meaning that the
+* 'embed' content is not parsed by Text_Wiki.
+*
+* DANGER!
+* 
+* This rule is inherently not secure; it allows cross-site scripting to
+* occur if the embedded output has <script> or other similar tags.  Be
+* careful.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
+    
+    var $conf = array(
+        'base' => '/path/to/scripts/'
+    );
+    
+    var $file = null;
+    
+    var $output = null;
+    
+    var $vars = null;
+
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = '/(\[\[include )(.+?)( .+?)?(\]\])/i';
+    
+    
+    /**
+    * 
+    * Includes the results of the script directly into the source; the output
+    * will subsequently be parsed by the remaining Text_Wiki rules.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return The results of the included script.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // save the file location
+        $this->file = $this->getConf('base', './') . $matches[2];
+
+        // extract attribs as variables in the local space
+        $this->vars = $this->getAttrs($matches[3]);
+        unset($this->vars['this']);
+        extract($this->vars);
+
+        // run the script
+        ob_start();
+        include($this->file);
+        $this->output = ob_get_contents();
+        ob_end_clean();
+    
+        // done, place the script output directly in the source
+        return $this->output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Interwiki.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Interwiki.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Interwiki.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,138 @@
+<?php
+
+/**
+* 
+* Parses for interwiki links.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Interwiki.php,v 1.4 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for interwiki links.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked as
+* an Interwiki link.  See the regex for a detailed explanation of the
+* text matching procedure; e.g., "InterWikiName:PageName".
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
+    
+    // double-colons wont trip up now
+    var $regex = '([A-Za-z0-9_]+):((?!:)[A-Za-z0-9_\/=&~#.:;-]+)';
+    
+    
+    /**
+    * 
+    * Parser.  We override the standard parser so we can
+    * find both described interwiki links and standalone links.
+    * 
+    * @access public
+    * 
+    * @return void
+    * 
+    */
+    
+    function parse()
+    {
+        // described interwiki links
+        $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'processDescr'),
+            $this->wiki->source
+        );
+        
+        // standalone interwiki links
+        $tmp_regex = '/' . $this->regex . '/';
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'process'),
+            $this->wiki->source
+        );
+       
+    }
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched standalone interwiki text.
+    * Token options are:
+    * 
+    * 'site' => The key name for the Text_Wiki interwiki array map,
+    * usually the name of the interwiki site.
+    * 
+    * 'page' => The page on the target interwiki to link to.
+    * 
+    * 'text' => The text to display as the link.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token to be used as a placeholder in
+    * the source text, plus any text priot to the match.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $options = array(
+            'site' => $matches[1],
+            'page' => $matches[2],
+            'text' => $matches[0]
+        );
+        
+        return $this->wiki->addToken($this->rule, $options);
+    }
+    
+    
+    /**
+    * 
+    * Generates a replacement for described interwiki links. Token
+    * options are:
+    * 
+    * 'site' => The key name for the Text_Wiki interwiki array map,
+    * usually the name of the interwiki site.
+    * 
+    * 'page' => The page on the target interwiki to link to.
+    * 
+    * 'text' => The text to display as the link.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token to be used as a placeholder in
+    * the source text, plus any text priot to the match.
+    *
+    */
+    
+    function processDescr(&$matches)
+    {
+        $options = array(
+            'site' => $matches[1],
+            'page' => $matches[2],
+            'text' => $matches[3]
+        );
+        
+        return $this->wiki->addToken($this->rule, $options);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Italic.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Italic.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Italic.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,85 @@
+<?php
+
+/**
+* 
+* Parses for italic text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Italic.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for italic text.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked for
+* emphasis (italics) as defined by text surrounded by two single-quotes.
+* On parsing, the text itself is left in place, but the starting and ending
+* instances of two single-quotes are replaced with tokens.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Italic extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/''(()|[^'].*)''/U";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * emphasized text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the text to be
+    * emphasized.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule, array('type' => 'start')
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, array('type' => 'end')
+        );
+        
+        return $start . $matches[1] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/List.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/List.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/List.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,248 @@
+<?php
+
+/**
+* 
+* Parses for bulleted and numbered lists.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: List.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for bulleted and numbered lists.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked as
+* a bulleted or numbered list.  In short, if a line starts with '* ' then
+* it is a bullet list item; if a line starts with '# ' then it is a 
+* number list item.  Spaces in front of the * or # indicate an indented
+* sub-list.  The list items must be on sequential lines, and may be 
+* separated by blank lines to improve readability.  Using a non-* non-#
+* non-whitespace character at the beginning of a line ends the list.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_List extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/\n((\*|#) .*\n)(?! {0,}(\* |# |\n))/Us';
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' =>
+    *     'bullet_start' : the start of a bullet list
+    *     'bullet_end'   : the end of a bullet list
+    *     'number_start' : the start of a number list
+    *     'number_end'   : the end of a number list
+    *     'item_start'   : the start of item text (bullet or number)
+    *     'item_end'     : the end of item text (bullet or number)
+    *     'unknown'      : unknown type of list or item
+    *
+    * 'level' => the indent level (0 for the first level, 1 for the
+    * second, etc)
+    *
+    * 'count' => the list item number at this level. not needed for
+    * xhtml, but very useful for PDF and RTF.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A series of text and delimited tokens marking the different
+    * list text and list elements.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // the replacement text we will return
+        $return = '';
+        
+        // the list of post-processing matches
+        $list = array();
+        
+        // a stack of list-start and list-end types; we keep this
+        // so that we know what kind of list we're working with
+        // (bullet or number) and what indent level we're at.
+        $stack = array();
+        
+        // the item count is the number of list items for any
+        // given list-type on the stack
+        $itemcount = array();
+        
+        // have we processed the very first list item?
+        $pastFirst = false;
+        
+        // populate $list with this set of matches. $matches[1] is the
+        // text matched as a list set by parse().
+        preg_match_all(
+            '=^( {0,})(\*|#) (.*)$=Ums',
+            $matches[1],
+            $list,
+            PREG_SET_ORDER
+        );
+        
+        // loop through each list-item element.
+        foreach ($list as $key => $val) {
+            
+            // $val[0] is the full matched list-item line
+            // $val[1] is the number of initial spaces (indent level)
+            // $val[2] is the list item type (* or #)
+            // $val[3] is the list item text
+            
+            // how many levels are we indented? (1 means the "root"
+            // list level, no indenting.)
+            $level = strlen($val[1]) + 1;
+            
+            // get the list item type
+            if ($val[2] == '*') {
+                $type = 'bullet';
+            } elseif ($val[2] == '#') {
+                $type = 'number';
+            } else {
+                $type = 'unknown';
+            }
+            
+            // get the text of the list item
+            $text = $val[3];
+            
+            // add a level to the list?
+            if ($level > count($stack)) {
+                
+                // the current indent level is greater than the
+                // number of stack elements, so we must be starting
+                // a new list.  push the new list type onto the
+                // stack...
+                array_push($stack, $type);
+                
+                // ...and add a list-start token to the return.
+                $return .= $this->wiki->addToken(
+                    $this->rule, 
+                    array(
+                        'type' => $type . '_list_start',
+                        'level' => $level - 1
+                    )
+                );
+            }
+            
+            // remove a level from the list?
+            while (count($stack) > $level) {
+                
+                // so we don't keep counting the stack, we set up a temp
+                // var for the count.  -1 becuase we're going to pop the
+                // stack in the next command.  $tmp will then equal the
+                // current level of indent.
+                $tmp = count($stack) - 1;
+                
+                // as long as the stack count is greater than the
+                // current indent level, we need to end list types. 
+                // continue adding end-list tokens until the stack count
+                // and the indent level are the same.
+                $return .= $this->wiki->addToken(
+                    $this->rule, 
+                    array (
+                        'type' => array_pop($stack) . '_list_end',
+                        'level' => $tmp
+                    )
+                );
+                
+                // reset to the current (previous) list type so that
+                // the new list item matches the proper list type.
+                $type = $stack[$tmp - 1];
+                
+                // reset the item count for the popped indent level
+                unset($itemcount[$tmp + 1]);
+            }
+            
+            // add to the item count for this list (taking into account
+            // which level we are at).
+            if (! isset($itemcount[$level])) {
+                // first count
+                $itemcount[$level] = 0;
+            } else {
+                // increment count
+                $itemcount[$level]++;
+            }
+            
+            // is this the very first item in the list?
+            if (! $pastFirst) {
+                $first = true;
+                $pastFirst = true;
+            } else {
+                $first = false;
+            }
+            
+            // create a list-item starting token.
+            $start = $this->wiki->addToken(
+                $this->rule, 
+                array(
+                    'type' => $type . '_item_start',
+                    'level' => $level,
+                    'count' => $itemcount[$level],
+                    'first' => $first
+                )
+            );
+            
+            // create a list-item ending token.
+            $end = $this->wiki->addToken(
+                $this->rule, 
+                array(
+                    'type' => $type . '_item_end',
+                    'level' => $level,
+                    'count' => $itemcount[$level]
+                )
+            );
+            
+            // add the starting token, list-item text, and ending token
+            // to the return.
+            $return .= $start . $val[3] . $end;
+        }
+        
+        // the last list-item may have been indented.  go through the
+        // list-type stack and create end-list tokens until the stack
+        // is empty.
+        while (count($stack) > 0) {
+            $return .= $this->wiki->addToken(
+                $this->rule, 
+                array (
+                    'type' => array_pop($stack) . '_list_end',
+                    'level' => count($stack)
+                )
+            );
+        }
+        
+        // we're done!  send back the replacement text.
+        return "\n" . $return . "\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Newline.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Newline.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Newline.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+* 
+* Parses for implied line breaks indicated by newlines.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Newline.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for implied line breaks indicated by newlines.
+* 
+* This class implements a Text_Wiki_Parse to mark implied line breaks in the
+* source text, usually a single carriage return in the middle of a paragraph
+* or block-quoted text.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/([^\n])\n([^\n])/m';
+    
+    
+    /**
+    * 
+    * Generates a replacement token for the matched text.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A delimited token to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {    
+        return $matches[1] .
+            $this->wiki->addToken($this->rule) .
+            $matches[2];
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Paragraph.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Paragraph.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Paragraph.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,146 @@
+<?php
+
+/**
+* 
+* Parses for paragraph blocks.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Paragraph.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for paragraph blocks.
+* 
+* This class implements a Text_Wiki rule to find sections of the source
+* text that are paragraphs.  A para is any line not starting with a token
+* delimiter, followed by two newlines.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
+    
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = "/^.*?\n\n/m";
+    
+    var $conf = array(
+        'skip' => array(
+            'blockquote', // are we sure about this one?
+            'code',
+            'heading',
+            'horiz',
+            'deflist',
+            'table',
+            'list',
+            'toc'
+        )
+    );
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'start' => The starting point of the paragraph.
+    * 
+    * 'end' => The ending point of the paragraph.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $delim = $this->wiki->delim;
+        
+        // was anything there?
+        if (trim($matches[0]) == '') {
+            return '';
+        }
+        
+        // does the match start with a delimiter?
+        if (substr($matches[0], 0, 1) != $delim) { 
+            // no.
+            
+            $start = $this->wiki->addToken(
+                $this->rule, array('type' => 'start')
+            );
+            
+            $end = $this->wiki->addToken(
+                $this->rule, array('type' => 'end')
+            );
+            
+            return $start . trim($matches[0]) . $end;
+        }
+        
+        // the line starts with a delimiter.  read in the delimited
+        // token number, check the token, and see if we should
+        // skip it.
+        
+        // loop starting at the second character (we already know
+        // the first is a delimiter) until we find another
+        // delimiter; the text between them is a token key number.
+        $key = '';
+        $len = strlen($matches[0]);
+        for ($i = 1; $i < $len; $i++) {
+            $char = $matches[0]{$i};
+            if ($char == $delim) {
+                break;
+            } else {
+                $key .= $char;
+            }
+        }
+        
+        // look at the token and see if it's skippable (if we skip,
+        // it will not be marked as a paragraph)
+        $token_type = strtolower($this->wiki->tokens[$key][0]);
+        $skip = $this->getConf('skip', array());
+        
+        if (in_array($token_type, $skip)) {
+            // this type of token should not have paragraphs applied to it.
+            // return the entire matched text.
+            return $matches[0];
+        } else {
+            
+            $start = $this->wiki->addToken(
+                $this->rule, array('type' => 'start')
+            );
+            
+            $end = $this->wiki->addToken(
+                $this->rule, array('type' => 'end')
+            );
+            
+            return $start . trim($matches[0]) . $end;
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Phplookup.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Phplookup.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Phplookup.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,73 @@
+<?php
+
+/**
+* 
+* Find source text marked for lookup in the PHP online manual.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Phplookup.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Find source text marked for lookup in the PHP online manual.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Phplookup extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/\[\[php (.+?)\]\]/";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * teletype text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the teletype text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        return $this->wiki->addToken(
+            $this->rule, array('text' => $matches[1])
+        );
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Prefilter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Prefilter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Prefilter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,78 @@
+<?php
+
+/**
+* 
+* "Pre-filter" the source text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Prefilter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* "Pre-filter" the source text.
+* 
+* Convert DOS and Mac line endings to Unix, concat lines ending in a
+* backslash \ with the next line, convert tabs to 4-spaces, add newlines
+* to the top and end of the source text, compress 3 or more newlines to
+* 2 newlines.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * Simple parsing method.
+    *
+    * @access public
+    * 
+    */
+    
+    function parse()
+    {
+        // convert DOS line endings
+        $this->wiki->source = str_replace("\r\n", "\n",
+            $this->wiki->source);
+        
+        // convert Macintosh line endings
+        $this->wiki->source = str_replace("\r", "\n",
+            $this->wiki->source);
+        
+        // concat lines ending in a backslash
+        $this->wiki->source = str_replace("\\\n", "",
+            $this->wiki->source);
+        
+        // convert tabs to four-spaces
+        $this->wiki->source = str_replace("\t", "    ",
+            $this->wiki->source);
+           
+        // add extra newlines at the top and end; this
+        // seems to help many rules.
+        $this->wiki->source = "\n" . $this->wiki->source . "\n\n";
+        
+        // finally, compress all instances of 3 or more newlines
+        // down to two newlines.
+        $find = "/\n{3,}/m";
+        $replace = "\n\n";
+        $this->wiki->source = preg_replace($find, $replace,
+            $this->wiki->source);
+    }
+
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Raw.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Raw.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Raw.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,73 @@
+<?php
+
+/**
+* 
+* Parses for text marked as "raw" (i.e., to be rendered as-is).
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Raw.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for text marked as "raw" (i.e., to be rendered as-is).
+* 
+* This class implements a Text_Wiki rule to find sections of the source
+* text that are not to be processed by Text_Wiki.  These blocks of "raw"
+* text will be rendered as they were found.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Raw extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to find source text matching this
+    * rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $regex = "/``(.*)``/U";
+    
+    
+    /**
+    * 
+    * Generates a token entry for the matched text.  Token options are:
+    * 
+    * 'text' => The full matched text.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token number to be used as a placeholder in
+    * the source text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $options = array('text' => $matches[1]);
+        return $this->wiki->addToken($this->rule, $options);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Revise.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Revise.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Revise.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,145 @@
+<?php
+
+/**
+* 
+* Parses for text marked as revised (insert/delete).
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Revise.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for text marked as revised (insert/delete).
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/\@\@({*?.*}*?)\@\@/U";
+    
+    
+    /**
+    * 
+    * Config options.
+    * 
+    * @access public
+    * 
+    * @var array
+    *
+    */
+    
+    var $conf = array(
+        'delmark' => '---',
+        'insmark' => '+++'
+    );
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * inserted text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the teletype text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $output = '';
+        $src = $matches[1];
+        $delmark = $this->getConf('delmark'); // ---
+        $insmark = $this->getConf('insmark'); // +++
+        
+        // '---' must be before '+++' (if they both appear)
+        $del = strpos($src, $delmark);
+        $ins = strpos($src, $insmark);
+        
+        // if neither is found, return right away
+        if ($del === false && $ins === false) {
+            return $matches[0];
+        }
+        
+        // handle text to be deleted
+        if ($del !== false) {
+            
+            // move forward to the end of the deletion mark
+            $del += strlen($delmark);
+            
+            if ($ins === false) {
+                // there is no insertion text following
+                $text = substr($src, $del);
+            } else {
+                // there is insertion text following,
+                // mitigate the length
+                $text = substr($src, $del, $ins - $del);
+            }
+            
+            $output .= $this->wiki->addToken(
+                $this->rule, array('type' => 'del_start')
+            );
+            
+            $output .= $text;
+            
+            $output .= $this->wiki->addToken(
+                $this->rule, array('type' => 'del_end')
+            );
+        }
+        
+        // handle text to be inserted
+        if ($ins !== false) {
+            
+            // move forward to the end of the insert mark
+            $ins += strlen($insmark);
+            $text = substr($src, $ins);
+            
+            $output .= $this->wiki->addToken(
+                $this->rule, array('type' => 'ins_start')
+            );
+            
+            $output .= $text;
+            
+            $output .= $this->wiki->addToken(
+                $this->rule, array('type' => 'ins_end')
+            );
+        }
+        
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Strong.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Strong.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Strong.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,86 @@
+<?php
+
+/**
+* 
+* Parses for strongly-emphasized text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Strong.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+
+/**
+* 
+* Parses for strongly-emphasized text.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked for
+* strong emphasis (bold) as defined by text surrounded by three
+* single-quotes. On parsing, the text itself is left in place, but the
+* starting and ending instances of three single-quotes are replaced with
+* tokens.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Strong extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex =  "/\*\*(.*?)\*\*/";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * emphasized text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A pair of delimited tokens to be used as a placeholder in
+    * the source text surrounding the text to be emphasized.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule, array('type' => 'start')
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, array('type' => 'end')
+        );
+        
+        return $start . $matches[1] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Superscript.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Superscript.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Superscript.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,79 @@
+<?php
+
+/**
+* 
+* Parses for superscripted text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Superscript.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for superscripted text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex =  "/\^\^(()|.*)\^\^/U";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.  Token options are:
+    * 
+    * 'type' => ['start'|'end'] The starting or ending point of the
+    * emphasized text.  The text itself is left in the source.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A pair of delimited tokens to be used as a placeholder in
+    * the source text surrounding the text to be emphasized.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule, array('type' => 'start')
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, array('type' => 'end')
+        );
+        
+        return $start . $matches[1] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Table.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Table.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Table.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,226 @@
+<?php
+
+/**
+* 
+* Parses for table markup.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Table.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parses for table markup.
+* 
+* This class implements a Text_Wiki_Parse to find source text marked as a
+* set of table rows, where a line start and ends with double-pipes (||)
+* and uses double-pipes to separate table cells.  The rows must be on
+* sequential lines (no blank lines between them) -- a blank line
+* indicates the beginning of a new table.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = '/\n((\|\|).*)(\n)(?!(\|\|))/Us';
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.
+    * 
+    * Token options are:
+    * 
+    * 'type' =>
+    *     'table_start' : the start of a bullet list
+    *     'table_end'   : the end of a bullet list
+    *     'row_start' : the start of a number list
+    *     'row_end'   : the end of a number list
+    *     'cell_start'   : the start of item text (bullet or number)
+    *     'cell_end'     : the end of item text (bullet or number)
+    * 
+    * 'cols' => the number of columns in the table (for 'table_start')
+    * 
+    * 'rows' => the number of rows in the table (for 'table_start')
+    * 
+    * 'span' => column span (for 'cell_start')
+    * 
+    * 'attr' => column attribute flag (for 'cell_start')
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A series of text and delimited tokens marking the different
+    * table elements and cell text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // our eventual return value
+        $return = '';
+        
+        // the number of columns in the table
+        $num_cols = 0;
+        
+        // the number of rows in the table
+        $num_rows = 0;
+        
+        // rows are separated by newlines in the matched text
+        $rows = explode("\n", $matches[1]);
+        
+        // loop through each row
+        foreach ($rows as $row) {
+            
+            // increase the row count
+            $num_rows ++;
+            
+            // start a new row
+            $return .= $this->wiki->addToken(
+                $this->rule,
+                array('type' => 'row_start')
+            );
+            
+            // cells are separated by double-pipes
+            $cell = explode("||", $row);
+            
+            // get the number of cells (columns) in this row
+            $last = count($cell) - 1;
+            
+            // is this more than the current column count?
+            // (we decrease by 1 because we never use cell zero)
+            if ($last - 1 > $num_cols) {
+                // increase the column count
+                $num_cols = $last - 1;
+            }
+            
+            // by default, cells span only one column (their own)
+            $span = 1;
+            
+            // ignore cell zero, and ignore the "last" cell; cell zero
+            // is before the first double-pipe, and the "last" cell is
+            // after the last double-pipe. both are always empty.
+            for ($i = 1; $i < $last; $i ++) {
+                
+                // if there is no content at all, then it's an instance
+                // of two sets of || next to each other, indicating a
+                // span.
+                if ($cell[$i] == '') {
+                    
+                    // add to the span and loop to the next cell
+                    $span += 1;
+                    continue;
+                    
+                } else {
+                    
+                    // this cell has content.
+                    
+                    // find any special "attr"ibute cell markers
+                    if (substr($cell[$i], 0, 2) == '> ') {
+                        // right-align
+                        $attr = 'right';
+                        $cell[$i] = substr($cell[$i], 2);
+                    } elseif (substr($cell[$i], 0, 2) == '= ') {
+                        // center-align
+                        $attr = 'center';
+                        $cell[$i] = substr($cell[$i], 2);
+                    } elseif (substr($cell[$i], 0, 2) == '< ') {
+                        // left-align
+                        $attr = 'left';
+                        $cell[$i] = substr($cell[$i], 2);
+                    } elseif (substr($cell[$i], 0, 2) == '~ ') {
+                        $attr = 'header';
+                        $cell[$i] = substr($cell[$i], 2);
+                    } else {
+                        $attr = null;
+                    }
+                    
+                    // start a new cell...
+                    $return .= $this->wiki->addToken(
+                        $this->rule, 
+                        array (
+                            'type' => 'cell_start',
+                            'attr' => $attr,
+                            'span' => $span
+                        )
+                    );
+                    
+                    // ...add the content...
+                    $return .= trim($cell[$i]);
+                    
+                    // ...and end the cell.
+                    $return .= $this->wiki->addToken(
+                        $this->rule, 
+                        array (
+                            'type' => 'cell_end',
+                            'attr' => $attr,
+                            'span' => $span
+                        )
+                    );
+                    
+                    // reset the span.
+                    $span = 1;
+                }
+                    
+            }
+            
+            // end the row
+            $return .= $this->wiki->addToken(
+                $this->rule,
+                array('type' => 'row_end')
+            );
+            
+        }
+        
+        // wrap the return value in start and end tokens 
+        $return =
+            $this->wiki->addToken(
+                $this->rule,
+                array(
+                    'type' => 'table_start',
+                    'rows' => $num_rows,
+                    'cols' => $num_cols
+                )
+            )
+            . $return .
+            $this->wiki->addToken(
+                $this->rule,
+                array(
+                    'type' => 'table_end'
+                )
+            );
+        
+        // we're done!
+        return "\n$return\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tighten.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tighten.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tighten.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,49 @@
+<?php
+
+/**
+* 
+* The rule removes all remaining newlines.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Tighten.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+
+/**
+* 
+* The rule removes all remaining newlines.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Tighten extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * Apply tightening directly to the source text.
+    *
+    * @access public
+    * 
+    */
+    
+    function parse()
+    {
+        $this->wiki->source = str_replace("\n", '',
+            $this->wiki->source);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Toc.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Toc.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Toc.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,130 @@
+<?php
+
+/**
+* 
+* Looks through parsed text and builds a table of contents.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Toc.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Looks through parsed text and builds a table of contents.
+* 
+* This class implements a Text_Wiki_Parse to find all heading tokens and
+* build a table of contents.  The [[toc]] tag gets replaced with a list
+* of all the level-2 through level-6 headings.
+*
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+
+class Text_Wiki_Parse_Toc extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text and find
+    * matches conforming to this rule.  Used by the parse() method.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/\n\[\[toc( .*)?\]\]\n/m";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text.
+    *  
+    * Token options are:
+    * 
+    * 'type' => ['list_start'|'list_end'|'item_start'|'item_end'|'target']
+    *
+    * 'level' => The heading level (1-6).
+    *
+    * 'count' => Which entry number this is in the list.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A token indicating the TOC collection point.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $count = 0;
+        
+        if (isset($matches[1])) {
+            $attr = $this->getAttrs(trim($matches[1]));
+        } else {
+            $attr = array();
+        }
+        
+        $output = $this->wiki->addToken(
+            $this->rule,
+            array(
+                'type' => 'list_start',
+                'level' => 0,
+                'attr' => $attr
+            )
+        );
+        
+        foreach ($this->wiki->getTokens('Heading') as $key => $val) {
+            
+            if ($val[1]['type'] != 'start') {
+                continue;
+            }
+            
+            $options = array(
+                'type'  => 'item_start',
+                'id'    => $val[1]['id'],
+                'level' => $val[1]['level'],
+                'count' => $count ++
+            );
+            
+            $output .= $this->wiki->addToken($this->rule, $options);
+            
+            $output .= $val[1]['text'];
+            
+            $output .= $this->wiki->addToken(
+                $this->rule,
+                array(
+                    'type' => 'item_end',
+                    'level' => $val[1]['level']
+                )
+            );
+        }
+        
+        $output .= $this->wiki->addToken(
+            $this->rule, array(
+                'type' => 'list_end',
+                'level' => 0
+            )
+        );
+        
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tt.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tt.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Tt.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,84 @@
+<?php
+
+/**
+* 
+* Find source text marked for teletype (monospace).
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Tt.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Find source text marked for teletype (monospace).
+* 
+* Defined by text surrounded by two curly braces. On parsing, the text
+* itself is left in place, but the starting and ending instances of
+* curly braces are replaced with tokens.
+* 
+* Token options are:
+* 
+* 'type' => ['start'|'end'] The starting or ending point of the
+* teletype text.  The text itself is left in the source.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Tt extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * The regular expression used to parse the source text.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = "/{{({*?.*}*?)}}/U";
+    
+    
+    /**
+    * 
+    * Generates a replacement for the matched text. 
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return string A pair of delimited tokens to be used as a
+    * placeholder in the source text surrounding the teletype text.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        $start = $this->wiki->addToken(
+            $this->rule, array('type' => 'start')
+        );
+        
+        $end = $this->wiki->addToken(
+            $this->rule, array('type' => 'end')
+        );
+        
+        return $start . $matches[1] . $end;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Url.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Url.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Url.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,281 @@
+<?php
+
+/**
+* 
+* Parse for URLS in the source text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Url.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parse for URLS in the source text.
+* 
+* Various URL markings are supported: inline (the URL by itself),
+* numbered or footnote reference (where the URL is enclosed in square
+* brackets), and named reference (where the URL is enclosed in square
+* brackets and has a name included inside the brackets).  E.g.:
+*
+* inline    -- http://example.com
+* numbered  -- [http://example.com]
+* described -- [http://example.com Example Description]
+*
+* When rendering a URL token, this will convert URLs pointing to a .gif,
+* .jpg, or .png image into an inline <img /> tag (for the 'xhtml'
+* format).
+*
+* Token options are:
+* 
+* 'type' => ['inline'|'footnote'|'descr'] the type of URL
+* 
+* 'href' => the URL link href portion
+* 
+* 'text' => the displayed text of the URL link
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * Keeps a running count of numbered-reference URLs.
+    * 
+    * @access public
+    * 
+    * @var int
+    * 
+    */
+    
+    var $footnoteCount = 0;
+    
+    
+    /**
+    * 
+    * URL schemes recognized by this rule.
+    * 
+    * @access public
+    * 
+    * @var array
+    * 
+    */
+    
+    var $conf = array(
+        'schemes' => array(
+            'http://',
+            'https://',
+            'ftp://',
+            'gopher://',
+            'news://',
+            'mailto:'
+        )
+    );
+    
+    
+    /**
+    * 
+    * Constructor.
+    * 
+    * We override the constructor so we can comment the regex nicely.
+    * 
+    * @access public
+    * 
+    */
+    
+    function Text_Wiki_Parse_Url(&$obj)
+    {
+        parent::Text_Wiki_Parse($obj);
+        
+        // convert the list of recognized schemes to a regex-safe string,
+        // where the pattern delim is a slash
+        $tmp = array();
+        $list = $this->getConf('schemes', array());
+        foreach ($list as $val) {
+            $tmp[] = preg_quote($val, '/');
+        }
+        $schemes = implode('|', $tmp);
+        
+        // build the regex
+        $this->regex =
+            "($schemes)" . // allowed schemes
+            "(" . // start pattern
+            "[^ \\/\"\'{$this->wiki->delim}]*\\/" . // no spaces, backslashes, slashes, double-quotes, single quotes, or delimiters;
+            ")*" . // end pattern
+            "[^ \\t\\n\\/\"\'{$this->wiki->delim}]*" .
+            "[A-Za-z0-9\\/?=&~_]";
+    }
+    
+    
+    /**
+    * 
+    * Find three different kinds of URLs in the source text.
+    *
+    * @access public
+    * 
+    */
+    
+    function parse()
+    {
+        // -------------------------------------------------------------
+        // 
+        // Described-reference (named) URLs.
+        // 
+        
+        // the regular expression for this kind of URL
+        $tmp_regex = '/\[(' . $this->regex . ') ([^\]]+)\]/';
+        
+        // use a custom callback processing method to generate
+        // the replacement text for matches.
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'processDescr'),
+            $this->wiki->source
+        );
+        
+        
+        // -------------------------------------------------------------
+        // 
+        // Numbered-reference (footnote-style) URLs.
+        // 
+        
+        // the regular expression for this kind of URL
+        $tmp_regex = '/\[(' . $this->regex . ')\]/U';
+        
+        // use a custom callback processing method to generate
+        // the replacement text for matches.
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'processFootnote'),
+            $this->wiki->source
+        );
+        
+        
+        // -------------------------------------------------------------
+        // 
+        // Normal inline URLs.
+        // 
+        
+        // the regular expression for this kind of URL
+        
+        $tmp_regex = '/(^|[^A-Za-z])(' . $this->regex . ')(.*?)/';
+        
+        // use the standard callback for inline URLs
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'process'),
+            $this->wiki->source
+        );
+    }
+    
+    
+    /**
+    * 
+    * Process inline URLs.
+    * 
+    * @param array &$matches
+    * 
+    * @param array $matches An array of matches from the parse() method
+    * as generated by preg_replace_callback.  $matches[0] is the full
+    * matched string, $matches[1] is the first matched pattern,
+    * $matches[2] is the second matched pattern, and so on.
+    * 
+    * @return string The processed text replacement.
+    * 
+    */ 
+    
+    function process(&$matches)
+    {
+        // set options
+        $options = array(
+            'type' => 'inline',
+            'href' => $matches[2],
+            'text' => $matches[2]
+        );
+        
+        // tokenize
+        return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[5];
+    }
+    
+    
+    /**
+    * 
+    * Process numbered (footnote) URLs.
+    * 
+    * Token options are:
+    * @param array &$matches
+    * 
+    * @param array $matches An array of matches from the parse() method
+    * as generated by preg_replace_callback.  $matches[0] is the full
+    * matched string, $matches[1] is the first matched pattern,
+    * $matches[2] is the second matched pattern, and so on.
+    * 
+    * @return string The processed text replacement.
+    * 
+    */ 
+    
+    function processFootnote(&$matches)
+    {
+        // keep a running count for footnotes 
+        $this->footnoteCount++;
+        
+        // set options
+        $options = array(
+            'type' => 'footnote',
+            'href' => $matches[1],
+            'text' => $this->footnoteCount
+        );
+        
+        // tokenize
+        return $this->wiki->addToken($this->rule, $options);
+    }
+    
+    
+    /**
+    * 
+    * Process described-reference (named-reference) URLs.
+    * 
+    * Token options are:
+    *     'type' => ['inline'|'footnote'|'descr'] the type of URL
+    *     'href' => the URL link href portion
+    *     'text' => the displayed text of the URL link
+    * 
+    * @param array &$matches
+    * 
+    * @param array $matches An array of matches from the parse() method
+    * as generated by preg_replace_callback.  $matches[0] is the full
+    * matched string, $matches[1] is the first matched pattern,
+    * $matches[2] is the second matched pattern, and so on.
+    * 
+    * @return string The processed text replacement.
+    * 
+    */ 
+    
+    function processDescr(&$matches)
+    {
+        // set options
+        $options = array(
+            'type' => 'descr',
+            'href' => $matches[1],
+            'text' => $matches[4]
+        );
+        
+        // tokenize
+        return $this->wiki->addToken($this->rule, $options);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Wikilink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Wikilink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse/Default/Wikilink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,197 @@
+<?php
+
+/**
+* 
+* Parse for links to wiki pages.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Wikilink.php,v 1.4 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Parse for links to wiki pages.
+*
+* Wiki page names are typically in StudlyCapsStyle made of
+* WordsSmashedTogether.
+*
+* You can also create described links to pages in this style:
+* [WikiPageName nice text link to use for display]
+*
+* The token options for this rule are:
+*
+* 'page' => the wiki page name.
+* 
+* 'text' => the displayed link text.
+* 
+* 'anchor' => a named anchor on the target wiki page.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
+    
+    var $conf = array (
+    	'ext_chars' => false
+    );
+    
+    /**
+    * 
+    * Constructor.
+    * 
+    * We override the Text_Wiki_Parse constructor so we can
+    * explicitly comment each part of the $regex property.
+    * 
+    * @access public
+    * 
+    * @param object &$obj The calling "parent" Text_Wiki object.
+    * 
+    */
+    
+    function Text_Wiki_Parse_Wikilink(&$obj)
+    {
+        parent::Text_Wiki_Parse($obj);
+        
+        if ($this->getConf('ext_chars')) {
+        	// use an extended character set; this should
+        	// allow for umlauts and so on.  taken from the
+        	// Tavi project defaults.php file.
+			$upper = "A-Z\xc0-\xde";
+			$lower = "a-z0-9\xdf-\xfe";
+			$either = "A-Za-z0-9\xc0-\xfe";
+		} else {
+			// the default character set, should be fine
+			// for most purposes.
+			$upper = "A-Z";
+			$lower = "a-z0-9";
+			$either = "A-Za-z0-9";
+		}
+		
+        // build the regular expression for finding WikiPage names.
+        $this->regex =
+            "(!?" .            // START WikiPage pattern (1)
+            "[$upper]" .       // 1 upper
+            "[$either]*" .     // 0+ alpha or digit
+            "[$lower]+" .      // 1+ lower or digit
+            "[$upper]" .       // 1 upper
+            "[$either]*" .     // 0+ or more alpha or digit
+            ")" .              // END WikiPage pattern (/1)
+            "((\#" .           // START Anchor pattern (2)(3)
+            "[$either]" .      // 1 alpha
+            "(" .              // start sub pattern (4)
+            "[-_$either:.]*" . // 0+ dash, alpha, digit, underscore, colon, dot
+            "[-_$either]" .    // 1 dash, alpha, digit, or underscore
+            ")?)?)";           // end subpatterns (/4)(/3)(/2)
+    }
+    
+    
+    /**
+    * 
+    * First parses for described links, then for standalone links.
+    * 
+    * @access public
+    * 
+    * @return void
+    * 
+    */
+    
+    function parse()
+    {
+        // described wiki links
+        $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'processDescr'),
+            $this->wiki->source
+        );
+        
+        // standalone wiki links
+        if ($this->getConf('ext_chars')) {
+			$either = "A-Za-z0-9\xc0-\xfe";
+		} else {
+			$either = "A-Za-z0-9";
+		}
+		
+        $tmp_regex = '/(^|[^$either\-_])' . $this->regex . '/';
+        $this->wiki->source = preg_replace_callback(
+            $tmp_regex,
+            array(&$this, 'process'),
+            $this->wiki->source
+        );
+    }
+    
+    
+    /**
+    * 
+    * Generate a replacement for described links.
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token to be used as a placeholder in
+    * the source text, plus any text priot to the match.
+    *
+    */
+    
+    function processDescr(&$matches)
+    {
+        // set the options
+        $options = array(
+            'page'   => $matches[1],
+            'text'   => $matches[5],
+            'anchor' => $matches[3]
+        );
+        
+        // create and return the replacement token and preceding text
+        return $this->wiki->addToken($this->rule, $options); // . $matches[7];
+    }
+    
+    
+    /**
+    * 
+    * Generate a replacement for standalone links.
+    * 
+    * 
+    * @access public
+    *
+    * @param array &$matches The array of matches from parse().
+    *
+    * @return A delimited token to be used as a placeholder in
+    * the source text, plus any text prior to the match.
+    *
+    */
+    
+    function process(&$matches)
+    {
+        // when prefixed with !, it's explicitly not a wiki link.
+        // return everything as it was.
+        if ($matches[2]{0} == '!') {
+            return $matches[1] . substr($matches[2], 1) . $matches[3];
+        }
+        
+        // set the options
+        $options = array(
+            'page' => $matches[2],
+            'text' => $matches[2] . $matches[3],
+            'anchor' => $matches[3]
+        );
+        
+        // create and return the replacement token and preceding text
+        return $matches[1] . $this->wiki->addToken($this->rule, $options);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Parse.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Parse.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Parse.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,267 @@
+<?php
+
+/**
+* 
+* Baseline rule class for extension into a "real" parser component.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+*/
+
+/**
+* 
+* Baseline rule class for extension into a "real" parser component.
+* 
+* Text_Wiki_Rule classes do not stand on their own; they are called by a
+* Text_Wiki object, typcially in the transform() method. Each rule class
+* performs three main activities: parse, process, and render.
+* 
+* The parse() method takes a regex and applies it to the whole block of
+* source text at one time. Each match is sent as $matches to the
+* process() method.
+* 
+* The process() method acts on the matched text from the source, and
+* then processes the source text is some way.  This may mean the
+* creation of a delimited token using addToken().  In every case, the
+* process() method returns the text that should replace the matched text
+* from parse().
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+*/
+
+class Text_Wiki_Parse {
+    
+    
+    /**
+    * 
+    * Configuration options for this parser rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $conf = array();
+    
+    
+    /**
+    * 
+    * Regular expression to find matching text for this rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    * @see parse()
+    * 
+    */
+    
+    var $regex = null;
+    
+    
+    /**
+    * 
+    * The name of this rule for new token array elements.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $rule = null;
+    
+    
+    /**
+    * 
+    * A reference to the calling Text_Wiki object.
+    * 
+    * This is needed so that each rule has access to the same source
+    * text, token set, URLs, interwiki maps, page names, etc.
+    * 
+    * @access public
+    * 
+    * @var object
+    */
+    
+    var $wiki = null;
+    
+    
+    /**
+    * 
+    * Constructor for this parser rule.
+    * 
+    * @access public
+    * 
+    * @param object &$obj The calling "parent" Text_Wiki object.
+    * 
+    */
+    
+    function Text_Wiki_Parse(&$obj)
+    {
+        // set the reference to the calling Text_Wiki object;
+        // this allows us access to the shared source text, token
+        // array, etc.
+        $this->wiki =& $obj;
+        
+        // set the name of this rule; generally used when adding
+        // to the tokens array. strip off the Text_Wiki_Parse_ portion.
+        // text_wiki_parse_
+        // 0123456789012345
+        $tmp = substr(get_class($this), 16);
+        $this->rule = ucwords(strtolower($tmp));
+        
+        // override config options for the rule if specified
+        if (isset($this->wiki->parseConf[$this->rule]) &&
+            is_array($this->wiki->parseConf[$this->rule])) {
+            
+            $this->conf = array_merge(
+                $this->conf,
+                $this->wiki->parseConf[$this->rule]
+            );
+            
+        }
+    }
+    
+    
+    /**
+    * 
+    * Abstrct method to parse source text for matches.
+    *
+    * Applies the rule's regular expression to the source text, passes
+    * every match to the process() method, and replaces the matched text
+    * with the results of the processing.
+    *
+    * @access public
+    * 
+    * @see Text_Wiki_Parse::process()
+    * 
+    */
+    
+    function parse()
+    {
+        $this->wiki->source = preg_replace_callback(
+            $this->regex,
+            array(&$this, 'process'),
+            $this->wiki->source
+        );
+    }
+    
+    
+    /**
+    * 
+    * Abstract method to generate replacements for matched text.
+    * 
+    * @access public
+    * 
+    * @param array $matches An array of matches from the parse() method
+    * as generated by preg_replace_callback.  $matches[0] is the full
+    * matched string, $matches[1] is the first matched pattern,
+    * $matches[2] is the second matched pattern, and so on.
+    * 
+    * @return string The processed text replacement; defaults to the
+    * full matched string (i.e., no changes to the text).
+    * 
+    * @see Text_Wiki_Parse::parse()
+    * 
+    */
+    
+    function process(&$matches)
+    {
+        return $matches[0];
+    }
+    
+    
+    /**
+    * 
+    * Simple method to safely get configuration key values.
+    * 
+    * @access public
+    * 
+    * @param string $key The configuration key.
+    * 
+    * @param mixed $default If the key does not exist, return this value
+    * instead.
+    * 
+    * @return mixed The configuration key value (if it exists) or the
+    * default value (if not).
+    * 
+    */
+    
+    function getConf($key, $default = null)
+    {
+        if (isset($this->conf[$key])) {
+            return $this->conf[$key];
+        } else {
+            return $default;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Extract 'attribute="value"' portions of wiki markup.
+    *
+    * This kind of markup is typically used only in macros, but is useful
+    * anywhere.
+    * 
+    * The syntax is pretty strict; there can be no spaces between the
+    * option name, the equals, and the first double-quote; the value
+    * must be surrounded by double-quotes.  You can escape characters in
+    * the value with a backslash, and the backslash will be stripped for
+    * you.
+    * 
+    * @access public
+    * 
+    * @param string $text The "attributes" portion of markup.
+    * 
+    * @return array An associative array of key-value pairs where the
+    * key is the option name and the value is the option value.
+    * 
+    */
+    
+    function getAttrs($text)
+    {
+        // find the =" sections;
+        $tmp = explode('="', trim($text));
+        
+        // basic setup
+        $k = count($tmp) - 1;
+        $attrs = array();
+        $key = null;
+        
+        // loop through the sections
+        foreach ($tmp as $i => $val) {
+            
+            // first element is always the first key
+            if ($i == 0) {
+                $key = trim($val);
+                continue;
+            }
+            
+            // find the last double-quote in the value.
+            // the part to the left is the value for the last key,
+            // the part to the right is the next key name
+            $pos = strrpos($val, '"');
+            $attrs[$key] = stripslashes(substr($val, 0, $pos));
+            $key = trim(substr($val, $pos+1));
+            
+        }
+        
+        return $attrs;
+        
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Anchor.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Anchor.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Anchor.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,33 @@
+<?php
+
+/**
+* 
+* This class renders an anchor target name in LaTeX.
+*
+* $Id: Anchor.php,v 1.2 2004/09/25 19:05:13 pmjones Exp $
+* 
+* @author Jeremy Cowgar <jeremy at cowgar.com>
+*
+* @package Text_Wiki
+*
+*/
+
+class Text_Wiki_Render_Latex_Anchor extends Text_Wiki_Render {
+    
+    function token($options)
+    {
+        extract($options); // $type, $name
+        
+        if ($type == 'start') {
+            //return sprintf('<a id="%s">',$name);
+            return '';
+        }
+        
+        if ($type == 'end') {
+            //return '</a>';
+            return '';
+        }
+    }
+}
+
+?>

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Blockquote.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Blockquote.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Blockquote.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,36 @@
+<?php
+
+class Text_Wiki_Render_Latex_Blockquote extends Text_Wiki_Render {
+    
+    var $conf = array('css' => null);
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $type = $options['type'];
+        $level = $options['level'];
+    
+        // starting
+        if ($type == 'start') {
+            return "\\begin{quote}\n";
+        }
+        
+        // ending
+        if ($type == 'end') {
+            return "\\end{quote}\n\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Bold.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Bold.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Bold.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,4 @@
+<?php
+
+class Text_Wiki_Render_Latex_Bold extends Text_Wiki_Render_Latex_Strong {}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Break.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Break.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Break.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Latex_Break extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "\\newline\n";
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Center.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Center.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Center.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,33 @@
+<?php
+
+class Text_Wiki_Render_Latex_Center extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return 'Center: NI';
+        
+        if ($options['type'] == 'start') {
+            //return "\n<center>\n";
+            return '<div style="text-align: center;">';
+        }
+        
+        if ($options['type'] == 'end') {
+            //return "</center>\n";
+            return '</div>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Code.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Code.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Code.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,26 @@
+<?php
+
+class Text_Wiki_Render_Latex_Code extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $text = $options['text'];
+
+        return "\\begin{verbatim}\n$text\n\\end{verbatim}\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Colortext.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Colortext.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Colortext.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,58 @@
+<?php
+
+class Text_Wiki_Render_Latex_Colortext extends Text_Wiki_Render {
+    
+    var $colors = array(
+        'aqua',
+        'black',
+        'blue',
+        'fuchsia',
+        'gray',
+        'green',
+        'lime',
+        'maroon',
+        'navy',
+        'olive',
+        'purple',
+        'red',
+        'silver',
+        'teal',
+        'white',
+        'yellow'
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return 'Colortext: NI';
+        
+        $type = $options['type'];
+        $color = $options['color'];
+        
+        if (! in_array($color, $this->colors)) {
+            $color = '#' . $color;
+        }
+        
+        if ($type == 'start') {
+            return "<span style=\"color: $color;\">";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</span>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Deflist.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Deflist.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Deflist.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,53 @@
+<?php
+
+class Text_Wiki_Render_Latex_Deflist extends Text_Wiki_Render {
+
+    var $conf = array(
+                      'css_dl' => null,
+                      'css_dt' => null,
+                      'css_dd' => null
+                      );
+
+    /**
+     *
+     * Renders a token into text matching the requested format.
+     *
+     * @access public
+     *
+     * @param array $options The "options" portion of the token (second
+     * element).
+     *
+     * @return string The text rendered from the token options.
+     *
+     */
+
+    function token($options)
+    {
+        $type = $options['type'];
+        switch ($type)
+            {
+            case 'list_start':
+                return "\\begin{description}\n";
+
+            case 'list_end':
+                return "\\end{description}\n\n";
+
+            case 'term_start':
+                return '\item[';
+
+            case 'term_end':
+                return '] ';
+
+            case 'narr_start':
+                return '{';
+
+            case 'narr_end':
+                return "}\n";
+
+            default:
+                return '';
+
+            }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Delimiter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Delimiter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Delimiter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,25 @@
+<?php
+
+class Text_Wiki_Render_Latex_Delimiter extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // TODO: Is this where I can do some LaTeX escaping for items
+        // such as $ { } _ ?
+        return "Delimiter: ".$options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Embed.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Embed.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Embed.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Latex_Embed extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "Embed: ".$options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Emphasis.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Emphasis.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Emphasis.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,29 @@
+<?php
+
+class Text_Wiki_Render_Latex_Emphasis extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            return '\textsl{';
+        }
+        
+        if ($options['type'] == 'end') {
+            return '}';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Freelink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Freelink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Freelink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,34 @@
+<?php
+
+class Text_Wiki_Render_Latex_Freelink extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'pages' => array(),
+        'view_url' => 'http://example.com/index.php?page=%s',
+        'new_url'  => 'http://example.com/new.php?page=%s',
+        'new_text' => '?'
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // get nice variable names (page, text, anchor)
+        extract($options);
+        
+        return "$text\\footnote\{$anchor} ";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Function.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Function.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Function.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Latex_Function extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "Function: NI";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Heading.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Heading.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Heading.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,33 @@
+<?php
+
+class Text_Wiki_Render_Latex_Heading extends Text_Wiki_Render {
+
+    function token($options)
+    {
+        // get nice variable names (type, level)
+        extract($options);
+
+        if ($type == 'start') {
+            switch ($level)
+                {
+                case '1':
+                    return '\part{';
+                case '2':
+                    return '\section{';
+                case '3':
+                    return '\subsection{';
+                case '4':
+                    return '\subsubsection{';
+                case '5':
+                    return '\paragraph{';
+                case '6':
+                    return '\subparagraph{';
+                }
+        }
+        
+        if ($type == 'end') {
+            return "}\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Horiz.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Horiz.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Horiz.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Latex_Horiz extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "\n\\noindent\\rule{\\textwidth}{1pt}\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Html.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Html.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Html.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,25 @@
+<?php
+
+class Text_Wiki_Render_Latex_Html extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        print_r($this);
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Image.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Image.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Image.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,70 @@
+<?php
+class Text_Wiki_Render_Latex_Image extends Text_Wiki_Render {
+
+    var $conf = array(
+        'base' => '/'
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return 'Image: NI';
+        
+        $src = '"' .
+            $this->getConf('base', '/') .
+            $options['src'] . '"';
+        
+        if (isset($options['attr']['link'])) {
+        
+            // this image has a link
+            if (strpos($options['attr']['link'], '://')) {
+                // it's a URL
+                $href = $options['attr']['link'];
+            } else {
+                $href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') .
+                    $options['attr']['link'];
+            }
+            
+        } else {
+            // image is not linked
+            $href = null;
+        }
+        
+        // unset these so they don't show up as attributes
+        unset($options['attr']['link']);
+        
+        $attr = '';
+        $alt = false;
+        foreach ($options['attr'] as $key => $val) {
+            if (strtolower($key) == 'alt') {
+                $alt = true;
+            }
+            $attr .= " $key=\"$val\"";
+        }
+        
+        // always add an "alt" attribute per Stephane Solliec
+        if (! $alt) {
+            $attr .= ' alt="' . basename($options['src']) . '"';
+        }
+        
+        if ($href) {
+            return "<a href=\"$href\"><img src=$src$attr/></a>";
+        } else {
+            return "<img src=$src$attr/>";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Include.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Include.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Include.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,8 @@
+<?php
+class Text_Wiki_Render_Latex_Include extends Text_Wiki_Render {    
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Interwiki.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Interwiki.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Interwiki.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,60 @@
+<?php
+
+class Text_Wiki_Render_Latex_Interwiki extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'sites' => array(
+            'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
+            'Advogato' => 'http://advogato.org/%s',
+            'Wiki'       => 'http://c2.com/cgi/wiki?%s'
+        ),
+        'target' => '_blank'
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $site = $options['site'];
+        $page = $options['page'];
+        $text = $options['text'];
+        
+        if (isset($this->conf['sites'][$site])) {
+            $href = $this->conf['sites'][$site];
+        } else {
+            return $text;
+        }
+        
+        // old form where page is at end,
+        // or new form with %s placeholder for sprintf()?
+        if (strpos($href, '%s') === false) {
+            // use the old form
+            $href = $href . $page;
+        } else {
+            // use the new form
+            $href = sprintf($href, $page);
+        }
+        
+        // allow for alternative targets
+        $target = $this->getConf('target', '');
+        
+        if ($target && trim($target) != '') {
+            $target = " target=\"$target\"";
+        }
+        
+        return "$text\\footnote\{$href}";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Italic.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Italic.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Italic.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,5 @@
+<?php
+
+class Text_Wiki_Render_Latex_Italic extends Text_Wiki_Render_Latex_Emphasis {
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/List.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/List.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/List.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,57 @@
+<?php
+
+
+class Text_Wiki_Render_Latex_List extends Text_Wiki_Render {
+    /**
+     *
+     * Renders a token into text matching the requested format.
+     *
+     * This rendering method is syntactically and semantically compliant
+     * with XHTML 1.1 in that sub-lists are part of the previous list item.
+     *
+     * @access public
+     *
+     * @param array $options The "options" portion of the token (second
+     * element).
+     *
+     * @return string The text rendered from the token options.
+     *
+     */
+
+    function token($options)
+    {
+        // make nice variables (type, level, count)
+        extract($options);
+        
+        switch ($type)
+            {
+            case 'bullet_list_start':
+                return "\\begin{itemize}\n";
+                
+            case 'bullet_list_end':
+                return "\\end{itemize}\n";
+                
+            case 'number_list_start':
+                return "\\begin{enumerate}\n";
+                
+            case 'number_list_end':
+                return "\\end{enumerate}\n";
+                
+            case 'bullet_item_start':
+            case 'number_item_start':
+                return "\\item{";
+                
+            case 'bullet_item_end':
+            case 'number_item_end':
+                return "}\n";
+                
+            default:
+                // ignore item endings and all other types.
+                // item endings are taken care of by the other types
+                // depending on their place in the list.
+                return '';
+                break;
+            }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Newline.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Newline.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Newline.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,12 @@
+<?php
+
+class Text_Wiki_Render_Latex_Newline extends Text_Wiki_Render {
+    
+    
+    function token($options)
+    {
+        return "\n";
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Paragraph.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Paragraph.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Paragraph.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,31 @@
+<?php
+
+class Text_Wiki_Render_Latex_Paragraph extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        extract($options); //type
+        
+        if ($type == 'start') {
+            return '';
+        }
+        
+        if ($type == 'end') {
+            return "\n\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Phplookup.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Phplookup.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Phplookup.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,34 @@
+<?php
+
+class Text_Wiki_Render_Latex_Phplookup extends Text_Wiki_Render {
+    
+    var $conf = array('target' => '_blank');
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return 'Phplookup: NI';
+        
+        $text = trim($options['text']);
+        
+        $target = $this->getConf('target', '');
+        if ($target) {
+            $target = " target=\"$target\"";
+        }
+        
+        return "<a$target href=\"http://php.net/$text\">$text</a>";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Prefilter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Prefilter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Prefilter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,40 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license,       |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available through the world-wide-web at                              |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license at php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Jeremy Cowgar <jeremy at cowgar.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Prefilter.php,v 1.2 2004/09/25 19:05:13 pmjones Exp $
+
+
+/**
+* 
+* This class implements a Text_Wiki_Render_Latex to "pre-filter" source text so
+* that line endings are consistently \n, lines ending in a backslash \
+* are concatenated with the next line, and tabs are converted to spaces.
+*
+* @author Jeremy Cowgar <jeremy at cowgar.com>
+*
+* @package Text_Wiki
+*
+*/
+
+class Text_Wiki_Render_Latex_Prefilter extends Text_Wiki_Render {
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Raw.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Raw.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Raw.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Latex_Raw extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "Raw: ".$options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Revise.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Revise.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Revise.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,38 @@
+<?php
+
+class Text_Wiki_Render_Latex_Revise extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'del_start') {
+            return '\sout{';
+        }
+        
+        if ($options['type'] == 'del_end') {
+            return '}';
+        }
+        
+        if ($options['type'] == 'ins_start') {
+            return '\underline{';
+        }
+        
+        if ($options['type'] == 'ins_end') {
+            return '}';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Strong.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Strong.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Strong.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,30 @@
+<?php
+
+class Text_Wiki_Render_Latex_Strong extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            return '\textbf{';
+        }
+        
+        if ($options['type'] == 'end') {
+            return '}';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Superscript.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Superscript.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Superscript.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,31 @@
+<?php
+
+class Text_Wiki_Render_Latex_Superscript extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return 'Superscript: NI';
+        
+        if ($options['type'] == 'start') {
+            return '<sup>';
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</sup>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Table.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Table.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Table.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,93 @@
+<?php
+
+class Text_Wiki_Render_Latex_Table extends Text_Wiki_Render {
+    var $cell_id    = 0;
+    var $cell_count = 0;
+    var $is_spanning = false;
+    
+    var $conf = array(
+                      'css_table' => null,
+                      'css_tr' => null,
+                      'css_th' => null,
+                      'css_td' => null
+                      );
+
+    /**
+     *
+     * Renders a token into text matching the requested format.
+     *
+     * @access public
+     *
+     * @param array $options The "options" portion of the token (second
+     * element).
+     *
+     * @return string The text rendered from the token options.
+     *
+     */
+
+    function token($options)
+    {
+        // make nice variable names (type, attr, span)
+        extract($options);
+
+        switch ($type)
+            {
+            case 'table_start':
+                $this->cell_count = $cols;
+                
+                $tbl_start = '\begin{tabular}{|';
+                for ($a=0; $a < $this->cell_count; $a++) {
+                    $tbl_start .= 'l|';
+                }
+                $tbl_start .= "}\n";
+                
+                return $tbl_start;
+
+            case 'table_end':
+                return "\\hline\n\\end{tabular}\n";
+
+            case 'row_start':
+                $this->is_spanning = false;
+                $this->cell_id = 0;
+                return "\\hline\n";
+
+            case 'row_end':
+                return "\\\\\n";
+
+            case 'cell_start':
+                if ($span > 1) {
+                    $col_spec = '';
+                    if ($this->cell_id == 0) {
+                        $col_spec = '|';
+                    }
+                    $col_spec .= 'l|';
+                        
+                    $this->cell_id += $span;
+                    $this->is_spanning = true;
+                    
+                    return "\\multicolumn\{$span}\{$col_spec}{";
+                }
+
+                $this->cell_id += 1;
+                return '';
+
+            case 'cell_end':
+                $out = '';
+                if ($this->is_spanning) {
+                    $this->is_spanning = false;
+                    $out = '}';
+                }
+                
+                if ($this->cell_id != $this->cell_count) {
+                    $out .= ' & ';
+                }
+
+                return $out;
+
+            default:
+                return '';
+
+            }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tighten.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tighten.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tighten.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,9 @@
+<?php
+class Text_Wiki_Render_Latex_Tighten extends Text_Wiki_Render {
+    
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Toc.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Toc.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Toc.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,30 @@
+<?php
+
+class Text_Wiki_Render_Latex_Toc extends Text_Wiki_Render {
+    
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if($options['type'] == 'list_start') {
+            return "\\tableofcontents\n\n";
+        }
+        
+        return '';
+    }
+
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tt.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tt.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Tt.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,30 @@
+<?php
+
+class Text_Wiki_Render_Latex_tt extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            return '\texttt{';
+        }
+        
+        if ($options['type'] == 'end') {
+            return '}';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Url.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Url.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Url.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,35 @@
+<?php
+
+
+class Text_Wiki_Render_Latex_Url extends Text_Wiki_Render {
+    
+    
+    var $conf = array(
+        'target' => false,
+        'images' => true,
+        'img_ext' => array('jpg', 'jpeg', 'gif', 'png')
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // create local variables from the options array (text,
+        // href, type)
+        extract($options);
+
+        return " $text\\footnote\{$href}";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Wikilink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Wikilink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex/Wikilink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,60 @@
+<?php
+
+class Text_Wiki_Render_Latex_Wikilink extends Text_Wiki_Render {
+    var $conf = array(
+        'pages' => array(),
+        'view_url' => 'http://example.com/index.php?page=%s',
+        'new_url'  => 'http://example.com/new.php?page=%s',
+        'new_text' => '?'
+    );
+    
+    /**
+    * 
+    * Renders a token into XHTML.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // make nice variable names (page, anchor, text)
+        extract($options);
+        
+        // are we checking page existence?
+        $list =& $this->getConf('pages');
+        if (is_array($list)) {
+            // yes, check against the page list
+            $exists = in_array($page, $list);
+        } else {
+            // no, assume it exists
+            $exists = true;
+        }
+        
+        // convert *after* checking against page names so as not to mess
+        // up what the user typed and what we're checking.
+        $page = htmlspecialchars($page);
+        $anchor = htmlspecialchars($anchor);
+        $text = htmlspecialchars($text);
+        
+        $href = $this->getConf('view_url');
+            
+        if (strpos($href, '%s') === false) {
+            // use the old form (page-at-end)
+            $href = $href . $page . $anchor;
+        } else {
+            // use the new form (sprintf format string)
+            $href = sprintf($href, $page . $anchor);
+        }
+        
+        // get the CSS class and generate output
+        $css = $this->formatConf(' class="%s"', 'css');
+        return "$text\\footnote\{$href}";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Latex.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,90 @@
+<?php
+
+/**
+* 
+* Formats parsed Text_Wiki for LaTeX rendering.
+* 
+* $Id: Latex.php,v 1.2 2004/09/25 19:05:13 pmjones Exp $
+* 
+* @author Jeremy Cowgar <jeremy at cowgar.com>
+* 
+* @package Text_Wiki
+* 
+* @todo [http://google.com] becomes 1 with a LaTeX footnote in subscript.
+*       This should be a normal LaTeX footnote associated with the
+*       previous word?
+* 
+* @todo parse "..." to be ``...''
+* 
+* @todo parse '...' to be `...'
+* 
+* @todo move escape_latex to a static function, move escaping to the
+*       individual .php files they are associated with
+* 
+* @todo allow the user to add conf items to do things like
+*       + A custom document header
+*       + Custom page headings
+*       + Include packages
+*       + Set Title, Author, Date
+*       + Include a title page
+*       + Not output Document Head/Foot (maybe combinding many pages?)
+* 
+*/
+
+class Text_Wiki_Render_Latex extends Text_Wiki_Render {
+    function escape_latex ($txt) {
+        $txt = str_replace("\\", "\\\\", $txt);
+        $txt = str_replace('#', '\#', $txt);
+        $txt = str_replace('$', '\$', $txt);
+        $txt = str_replace('%', '\%', $txt);
+        $txt = str_replace('^', '\^', $txt);
+        $txt = str_replace('&', '\&', $txt);
+        $txt = str_replace('_', '\_', $txt);
+        $txt = str_replace('{', '\{', $txt);
+        $txt = str_replace('}', '\}', $txt);
+        
+        // Typeset things a bit prettier than normas
+        $txt = str_replace('~',   '$\sim$', $txt);
+        $txt = str_replace('...', '\ldots', $txt);
+
+        return $txt;
+    }
+
+    function escape($tok, $ele) {
+        if (isset($tok[$ele])) {
+            $tok[$ele] = $this->escape_latex($tok[$ele]);
+        }
+
+        return $tok;
+    }
+    
+    function pre()
+    {
+        foreach ($this->wiki->tokens as $k => $tok) {
+            if ($tok[0] == 'Code') {
+                continue;
+            }
+
+            $tok[1] = $this->escape($tok[1], 'text');
+            $tok[1] = $this->escape($tok[1], 'page');
+            $tok[1] = $this->escape($tok[1], 'href');
+            
+            $this->wiki->tokens[$k] = $tok;
+        }
+
+        $this->wiki->source = $this->escape_latex($this->wiki->source);
+
+        return
+            "\\documentclass{article}\n".
+            "\\usepackage{ulem}\n".
+            "\\pagestyle{headings}\n".
+            "\\begin{document}\n";
+    }
+    
+    function post()
+    {
+        return "\\end{document}\n";
+    }
+    
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Anchor.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Anchor.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Anchor.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+/**
+* 
+* This class renders an anchor target name in XHTML.
+*
+* @author Manuel Holtgrewe <purestorm at ggnore dot net>
+*
+* @author Paul M. Jones <pmjones at ciaweb dot net>
+*
+* @package Text_Wiki
+*
+*/
+
+class Text_Wiki_Render_Plain_Anchor extends Text_Wiki_Render {
+    
+    function token($options)
+    {
+        return $options['name'];
+    }
+}
+
+?>

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Blockquote.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Blockquote.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Blockquote.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,39 @@
+<?php
+
+class Text_Wiki_Render_Plain_Blockquote extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $type = $options['type'];
+        $level = $options['level'];
+    
+        // set up indenting so that the results look nice; we do this
+        // in two steps to avoid str_pad mathematics.  ;-)
+        $pad = str_pad('', $level + 1, "\t");
+        $pad = str_replace("\t", '    ', $pad);
+        
+        // starting
+        if ($type == 'start') {
+            return "\n$pad";
+        }
+        
+        // ending
+        if ($type == 'end') {
+            return "\n$pad";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Bold.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Bold.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Bold.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Bold extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Break.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Break.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Break.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_Break extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "\n";
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Center.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Center.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Center.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Center extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Code.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Code.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Code.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_Code extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "\n" . $options['text'] . "\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Colortext.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Colortext.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Colortext.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Colortext extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Deflist.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Deflist.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Deflist.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,59 @@
+<?php
+
+class Text_Wiki_Render_Plain_Deflist extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $type = $options['type'];
+        $pad = "    ";
+        
+        switch ($type) {
+        
+        case 'list_start':
+            return "\n";
+            break;
+        
+        case 'list_end':
+            return "\n\n";
+            break;
+        
+        case 'term_start':
+        
+            // done!
+            return $pad;
+            break;
+        
+        case 'term_end':
+            return "\n";
+            break;
+        
+        case 'narr_start':
+        
+            // done!
+            return $pad . $pad;
+            break;
+        
+        case 'narr_end':
+            return "\n";
+            break;
+        
+        default:
+            return '';
+        
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Delimiter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Delimiter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Delimiter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Delimiter extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Embed.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Embed.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Embed.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Embed extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return strip_tags($options['text']);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Emphasis.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Emphasis.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Emphasis.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Emphasis extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Freelink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Freelink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Freelink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Freelink extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Function.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Function.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Function.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,39 @@
+<?php
+
+// $Id: Function.php,v 1.3 2004/10/08 17:46:47 pmjones Exp $
+
+class Text_Wiki_Render_Plain_Function extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        extract($options); // access, return, name, params, throws
+        
+        $output = "$access $return $name ( ";
+        
+        foreach ($params as $key => $val) {
+            $output .= "{$val['type']} {$val['descr']} {$val['default']} ";
+        }
+        
+        $output .= ') ';
+        
+        foreach ($throws as $key => $val) {
+            $output .= "{$val['type']} {$val['descr']} ";
+        }
+        
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Heading.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Heading.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Heading.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,14 @@
+<?php
+
+class Text_Wiki_Render_Plain_Heading extends Text_Wiki_Render {
+    
+    function token($options)
+    {
+        if ($options['type'] == 'end') {
+            return "\n\n";
+        } else {
+            return "\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Horiz.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Horiz.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Horiz.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Horiz extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return "\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Html.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Html.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Html.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_Html extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return strip_tags($options['text']);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Image.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Image.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Image.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,22 @@
+<?php
+class Text_Wiki_Render_Plain_Image extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Include.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Include.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Include.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,8 @@
+<?php
+class Text_Wiki_Render_Plain_Include extends Text_Wiki_Render {    
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Interwiki.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Interwiki.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Interwiki.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Interwiki extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Italic.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Italic.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Italic.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Italic extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/List.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/List.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/List.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,68 @@
+<?php
+
+
+class Text_Wiki_Render_Plain_List extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * This rendering method is syntactically and semantically compliant
+    * with XHTML 1.1 in that sub-lists are part of the previous list item.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // make nice variables (type, level, count)
+        extract($options);
+        
+        // set up indenting so that the results look nice; we do this
+        // in two steps to avoid str_pad mathematics.  ;-)
+        $pad = str_pad('', $level, "\t");
+        $pad = str_replace("\t", '    ', $pad);
+                
+        switch ($type) {
+        
+        case 'bullet_list_start':
+            break;
+        
+        case 'bullet_list_end':
+            if ($level == 0) {
+                return "\n\n";
+            }
+            break;
+        
+        case 'number_list_start':
+            break;
+        
+        case 'number_list_end':
+            if ($level == 0) {
+                return "\n\n";
+            }
+            break;
+        
+        case 'bullet_item_start':
+        case 'number_item_start':
+            return "\n$pad";
+            break;
+        
+        case 'bullet_item_end':
+        case 'number_item_end':
+        default:
+            // ignore item endings and all other types.
+            // item endings are taken care of by the other types
+            // depending on their place in the list.
+            return;
+            break;
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Newline.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Newline.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Newline.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,12 @@
+<?php
+
+class Text_Wiki_Render_Plain_Newline extends Text_Wiki_Render {
+    
+    
+    function token($options)
+    {
+        return "\n";
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Paragraph.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Paragraph.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Paragraph.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,31 @@
+<?php
+
+class Text_Wiki_Render_Plain_Paragraph extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        extract($options); //type
+        
+        if ($type == 'start') {
+            return '';
+        }
+        
+        if ($type == 'end') {
+            return "\n\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Phplookup.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Phplookup.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Phplookup.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,25 @@
+<?php
+
+class Text_Wiki_Render_Plain_Phplookup extends Text_Wiki_Render {
+    
+    var $conf = array('target' => '_blank');
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return trim($options['text']);
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Prefilter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Prefilter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Prefilter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,40 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license,       |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available through the world-wide-web at                              |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license at php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Paul M. Jones <pmjones at php.net>                          |
+// +----------------------------------------------------------------------+
+//
+// $Id: Prefilter.php,v 1.3 2005/02/22 19:12:58 pmjones Exp $
+
+
+/**
+* 
+* This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so
+* that line endings are consistently \n, lines ending in a backslash \
+* are concatenated with the next line, and tabs are converted to spaces.
+*
+* @author Paul M. Jones <pmjones at php.net>
+*
+* @package Text_Wiki
+*
+*/
+
+class Text_Wiki_Render_Plain_Prefilter extends Text_Wiki_Render {
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Raw.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Raw.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Raw.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Raw extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Revise.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Revise.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Revise.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_Revise extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Strong.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Strong.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Strong.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_Strong extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Superscript.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Superscript.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Superscript.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Plain_Superscript extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Table.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Table.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Table.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,57 @@
+<?php
+
+class Text_Wiki_Render_Plain_Table extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // make nice variable names (type, attr, span)
+        extract($options);
+        
+        $pad = '    ';
+        
+        switch ($type) {
+        
+        case 'table_start':
+            return;
+            break;
+        
+        case 'table_end':
+            return;
+            break;
+        
+        case 'row_start':
+            return;
+            break;
+        
+        case 'row_end':
+            return " ||\n";
+            break;
+        
+        case 'cell_start':
+            return " || ";
+            break;
+        
+        case 'cell_end':
+            return;
+            break;
+        
+        default:
+            return '';
+        
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tighten.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tighten.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tighten.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,10 @@
+<?php
+class Text_Wiki_Render_Plain_Tighten extends Text_Wiki_Render {
+    
+    
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Toc.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Toc.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Toc.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,39 @@
+<?php
+
+class Text_Wiki_Render_Plain_Toc extends Text_Wiki_Render {
+    
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // type, count, level
+        extract($options);
+        
+        if ($type == 'item_start') {
+            
+            // build some indenting spaces for the text
+            $indent = ($level - 2) * 4;
+            $pad = str_pad('', $indent);
+            return $pad;
+        }
+        
+        if ($type == 'item_end') {
+            return "\n";
+        }
+    }
+
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tt.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tt.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Tt.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_tt extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Url.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Url.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Url.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,25 @@
+<?php
+
+
+class Text_Wiki_Render_Plain_Url extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Wikilink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Wikilink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain/Wikilink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Plain_Wikilink extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into plain text.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Plain.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,16 @@
+<?php
+
+class Text_Wiki_Render_Plain extends Text_Wiki_Render {
+    
+    function pre()
+    {
+        return;
+    }
+    
+    function post()
+    {
+        return;
+    }
+    
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Anchor.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Anchor.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Anchor.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,37 @@
+<?php
+
+/**
+* 
+* This class renders an anchor target name in XHTML.
+*
+* @author Manuel Holtgrewe <purestorm at ggnore dot net>
+*
+* @author Paul M. Jones <pmjones at ciaweb dot net>
+*
+* @package Text_Wiki
+*
+*/
+
+class Text_Wiki_Render_Xhtml_Anchor extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    function token($options)
+    {
+        extract($options); // $type, $name
+        
+        if ($type == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            $format = "<a$css id=\"%s\">";
+            return sprintf($format ,$name);
+        }
+        
+        if ($type == 'end') {
+            return '</a>';
+        }
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Blockquote.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Blockquote.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Blockquote.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,46 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $type = $options['type'];
+        $level = $options['level'];
+    
+        // set up indenting so that the results look nice; we do this
+        // in two steps to avoid str_pad mathematics.  ;-)
+        $pad = str_pad('', $level, "\t");
+        $pad = str_replace("\t", '    ', $pad);
+        
+        // pick the css type
+        $css = $this->formatConf(' class="%s"', 'css');
+        
+        // starting
+        if ($type == 'start') {
+            return "$pad<blockquote$css>";
+        }
+        
+        // ending
+        if ($type == 'end') {
+            return $pad . "</blockquote>\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Bold.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Bold.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Bold.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,34 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Bold extends Text_Wiki_Render {
+
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<b$css>";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</b>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Break.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Break.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Break.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,29 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Break extends Text_Wiki_Render {
+
+    var $conf = array(
+        'css' => null
+    );
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $css = $this->formatConf(' class="%s"', 'css');
+        return "<br$css />\n";
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Center.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Center.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Center.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,29 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render {
+
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            return '<div style="text-align: center;">';
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</div>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Code.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Code.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Code.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,102 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css'      => null, // class for <pre>
+        'css_code' => null, // class for generic <code>
+        'css_php'  => null, // class for PHP <code>
+        'css_html' => null // class for HTML <code>
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $text = $options['text'];
+        $attr = $options['attr'];
+        $type = strtolower($attr['type']);
+        
+        $css      = $this->formatConf(' class="%s"', 'css');
+        $css_code = $this->formatConf(' class="%s"', 'css_code');
+        $css_php  = $this->formatConf(' class="%s"', 'css_php');
+        $css_html = $this->formatConf(' class="%s"', 'css_html');
+        
+        if ($type == 'php') {
+            
+            // PHP code example:
+            // add the PHP tags
+            $text = "<?php\n" . $options['text'] . "\n?>"; // <?php
+            
+            // convert tabs to four spaces
+            $text = str_replace("\t", "    ", $text);
+            
+            // colorize the code block (also converts HTML entities and adds
+            // <code>...</code> tags)
+            ob_start();
+            highlight_string($text);
+            $text = ob_get_contents();
+            ob_end_clean();
+            
+            // replace <br /> tags with simple newlines.
+            // replace non-breaking space with simple spaces.
+            // translate HTML <font> and color to XHTML <span> and style.
+            // courtesy of research by A. Kalin :-).
+            $map = array(
+                '<br />'  => "\n",
+                '&nbsp;'  => ' ',
+                '<font'   => '<span',
+                '</font>' => '</span>',
+                'color="' => 'style="color:'
+            );
+            $text = strtr($text, $map);
+           
+            // get rid of the last newline inside the code block
+            // (becuase higlight_string puts one there)
+            if (substr($text, -8) == "\n</code>") {
+                $text = substr($text, 0, -8) . "</code>";
+            }
+            
+            // replace all <code> tags with classed tags
+            if ($css_php) {
+                $text = str_replace('<code>', "<code$css_php>", $text);
+            }
+            
+            // done
+            $text = "<pre$css>$text</pre>";
+        
+        } elseif ($type == 'html' || $type == 'xhtml') {
+        
+            // HTML code example:
+            // add <html> opening and closing tags,
+            // convert tabs to four spaces,
+            // convert entities.
+            $text = str_replace("\t", "    ", $text);
+            $text = "<html>\n$text\n</html>";
+            $text = htmlentities($text);
+            $text = "<pre$css><code$css_html>$text</code></pre>";
+            
+        } else {
+            // generic code example:
+            // convert tabs to four spaces,
+            // convert entities.
+            $text = str_replace("\t", "    ", $text);
+            $text = htmlentities($text);
+            $text = "<pre$css><code$css_code>$text</code></pre>";
+        }
+        
+        return "\n$text\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Colortext.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Colortext.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Colortext.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,56 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
+    
+    var $colors = array(
+        'aqua',
+        'black',
+        'blue',
+        'fuchsia',
+        'gray',
+        'green',
+        'lime',
+        'maroon',
+        'navy',
+        'olive',
+        'purple',
+        'red',
+        'silver',
+        'teal',
+        'white',
+        'yellow'
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $type = $options['type'];
+        $color = $options['color'];
+        
+        if (! in_array($color, $this->colors)) {
+            $color = '#' . $color;
+        }
+        
+        if ($type == 'start') {
+            return "<span style=\"color: $color;\">";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</span>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Deflist.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Deflist.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Deflist.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,64 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Deflist extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css_dl' => null,
+        'css_dt' => null,
+        'css_dd' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $type = $options['type'];
+        $pad = "    ";
+        
+        switch ($type) {
+        
+        case 'list_start':
+            $css = $this->formatConf(' class="%s"', 'css_dl');
+            return "<dl$css>\n";
+            break;
+        
+        case 'list_end':
+            return "</dl>\n\n";
+            break;
+        
+        case 'term_start':
+            $css = $this->formatConf(' class="%s"', 'css_dt');
+            return $pad . "<dt$css>";
+            break;
+        
+        case 'term_end':
+            return "</dt>\n";
+            break;
+        
+        case 'narr_start':
+            $css = $this->formatConf(' class="%s"', 'css_dd');
+            return $pad . $pad . "<dd$css>";
+            break;
+        
+        case 'narr_end':
+            return "</dd>\n";
+            break;
+        
+        default:
+            return '';
+        
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Delimiter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Delimiter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Delimiter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Delimiter extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Embed.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Embed.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Embed.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Embed extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Emphasis.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Emphasis.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Emphasis.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,35 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Emphasis extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<em$css>";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</em>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Freelink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Freelink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Freelink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,9 @@
+<?php
+
+require_once TEXT_WIKI_BASE_INCLUDE_DIR.'Text/Wiki/Render/Xhtml/Wikilink.php';
+
+class Text_Wiki_Render_Xhtml_Freelink extends Text_Wiki_Render_Xhtml_Wikilink {
+    // renders identically to wikilinks, only the parsing is different :-)
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Function.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Function.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Function.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,87 @@
+<?php
+
+// $Id: Function.php,v 1.3 2004/10/08 17:46:47 pmjones Exp $
+
+class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
+    
+    var $conf = array(
+    	// list separator for params and throws
+        'list_sep' => ', ',
+        
+        // the "main" format string
+        'format_main' => '%access %return <b>%name</b> ( %params ) %throws',
+        
+        // the looped format string for required params
+        'format_param' => '%type <i>%descr</i>',
+        
+        // the looped format string for params with default values
+        'format_paramd' => '[%type <i>%descr</i> default %default]',
+        
+        // the looped format string for throws
+        'format_throws' => '<b>throws</b> %type <i>%descr</i>'
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        extract($options); // name, access, return, params, throws
+        
+        // build the baseline output
+        $output = $this->conf['format_main'];
+        $output = str_replace('%access', htmlspecialchars($access), $output);
+        $output = str_replace('%return', htmlspecialchars($return), $output);
+        $output = str_replace('%name', htmlspecialchars($name), $output);
+        
+        // build the set of params
+        $list = array();
+        foreach ($params as $key => $val) {
+            
+            // is there a default value?
+            if ($val['default']) {
+                $tmp = $this->conf['format_paramd'];
+            } else {
+                $tmp = $this->conf['format_param'];
+            }
+            
+            // add the param elements
+            $tmp = str_replace('%type', htmlspecialchars($val['type']), $tmp);
+            $tmp = str_replace('%descr', htmlspecialchars($val['descr']), $tmp);
+            $tmp = str_replace('%default', htmlspecialchars($val['default']), $tmp);
+            $list[] = $tmp;
+        }
+        
+        // insert params into output
+        $tmp = implode($this->conf['list_sep'], $list);
+        $output = str_replace('%params', $tmp, $output);
+        
+        // build the set of throws
+        $list = array();
+        foreach ($throws as $key => $val) {
+               $tmp = $this->conf['format_throws'];
+            $tmp = str_replace('%type', htmlspecialchars($val['type']), $tmp);
+            $tmp = str_replace('%descr', htmlspecialchars($val['descr']), $tmp);
+            $list[] = $tmp;
+        }
+        
+        // insert throws into output
+        $tmp = implode($this->conf['list_sep'], $list);
+        $output = str_replace('%throws', $tmp, $output);
+        
+        // close the div and return the output
+        $output .= '</div>';
+        return "\n$output\n\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Heading.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Heading.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Heading.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,29 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Heading extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css_h1' => null,
+        'css_h2' => null,
+        'css_h3' => null,
+        'css_h4' => null,
+        'css_h5' => null,
+        'css_h6' => null
+    );
+    
+    function token($options)
+    {
+        // get nice variable names (id, type, level)
+        extract($options);
+        
+        if ($type == 'start') {
+            $css = $this->formatConf(' class="%s"', "css_h$level");
+            return "<h$level$css id=\"$id\">";
+        }
+        
+        if ($type == 'end') {
+            return "</h$level>\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Horiz.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Horiz.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Horiz.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,28 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $css = $this->formatConf(' class="%s"', 'css');
+        return "<hr$css />\n";
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Html.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Html.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Html.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,24 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Image.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Image.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Image.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,152 @@
+<?php
+class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
+
+    var $conf = array(
+        'base' => '/',
+        'url_base' => null,
+        'css'  => null,
+        'css_link' => null
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // note the image source
+        $src = $options['src'];
+        
+        // is the source a local file or URL?
+        if (strpos($src, '://') === false) {
+            // the source refers to a local file.
+            // add the URL base to it.
+            $src = $this->getConf('base', '/') . $src;
+        }
+        
+        // stephane at metacites.net
+        // is the image clickable? 
+        if (isset($options['attr']['link'])) {
+            // yes, the image is clickable.
+            // are we linked to a URL or a wiki page?
+            if (strpos($options['attr']['link'], '://')) {
+                // it's a URL, prefix the URL base
+                $href = $this->getConf('url_base') . $options['attr']['link'];
+            } else {
+                // it's a WikiPage; assume it exists.
+                /** @todo This needs to honor sprintf wikilinks (pmjones) */
+                /** @todo This needs to honor interwiki (pmjones) */
+                /** @todo This needs to honor freelinks (pmjones) */
+                $href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') .
+                    $options['attr']['link'];
+            }
+        } else {
+            // image is not clickable.
+            $href = null;
+        }
+        // unset so it won't show up as an attribute
+        unset($options['attr']['link']);
+        
+        // stephane at metacites.net -- 25/07/2004 
+        // we make up an align="center" value for the <img> tag.
+        if (isset($options['attr']['align']) &&
+            $options['attr']['align'] == 'center') {
+            
+            // unset so it won't show up as an attribute
+            unset($options['attr']['align']);
+            
+            // make sure we have a style attribute
+            if (! isset($options['attr']['style'])) {
+                // no style, set up a blank one
+                $options['attr']['style'] = '';
+            } else {
+                // style exists, add a space
+                $options['attr']['style'] .= ' ';
+            }
+            
+            // add a "center" style to the existing style.
+            $options['attr']['style'] .=
+                'display: block; margin-left: auto; margin-right: auto;';
+        }
+        
+        // stephane at metacites.net -- 25/07/2004 
+        // try to guess width and height
+        if (! isset($options['attr']['width']) &&
+            ! isset($options['attr']['height'])) {
+            
+            // does the source refer to a local file or a URL?
+            if (strpos($src,'://')) {
+                // is a URL link
+                $imageFile = $src;
+            } else {
+                // is a local file
+                $imageFile = $_SERVER['DOCUMENT_ROOT'] . $src;
+            }
+            
+            // attempt to get the image size
+            $imageSize = @getimagesize($imageFile);
+            
+            if (is_array($imageSize)) {
+                $options['attr']['width'] = $imageSize[0];
+                $options['attr']['height'] = $imageSize[1];
+            }
+            
+        }
+        
+        // start the HTML output
+        $output = '<img src="' . htmlspecialchars($src) . '"';
+        
+        // get the CSS class but don't add it yet
+        $css = $this->formatConf(' class="%s"', 'css');
+        
+        // add the attributes to the output, and be sure to
+        // track whether or not we find an "alt" attribute
+        $alt = false;
+        foreach ($options['attr'] as $key => $val) {
+            
+            // track the 'alt' attribute
+            if (strtolower($key) == 'alt') {
+                $alt = true;
+            }
+            
+            // the 'class' attribute overrides the CSS class conf
+            if (strtolower($key) == 'class') {
+                $css = null;
+            }
+            
+            $key = htmlspecialchars($key);
+            $val = htmlspecialchars($val);
+            $output .= " $key=\"$val\"";
+        }
+        
+        // always add an "alt" attribute per Stephane Solliec
+        if (! $alt) {
+            $alt = htmlspecialchars(basename($options['src']));
+            $output .= " alt=\"$alt\"";
+        }
+        
+        // end the image tag with the automatic CSS class (if any)
+        $output .= "$css />";
+        
+        // was the image clickable?
+        if ($href) {
+            // yes, add the href and return
+            $href = htmlspecialchars($href);
+            $css = $this->formatConf(' class="%s"', 'css_link');
+            $output = "<a$css href=\"$href\">$output</a>";
+        }
+        
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Include.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Include.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Include.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,8 @@
+<?php
+class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render {    
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Interwiki.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Interwiki.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Interwiki.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,74 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'sites' => array(
+            'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
+            'Advogato' => 'http://advogato.org/%s',
+            'Wiki'       => 'http://c2.com/cgi/wiki?%s'
+        ),
+        'target' => '_blank',
+        'css' => null
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $site = $options['site'];
+        $page = $options['page'];
+        $text = $options['text'];
+        $css = $this->formatConf(' class="%s"', 'css');
+        
+        if (isset($this->conf['sites'][$site])) {
+            $href = $this->conf['sites'][$site];
+        } else {
+            return $text;
+        }
+        
+        // old form where page is at end,
+        // or new form with %s placeholder for sprintf()?
+        if (strpos($href, '%s') === false) {
+            // use the old form
+            $href = $href . $page;
+        } else {
+            // use the new form
+            $href = sprintf($href, $page);
+        }
+        
+        // allow for alternative targets
+        $target = $this->getConf('target');
+        
+        // build base link
+        $text = htmlspecialchars($text);
+        $output = "<a$css href=\"$href\"";
+        
+        // are we targeting a specific window?
+        if ($target) {
+            // this is XHTML compliant, suggested by Aaron Kalin.
+            // code tip is actually from youngpup.net, and it
+            // uses the $target as the new window name.
+            $target = htmlspecialchars($target);
+            $output .= " onClick=\"window.open(this.href, '$target');";
+            $output .= " return false;\"";
+        }
+        
+        $output .= ">$text</a>";
+        
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Italic.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Italic.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Italic.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,34 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<i$css>";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</i>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/List.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/List.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/List.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,142 @@
+<?php
+
+
+class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css_ol' => null,
+        'css_ol_li' => null,
+        'css_ul' => null,
+        'css_ul_li' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * This rendering method is syntactically and semantically compliant
+    * with XHTML 1.1 in that sub-lists are part of the previous list item.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // make nice variables (type, level, count)
+        extract($options);
+        
+        // set up indenting so that the results look nice; we do this
+        // in two steps to avoid str_pad mathematics.  ;-)
+        $pad = str_pad('', $level, "\t");
+        $pad = str_replace("\t", '    ', $pad);
+                
+        switch ($type) {
+        
+        case 'bullet_list_start':
+        
+            // build the base HTML
+            $css = $this->formatConf(' class="%s"', 'css_ul');
+            $html = "<ul$css>";
+            
+            // if this is the opening block for the list,
+            // put an extra newline in front of it so the
+            // output looks nice.
+            if ($level == 0) {
+                $html = "\n$html";
+            }
+            
+            // done!
+            return $html;
+            break;
+        
+        case 'bullet_list_end':
+        
+            // build the base HTML
+            $html = "</li>\n$pad</ul>";
+            
+            // if this is the closing block for the list,
+            // put extra newlines after it so the output
+            // looks nice.
+            if ($level == 0) {
+                $html .= "\n\n";
+            }
+            
+            // done!
+            return $html;
+            break;
+        
+        case 'number_list_start':
+        
+            // build the base HTML
+            $css = $this->formatConf(' class="%s"', 'css_ol');
+            $html = "<ol$css>";
+            
+            // if this is the opening block for the list,
+            // put an extra newline in front of it so the
+            // output looks nice.
+            if ($level == 0) {
+                $html = "\n$html";
+            }
+            
+            // done!
+            return $html;
+            break;
+        
+        case 'number_list_end':
+        
+            // build the base HTML
+            $html = "</li>\n$pad</ol>";
+            
+            // if this is the closing block for the list,
+            // put extra newlines after it so the output
+            // looks nice.
+            if ($level == 0) {
+                $html .= "\n\n";
+            }
+            
+            // done!
+            return $html;
+            break;
+        
+        case 'bullet_item_start':
+        case 'number_item_start':
+        
+            // pick the proper CSS class
+            if ($type == 'bullet_item_start') {
+                $css = $this->formatConf(' class="%s"', 'css_ul_li');
+            } else {
+                $css = $this->formatConf(' class="%s"', 'css_ol_li');
+            }
+            
+            // build the base HTML
+            $html = "\n$pad<li$css>";
+            
+            // for the very first item in the list, do nothing.
+            // but for additional items, be sure to close the
+            // previous item.
+            if ($count > 0) {
+                $html = "</li>$html";
+            }
+            
+            // done!
+            return $html;
+            break;
+        
+        case 'bullet_item_end':
+        case 'number_item_end':
+        default:
+            // ignore item endings and all other types.
+            // item endings are taken care of by the other types
+            // depending on their place in the list.
+            return '';
+            break;
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Newline.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Newline.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Newline.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,12 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Newline extends Text_Wiki_Render {
+    
+    
+    function token($options)
+    {
+        return "<br />\n";
+    }
+}
+
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Paragraph.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Paragraph.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Paragraph.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,36 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        extract($options); //type
+        
+        if ($type == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<p$css>";
+        }
+        
+        if ($type == 'end') {
+            return "</p>\n\n";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Phplookup.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Phplookup.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Phplookup.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,59 @@
+<?php
+
+// $Id: Phplookup.php,v 1.7 2004/09/25 19:05:14 pmjones Exp $
+
+class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'target' => '_blank',
+        'css' => null
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        $text = trim($options['text']);
+        $css = $this->formatConf(' class="%s"', 'css');
+        
+        // start the html
+        $output = "<a$css";
+        
+        // are we targeting another window?
+        $target = $this->getConf('target', '');
+        if ($target) {
+            // use a "popup" window.  this is XHTML compliant, suggested by
+            // Aaron Kalin.  uses the $target as the new window name.
+            $target = htmlspecialchars($target);
+            $output .= " onclick=\"window.open(this.href, '$target');";
+            $output .= " return false;\"";
+        }
+        
+        // take off the final parens for functions
+        if (substr($text, -2) == '()') {
+            $q = substr($text, 0, -2);
+        } else {
+            $q = $text;
+        }
+        
+        $q = htmlspecialchars($q);
+        $text = htmlspecialchars($text);
+        
+        // finish and return
+        $output .= " href=\"http://php.net/$q\">$text</a>";
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Prefilter.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Prefilter.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Prefilter.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,40 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license,       |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available through the world-wide-web at                              |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license at php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Paul M. Jones <pmjones at php.net>                          |
+// +----------------------------------------------------------------------+
+//
+// $Id: Prefilter.php,v 1.6 2005/02/22 19:12:58 pmjones Exp $
+
+
+/**
+* 
+* This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so
+* that line endings are consistently \n, lines ending in a backslash \
+* are concatenated with the next line, and tabs are converted to spaces.
+*
+* @author Paul M. Jones <pmjones at php.net>
+*
+* @package Text_Wiki
+*
+*/
+
+class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render {
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Raw.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Raw.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Raw.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,23 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render {
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        return $options['text'];
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Revise.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Revise.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Revise.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,45 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css_ins' => null,
+        'css_del' => null
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'del_start') {
+            $css = $this->formatConf(' class="%s"', 'css_del');
+            return "<del$css>";
+        }
+        
+        if ($options['type'] == 'del_end') {
+            return "</del>";
+        }
+        
+        if ($options['type'] == 'ins_start') {
+            $css = $this->formatConf(' class="%s"', 'css_ins');
+            return "<ins$css>";
+        }
+        
+        if ($options['type'] == 'ins_end') {
+            return "</ins>";
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Strong.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Strong.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Strong.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,35 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render {
+    
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<strong$css>";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</strong>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Superscript.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Superscript.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Superscript.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,34 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<sup$css>";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</sup>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Table.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Table.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Table.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,98 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css_table' => null,
+        'css_tr' => null,
+        'css_th' => null,
+        'css_td' => null
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // make nice variable names (type, attr, span)
+        extract($options);
+        
+        $pad = '    ';
+        
+        switch ($type) {
+        
+        case 'table_start':
+            $css = $this->formatConf(' class="%s"', 'css_table');
+            return "\n\n<table$css>\n";
+            break;
+        
+        case 'table_end':
+            return "</table>\n\n";
+            break;
+        
+        case 'row_start':
+            $css = $this->formatConf(' class="%s"', 'css_tr');
+            return "$pad<tr$css>\n";
+            break;
+        
+        case 'row_end':
+            return "$pad</tr>\n";
+            break;
+        
+        case 'cell_start':
+            
+            // base html
+            $html = $pad . $pad;
+            
+            // is this a TH or TD cell?
+            if ($attr == 'header') {
+                // start a header cell
+                $css = $this->formatConf(' class="%s"', 'css_th');
+                $html .= "<th$css";
+            } else {
+                // start a normal cell
+                $css = $this->formatConf(' class="%s"', 'css_td');
+                $html .= "<td$css";
+            }
+            
+            // add the column span
+            if ($span > 1) {
+                $html .= " colspan=\"$span\"";
+            }
+            
+            // add alignment
+            if ($attr != 'header' && $attr != '') {
+                $html .= " style=\"text-align: $attr;\"";
+            }
+            
+            // done!
+            $html .= '>';
+            return $html;
+            break;
+        
+        case 'cell_end':
+            if ($attr == 'header') {
+                return "</th>\n";
+            } else {
+                return "</td>\n";
+            }
+            break;
+        
+        default:
+            return '';
+        
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tighten.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tighten.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tighten.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,10 @@
+<?php
+class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render {
+    
+    
+    function token()
+    {
+        return '';
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Toc.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Toc.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Toc.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,80 @@
+<?php
+
+// $Id: Toc.php,v 1.7 2004/09/25 19:05:14 pmjones Exp $
+
+class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'css_list' => null,
+        'css_item' => null,
+        'title' => '<strong>Table of Contents</strong>',
+        'div_id' => 'toc'
+    );
+    
+    var $min = 2;
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // type, id, level, count, attr
+        extract($options);
+        
+        switch ($type) {
+        
+        case 'list_start':
+        
+            $html = '<div';
+            
+            $css = $this->getConf('css_list');
+            if ($css) {
+                $html .= " class=\"$css\"";
+            }
+            
+            $div_id = $this->getConf('div_id');
+            if ($div_id) {
+                $html .= " id=\"$div_id\"";
+            }
+            
+            $html .= '>';
+            $html .= $this->getConf('title');
+            return $html;
+            break;
+        
+        case 'list_end':
+            return "</div>\n";
+            break;
+            
+        case 'item_start':
+            $html = '<div';
+            
+            $css = $this->getConf('css_item');
+            if ($css) {
+                $html .= " class=\"$css\"";
+            }
+            
+            $pad = ($level - $this->min);
+            $html .= " style=\"margin-left: {$pad}em;\">";
+            
+            $html .= "<a href=\"#$id\">";
+            return $html;
+            break;
+        
+        case 'item_end':
+            return "</a></div>\n";
+            break;
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tt.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tt.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Tt.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,35 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_tt extends Text_Wiki_Render {
+    
+    
+    var $conf = array(
+        'css' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        if ($options['type'] == 'start') {
+            $css = $this->formatConf(' class="%s"', 'css');
+            return "<tt$css>";
+        }
+        
+        if ($options['type'] == 'end') {
+            return '</tt>';
+        }
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Url.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Url.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Url.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,95 @@
+<?php
+
+
+class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
+    
+    
+    var $conf = array(
+        'target' => '_blank',
+        'images' => true,
+        'img_ext' => array('jpg', 'jpeg', 'gif', 'png'),
+        'css_inline' => null,
+        'css_footnote' => null,
+        'css_descr' => null,
+        'css_img' => null
+    );
+    
+    /**
+    * 
+    * Renders a token into text matching the requested format.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // create local variables from the options array (text,
+        // href, type)
+        extract($options);
+        
+        // find the rightmost dot and determine the filename
+        // extension.
+        $pos = strrpos($href, '.');
+        $ext = strtolower(substr($href, $pos + 1));
+        $href = htmlspecialchars($href);
+        
+        // does the filename extension indicate an image file?
+        if ($this->getConf('images') &&
+            in_array($ext, $this->getConf('img_ext', array()))) {
+            
+            // create alt text for the image
+            if (! isset($text) || $text == '') {
+                $text = basename($href);
+                $text = htmlspecialchars($text);
+            }
+            
+            // generate an image tag
+            $css = $this->formatConf(' class="%s"', 'css_img');
+            $output = "<img$css src=\"$href\" alt=\"$text\" />";
+            
+        } else {
+            
+            // should we build a target clause?
+            if ($href{0} == '#' ||
+            	strtolower(substr($href, 0, 7)) == 'mailto:') {
+            	// targets not allowed for on-page anchors
+            	// and mailto: links.
+                $target = '';
+            } else {
+				// allow targets on non-anchor non-mailto links
+                $target = $this->getConf('target');
+            }
+            
+            // generate a regular link (not an image)
+            $text = htmlspecialchars($text);
+            $css = $this->formatConf(' class="%s"', "css_$type");
+            $output = "<a$css href=\"$href\"";
+            
+            if ($target) {
+                // use a "popup" window.  this is XHTML compliant, suggested by
+                // Aaron Kalin.  uses the $target as the new window name.
+                $target = htmlspecialchars($target);
+                $output .= " onclick=\"window.open(this.href, '$target');";
+                $output .= " return false;\"";
+            }
+            
+            // finish up output
+            $output .= ">$text</a>";
+            
+            // make numbered references look like footnotes when no
+            // CSS class specified, make them superscript by default
+            if ($type == 'footnote' && ! $css) {
+                $output = '<sup>' . $output . '</sup>';
+            }
+        }
+        
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Wikilink.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Wikilink.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml/Wikilink.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,137 @@
+<?php
+
+class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
+    
+    var $conf = array(
+        'pages' => array(), // set to null or false to turn off page checks
+        'view_url' => 'http://example.com/index.php?page=%s',
+        'new_url'  => 'http://example.com/new.php?page=%s',
+        'new_text' => '?',
+        'new_text_pos' => 'after', // 'before', 'after', or null/false
+        'css' => null,
+        'css_new' => null,
+        'exists_callback' => null // call_user_func() callback
+    );
+    
+    
+    /**
+    * 
+    * Renders a token into XHTML.
+    * 
+    * @access public
+    * 
+    * @param array $options The "options" portion of the token (second
+    * element).
+    * 
+    * @return string The text rendered from the token options.
+    * 
+    */
+    
+    function token($options)
+    {
+        // make nice variable names (page, anchor, text)
+        extract($options);
+        
+        // is there a "page existence" callback?
+        // we need to access it directly instead of through
+        // getConf() because we'll need a reference (for
+        // object instance method callbacks).
+        if (isset($this->conf['exists_callback'])) {
+            $callback =& $this->conf['exists_callback'];
+        } else {
+        	$callback = false;
+        }
+		
+        if ($callback) {
+            // use the callback function
+            $exists = call_user_func($callback, $page);
+        } else {
+            // no callback, go to the naive page array.
+            $list =& $this->getConf('pages');
+            if (is_array($list)) {
+                // yes, check against the page list
+                $exists = in_array($page, $list);
+            } else {
+                // no, assume it exists
+                $exists = true;
+            }
+        }
+        
+        // convert *after* checking against page names so as not to mess
+        // up what the user typed and what we're checking.
+        $page = htmlspecialchars($page);
+        $anchor = htmlspecialchars($anchor);
+        $text = htmlspecialchars($text);
+        
+        // does the page exist?
+        if ($exists) {
+        
+            // PAGE EXISTS.
+        
+            // link to the page view, but we have to build
+            // the HREF.  we support both the old form where
+            // the page always comes at the end, and the new
+            // form that uses %s for sprintf()
+            $href = $this->getConf('view_url');
+            
+            if (strpos($href, '%s') === false) {
+                // use the old form (page-at-end)
+                $href = $href . $page . $anchor;
+            } else {
+                // use the new form (sprintf format string)
+                $href = sprintf($href, $page . $anchor);
+            }
+            
+            // get the CSS class and generate output
+            $css = $this->formatConf(' class="%s"', 'css');
+            $output = "<a$css href=\"$href\">$text</a>";
+        
+        } else {
+            
+            // PAGE DOES NOT EXIST.
+            
+            // link to a create-page url, but only if new_url is set
+            $href = $this->getConf('new_url', null);
+            
+            // set the proper HREF
+            if (! $href || trim($href) == '') {
+            
+                // no useful href, return the text as it is
+                $output = $text;
+                
+            } else {
+            
+                // yes, link to the new-page href, but we have to build
+                // it.  we support both the old form where
+                // the page always comes at the end, and the new
+                // form that uses sprintf()
+                if (strpos($href, '%s') === false) {
+                    // use the old form
+                    $href = $href . $page;
+                } else {
+                    // use the new form
+                    $href = sprintf($href, $page);
+                }
+            }
+            
+            // get the appropriate CSS class and new-link text
+            $css = $this->formatConf(' class="%s"', 'css_new');
+            $new = $this->getConf('new_text');
+            
+            // what kind of linking are we doing?
+            $pos = $this->getConf('new_text_pos');
+            if (! $pos || ! $new) {
+                // no position (or no new_text), use css only on the page name
+                $output = "<a$css href=\"$href\">$page</a>";
+            } elseif ($pos == 'before') {
+                // use the new_text BEFORE the page name
+                $output = "<a$css href=\"$href\">$new</a>$text";
+            } else {
+                // default, use the new_text link AFTER the page name
+                $output = "$text<a$css href=\"$href\">$new</a>";
+            }
+        }
+        return $output;
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render/Xhtml.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,33 @@
+<?php
+
+class Text_Wiki_Render_Xhtml extends Text_Wiki_Render {
+    
+    var $conf = array('translate' => HTML_SPECIALCHARS);
+    
+    function pre()
+    {
+        // attempt to translate HTML entities in the source before continuing.
+        $type = $this->getConf('translate', null);
+        
+        // are we translating html?
+        if ($type !== false && $type !== null) {
+        
+            // yes! get the translation table.
+            $xlate = get_html_translation_table($type);
+            
+            // remove the delimiter character it doesn't get translated
+            unset($xlate[$this->wiki->delim]);
+            
+            // translate!
+            $this->wiki->source = strtr($this->wiki->source, $xlate);
+        }
+        
+    }
+    
+    function post()
+    {
+        return;
+    }
+    
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki/Render.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki/Render.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki/Render.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,197 @@
+<?php
+
+/**
+* 
+* Base rendering class for parsed and tokenized text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Render.php,v 1.5 2005/02/23 17:38:29 pmjones Exp $
+* 
+*/
+
+/**
+* 
+* Base rendering class for parsed and tokenized text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+*/
+
+class Text_Wiki_Render {
+    
+    
+    /**
+    * 
+    * Configuration options for this render rule.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $conf = array();
+    
+    
+    /**
+    * 
+    * The name of this rule's format.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $format = null;
+    
+    
+    /**
+    * 
+    * The name of this rule's token array elements.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $rule = null;
+    
+    
+    /**
+    * 
+    * A reference to the calling Text_Wiki object.
+    * 
+    * This is needed so that each rule has access to the same source
+    * text, token set, URLs, interwiki maps, page names, etc.
+    * 
+    * @access public
+    * 
+    * @var object
+    */
+    
+    var $wiki = null;
+    
+    
+    /**
+    * 
+    * Constructor for this render format or rule.
+    * 
+    * @access public
+    * 
+    * @param object &$obj The calling "parent" Text_Wiki object.
+    * 
+    */
+    
+    function Text_Wiki_Render(&$obj)
+    {
+        // keep a reference to the calling Text_Wiki object
+        $this->wiki =& $obj;
+        
+        // get the config-key-name for this object,
+        // strip the Text_Wiki_Render_ part
+        //           01234567890123456
+        $tmp = get_class($this);
+        $tmp = substr($tmp, 17);
+        
+        // split into pieces at the _ mark.
+        // first part is format, second part is rule.
+        $part   = explode('_', $tmp);
+        $this->format = isset($part[0]) ? ucwords(strtolower($part[0])) : null;
+        $this->rule   = isset($part[1]) ? ucwords(strtolower($part[1])) : null;
+        
+        // is there a format but no rule?
+        // then this is the "main" render object, with
+        // pre() and post() methods.
+        if ($this->format && ! $this->rule &&
+            isset($this->wiki->formatConf[$this->format]) &&
+            is_array($this->wiki->formatConf[$this->format])) {
+            
+            // this is a format render object
+            $this->conf = array_merge(
+                $this->conf,
+                $this->wiki->formatConf[$this->format]
+            );
+        
+        }
+        
+        // is there a format and a rule?
+        if ($this->format && $this->rule &&
+            isset($this->wiki->renderConf[$this->format][$this->rule]) &&
+            is_array($this->wiki->renderConf[$this->format][$this->rule])) {
+            
+            // this is a rule render object
+            $this->conf = array_merge(
+                $this->conf,
+                $this->wiki->renderConf[$this->format][$this->rule]
+            );
+        }
+    }
+    
+    
+    /**
+    * 
+    * Simple method to safely get configuration key values.
+    * 
+    * @access public
+    * 
+    * @param string $key The configuration key.
+    * 
+    * @param mixed $default If the key does not exist, return this value
+    * instead.
+    * 
+    * @return mixed The configuration key value (if it exists) or the
+    * default value (if not).
+    * 
+    */
+    
+    function getConf($key, $default = null)
+    {
+        if (isset($this->conf[$key])) {
+            return $this->conf[$key];
+        } else {
+            return $default;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Simple method to wrap a configuration in an sprintf() format.
+    * 
+    * @access public
+    * 
+    * @param string $key The configuration key.
+    * 
+    * @param string $format The sprintf() format string.
+    * 
+    * @return mixed The formatted configuration key value (if it exists) 
+    * or null (if it does not).
+    * 
+    */
+    
+    function formatConf($format, $key)
+    {
+        if (isset($this->conf[$key])) {
+            return sprintf($format, $this->conf[$key]);
+        } else {
+            return null;
+        }
+    }
+    
+}
+?>
\ No newline at end of file

Added: plugins/trunk/textparser/class/data/Text/Wiki.php
===================================================================
--- plugins/trunk/textparser/class/data/Text/Wiki.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Text/Wiki.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -0,0 +1,1275 @@
+<?php
+
+/**
+* 
+* Parse structured wiki text and render into arbitrary formats such as XHTML.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @license LGPL
+* 
+* @version $Id: Wiki.php,v 1.28 2005/02/22 19:12:57 pmjones Exp $
+* 
+*/
+
+/**
+* The baseline abstract parser class.
+*/
+
+define( "TEXT_WIKI_BASE_INCLUDE_DIR", PLOG_CLASS_PATH."plugins/textparser/class/data/" );
+
+require_once TEXT_WIKI_BASE_INCLUDE_DIR.'Text/Wiki/Parse.php';
+
+/**
+* The baseline abstract render class.
+*/
+
+require_once TEXT_WIKI_BASE_INCLUDE_DIR.'Text/Wiki/Render.php';
+
+
+/**
+* 
+* Parse structured wiki text and render into arbitrary formats such as XHTML.
+* 
+* This is the "master" class for handling the management and convenience
+* functions to transform Wiki-formatted text.
+* 
+* @category Text
+* 
+* @package Text_Wiki
+* 
+* @author Paul M. Jones <pmjones at php.net>
+* 
+* @version @package_version@
+* 
+*/
+
+class Text_Wiki {
+    
+    /**
+    * 
+    * The default list of rules, in order, to apply to the source text.
+    * 
+    * @access public
+    * 
+    * @var array
+    * 
+    */
+    
+    var $rules = array(
+        'Prefilter',
+        'Delimiter',
+        'Code',
+        'Function',
+        'Html',
+        'Raw',
+        'Include',
+        'Embed',
+        'Anchor',
+        'Heading',
+        'Toc',
+        'Horiz',
+        'Break',
+        'Blockquote',
+        'List',
+        'Deflist',
+        'Table',
+        'Image',
+        'Phplookup',
+        'Center',
+        'Newline',
+        'Paragraph',
+        'Url',
+        'Freelink',
+        'Interwiki',
+        'Wikilink',
+        'Colortext',
+        'Strong',
+        'Bold',
+        'Emphasis',
+        'Italic',
+        'Tt',
+        'Superscript',
+        'Revise',
+        'Tighten'
+    );
+    
+    
+    /**
+    * 
+    * The list of rules to not-apply to the source text.
+    * 
+    * @access public
+    * 
+    * @var array
+    * 
+    */
+    
+    var $disable = array(
+        'Html',
+        'Include',
+        'Embed'
+    );
+    
+    
+    /**
+    * 
+    * Custom configuration for rules at the parsing stage.
+    *
+    * In this array, the key is the parsing rule name, and the value is
+    * an array of key-value configuration pairs corresponding to the $conf
+    * property in the target parsing rule.
+    * 
+    * For example:
+    * 
+    * <code>
+    * $parseConf = array(
+    *     'Include' => array(
+    *         'base' => '/path/to/scripts/'
+    *     )
+    * );
+    * </code>
+    * 
+    * Note that most default rules do not need any parsing configuration.
+    * 
+    * @access public
+    * 
+    * @var array
+    * 
+    */
+    
+    var $parseConf = array();
+    
+    
+    /**
+    * 
+    * Custom configuration for rules at the rendering stage.
+    *
+    * Because rendering may be different for each target format, the
+    * first-level element in this array is always a format name (e.g.,
+    * 'Xhtml').
+    * 
+    * Within that first level element, the subsequent elements match the
+    * $parseConf format. That is, the sub-key is the rendering rule name,
+    * and the sub-value is an array of key-value configuration pairs
+    * corresponding to the $conf property in the target rendering rule.
+    * 
+    * @access public
+    * 
+    * @var array
+    * 
+    */
+    
+    var $renderConf = array(
+        'Docbook' => array(),
+        'Latex' => array(),
+        'Pdf' => array(),
+        'Plain' => array(),
+        'Rtf' => array(),
+        'Xhtml' => array()
+    );
+    
+    
+    /**
+    * 
+    * Custom configuration for the output format itself.
+    *
+    * Even though Text_Wiki will render the tokens from parsed text,
+    * the format itself may require some configuration.  For example,
+    * RTF needs to know font names and sizes, PDF requires page layout
+    * information, and DocBook needs a section hierarchy.  This array
+    * matches the $conf property of the the format-level renderer
+    * (e.g., Text_Wiki_Render_Xhtml).
+    * 
+    * In this array, the key is the rendering format name, and the value is
+    * an array of key-value configuration pairs corresponding to the $conf
+    * property in the rendering format rule.
+    * 
+    * @access public
+    * 
+    * @var array
+    * 
+    */
+    
+    var $formatConf = array(
+        'Docbook' => array(),
+        'Latex' => array(),
+        'Pdf' => array(),
+        'Plain' => array(),
+        'Rtf' => array(),
+        'Xhtml' => array()
+    );
+    
+    
+    /**
+    * 
+    * The delimiter for token numbers of parsed elements in source text.
+    * 
+    * @access public
+    * 
+    * @var string
+    * 
+    */
+    
+    var $delim = "\xFF"; 
+    
+    
+    /**
+    * 
+    * The tokens generated by rules as the source text is parsed.
+    * 
+    * As Text_Wiki applies rule classes to the source text, it will
+    * replace portions of the text with a delimited token number.  This
+    * is the array of those tokens, representing the replaced text and
+    * any options set by the parser for that replaced text.
+    * 
+    * The tokens array is sequential; each element is itself a sequential
+    * array where element 0 is the name of the rule that generated the
+    * token, and element 1 is an associative array where the key is an
+    * option name and the value is an option value.
+    * 
+    * @access private
+    * 
+    * @var array
+    * 
+    */
+    
+    var $tokens = array();
+    
+    
+    /**
+    * 
+    * The source text to which rules will be applied.
+    * 
+    * This text will be transformed in-place, which means that it will
+    * change as the rules are applied.
+    * 
+    * @access private
+    * 
+    * @var string
+    * 
+    */
+    
+    var $source = '';
+    
+    
+    /**
+    * 
+    * Array of rule parsers.
+    * 
+    * Text_Wiki creates one instance of every rule that is applied to
+    * the source text; this array holds those instances.  The array key
+    * is the rule name, and the array value is an instance of the rule
+    * class.
+    * 
+    * @access private
+    * 
+    * @var array
+    * 
+    */
+    
+    var $parseObj = array();
+    
+    
+    /**
+    * 
+    * Array of rule renderers.
+    * 
+    * Text_Wiki creates one instance of every rule that is applied to
+    * the source text; this array holds those instances.  The array key
+    * is the rule name, and the array value is an instance of the rule
+    * class.
+    * 
+    * @access private
+    * 
+    * @var array
+    * 
+    */
+    
+    var $renderObj = array();
+    
+    
+    /**
+    * 
+    * Array of format renderers.
+    * 
+    * @access private
+    * 
+    * @var array
+    * 
+    */
+    
+    var $formatObj = array();
+    
+    
+    /**
+    * 
+    * Array of paths to search, in order, for parsing and rendering rules.
+    * 
+    * @access private
+    * 
+    * @var array
+    * 
+    */
+    
+    var $path = array(
+        'parse' => array(),
+        'render' => array()
+    );
+    
+    
+    
+    /**
+    * 
+    * The directory separator character.
+    * 
+    * @access private
+    * 
+    * @var string
+    * 
+    */
+    
+    var $_dirSep = DIRECTORY_SEPARATOR;
+    
+    
+    /**
+    * 
+    * Constructor.
+    * 
+    * @access public
+    * 
+    * @param array $rules The set of rules to load for this object.
+    *     
+    */
+    
+    function Text_Wiki($rules = null)
+    {
+        if (is_array($rules)) {
+            $this->rules = $rules;
+        }
+        
+        $this->addPath(
+            'parse',
+            $this->fixPath(dirname(__FILE__)) . 'Wiki/Parse/Default/'
+        );
+        
+        $this->addPath(
+            'render',
+            $this->fixPath(dirname(__FILE__)) . 'Wiki/Render/'
+        );
+        
+    }
+    
+    
+    /**
+    * 
+    * Set parser configuration for a specific rule and key.
+    * 
+    * @access public
+    * 
+    * @param string $rule The parse rule to set config for.
+    * 
+    * @param array|string $arg1 The full config array to use for the
+    * parse rule, or a conf key in that array.
+    * 
+    * @param string $arg2 The config value for the key.
+    * 
+    * @return void
+    *
+    */
+    
+    function setParseConf($rule, $arg1, $arg2 = null)
+    {
+        $rule = ucwords(strtolower($rule));
+        
+        if (! isset($this->parseConf[$rule])) {
+            $this->parseConf[$rule] = array();
+        }
+        
+        // if first arg is an array, use it as the entire
+        // conf array for the rule.  otherwise, treat arg1
+        // as a key and arg2 as a value for the rule conf.
+        if (is_array($arg1)) {
+            $this->parseConf[$rule] = $arg1;
+        } else {
+            $this->parseConf[$rule][$arg1] = $arg2;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Get parser configuration for a specific rule and key.
+    * 
+    * @access public
+    * 
+    * @param string $rule The parse rule to get config for.
+    * 
+    * @param string $key A key in the conf array; if null,
+    * returns the entire conf array.
+    * 
+    * @return mixed The whole conf array if no key is specified,
+    * or the specific conf key value.
+    *
+    */
+    
+    function getParseConf($rule, $key = null)
+    {
+        $rule = ucwords(strtolower($rule));
+        
+        // the rule does not exist
+        if (! isset($this->parseConf[$rule])) {
+            return null;
+        }
+        
+        // no key requested, return the whole array
+        if (is_null($key)) {
+            return $this->parseConf[$rule];
+        }
+        
+        // does the requested key exist?
+        if (isset($this->parseConf[$rule][$key])) {
+            // yes, return that value
+            return $this->parseConf[$rule][$key];
+        } else {
+            // no
+            return null;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Set renderer configuration for a specific format, rule, and key.
+    * 
+    * @access public
+    * 
+    * @param string $format The render format to set config for.
+    * 
+    * @param string $rule The render rule to set config for in the format.
+    * 
+    * @param array|string $arg1 The config array, or the config key
+    * within the render rule.
+    * 
+    * @param string $arg2 The config value for the key.
+    * 
+    * @return void
+    *
+    */
+    
+    function setRenderConf($format, $rule, $arg1, $arg2 = null)
+    {
+        $format = ucwords(strtolower($format));
+        $rule = ucwords(strtolower($rule));
+        
+        if (! isset($this->renderConf[$format])) {
+            $this->renderConf[$format] = array();
+        }
+        
+        if (! isset($this->renderConf[$format][$rule])) {
+            $this->renderConf[$format][$rule] = array();
+        }
+        
+        // if first arg is an array, use it as the entire
+        // conf array for the render rule.  otherwise, treat arg1
+        // as a key and arg2 as a value for the render rule conf.
+        if (is_array($arg1)) {
+            $this->renderConf[$format][$rule] = $arg1;
+        } else {
+            $this->renderConf[$format][$rule][$arg1] = $arg2;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Get renderer configuration for a specific format, rule, and key.
+    * 
+    * @access public
+    * 
+    * @param string $format The render format to get config for.
+    * 
+    * @param string $rule The render format rule to get config for.
+    * 
+    * @param string $key A key in the conf array; if null,
+    * returns the entire conf array.
+    * 
+    * @return mixed The whole conf array if no key is specified,
+    * or the specific conf key value.
+    *
+    */
+    
+    function getRenderConf($format, $rule, $key = null)
+    {
+        $format = ucwords(strtolower($format));
+        $rule = ucwords(strtolower($rule));
+        
+        if (! isset($this->renderConf[$format]) ||
+            ! isset($this->renderConf[$format][$rule])) {
+            return null;
+        }
+        
+        // no key requested, return the whole array
+        if (is_null($key)) {
+            return $this->renderConf[$format][$rule];
+        }
+        
+        // does the requested key exist?
+        if (isset($this->renderConf[$format][$rule][$key])) {
+            // yes, return that value
+            return $this->renderConf[$format][$rule][$key];
+        } else {
+            // no
+            return null;
+        }
+        
+    }
+    
+    /**
+    * 
+    * Set format configuration for a specific rule and key.
+    * 
+    * @access public
+    * 
+    * @param string $format The format to set config for.
+    * 
+    * @param string $key The config key within the format.
+    * 
+    * @param string $val The config value for the key.
+    * 
+    * @return void
+    *
+    */
+    
+    function setFormatConf($format, $arg1, $arg2 = null)
+    {
+        if (! is_array($this->formatConf[$format])) {
+            $this->formatConf[$format] = array();
+        }
+        
+        // if first arg is an array, use it as the entire
+        // conf array for the format.  otherwise, treat arg1
+        // as a key and arg2 as a value for the format conf.
+        if (is_array($arg1)) {
+            $this->formatConf[$format] = $arg1;
+        } else {
+            $this->formatConf[$format][$arg1] = $arg2;
+        }
+    }
+    
+    
+    
+    /**
+    * 
+    * Get configuration for a specific format and key.
+    * 
+    * @access public
+    * 
+    * @param string $format The format to get config for.
+    * 
+    * @param mixed $key A key in the conf array; if null,
+    * returns the entire conf array.
+    * 
+    * @return mixed The whole conf array if no key is specified,
+    * or the specific conf key value.
+    *
+    */
+    
+    function getFormatConf($format, $key = null)
+    {
+        // the format does not exist
+        if (! isset($this->formatConf[$format])) {
+            return null;
+        }
+        
+        // no key requested, return the whole array
+        if (is_null($key)) {
+            return $this->formatConf[$format];
+        }
+        
+        // does the requested key exist?
+        if (isset($this->formatConf[$format][$key])) {
+            // yes, return that value
+            return $this->formatConf[$format][$key];
+        } else {
+            // no
+            return null;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Inserts a rule into to the rule set.
+    * 
+    * @access public
+    * 
+    * @param string $name The name of the rule.  Should be different from
+    * all other keys in the rule set.
+    * 
+    * @param string $tgt The rule after which to insert this new rule.  By
+    * default (null) the rule is inserted at the end; if set to '', inserts
+    * at the beginning.
+    * 
+    * @return void
+    * 
+    */
+    
+    function insertRule($name, $tgt = null)
+    {
+        $name = ucwords(strtolower($name));
+        if (! is_null($tgt)) {
+            $tgt = ucwords(strtolower($tgt));
+        }
+        
+        // does the rule name to be inserted already exist?
+        if (in_array($name, $this->rules)) {
+            // yes, return
+            return null;
+        }
+        
+        // the target name is not null, and not '', but does not exist
+        // in the list of rules. this means we're trying to insert after
+        // a target key, but the target key isn't there.
+        if (! is_null($tgt) && $tgt != '' &&
+            ! in_array($tgt, $this->rules)) {
+            return false;
+        }
+        
+        // if $tgt is null, insert at the end.  We know this is at the
+        // end (instead of resetting an existing rule) becuase we exited
+        // at the top of this method if the rule was already in place.
+        if (is_null($tgt)) {
+            $this->rules[] = $name;
+            return true;
+        }
+        
+        // save a copy of the current rules, then reset the rule set
+        // so we can insert in the proper place later.
+        // where to insert the rule?
+        if ($tgt == '') {
+            // insert at the beginning
+            array_unshift($this->rules, $name);
+            return true;
+        }
+        
+        // insert after the named rule
+        $tmp = $this->rules;
+        $this->rules = array();
+        
+        foreach ($tmp as $val) {
+            $this->rules[] = $val;
+            if ($val == $tgt) {
+                $this->rules[] = $name;
+            }
+        }
+        
+        return true;
+        
+    }
+    
+    
+    /**
+    * 
+    * Delete (remove or unset) a rule from the $rules property.
+    * 
+    * @access public
+    * 
+    * @param string $rule The name of the rule to remove.
+    * 
+    * @return void
+    *     
+    */
+    
+    function deleteRule($name)
+    {
+        $name = ucwords(strtolower($name));
+        $key = array_search($name, $this->rules);
+        if ($key !== false) {
+            unset($this->rules[$key]);
+        }
+    }
+    
+    
+    /**
+    * 
+    * Change from one rule to another in-place.
+    * 
+    * @access public
+    * 
+    * @param string $old The name of the rule to change from.
+    * 
+    * @param string $new The name of the rule to change to.
+    * 
+    * @return void
+    *     
+    */
+    
+    function changeRule($old, $new)
+    {
+        $old = ucwords(strtolower($old));
+        $new = ucwords(strtolower($new));
+        $key = array_search($old, $this->rules);
+        if ($key !== false) {
+            $this->rules[$old] = $new;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Enables a rule so that it is applied when parsing.
+    * 
+    * @access public
+    * 
+    * @param string $rule The name of the rule to enable.
+    * 
+    * @return void
+    *     
+    */
+    
+    function enableRule($name)
+    {
+        $name = ucwords(strtolower($name));
+        $key = array_search($name, $this->disable);
+        if ($key !== false) {
+            unset($this->disable[$key]);
+        }
+    }
+    
+    
+    /**
+    * 
+    * Disables a rule so that it is not applied when parsing.
+    * 
+    * @access public
+    * 
+    * @param string $rule The name of the rule to disable.
+    * 
+    * @return void
+    *     
+    */
+    
+    function disableRule($name)
+    {
+        $name = ucwords(strtolower($name));
+        $key = array_search($name, $this->disable);
+        if ($key === false) {
+            $this->disable[] = $name;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Parses and renders the text passed to it, and returns the results.
+    * 
+    * First, the method parses the source text, applying rules to the
+    * text as it goes.  These rules will modify the source text
+    * in-place, replacing some text with delimited tokens (and
+    * populating the $this->tokens array as it goes).
+    * 
+    * Next, the method renders the in-place tokens into the requested
+    * output format.
+    * 
+    * Finally, the method returns the transformed text.  Note that the
+    * source text is transformed in place; once it is transformed, it is
+    * no longer the same as the original source text.
+    * 
+    * @access public
+    * 
+    * @param string $text The source text to which wiki rules should be
+    * applied, both for parsing and for rendering.
+    * 
+    * @param string $format The target output format, typically 'xhtml'.
+    *  If a rule does not support a given format, the output from that
+    * rule is rule-specific.
+    * 
+    * @return string The transformed wiki text.
+    * 
+    */
+    
+    function transform($text, $format = 'Xhtml')
+    {
+        $this->parse($text);
+        return $this->render($format);
+    }
+    
+    
+    /**
+    * 
+    * Sets the $_source text property, then parses it in place and
+    * retains tokens in the $_tokens array property.
+    * 
+    * @access public
+    * 
+    * @param string $text The source text to which wiki rules should be
+    * applied, both for parsing and for rendering.
+    * 
+    * @return void
+    * 
+    */
+    
+    function parse($text)
+    {
+        // set the object property for the source text
+        $this->source = $text;
+        
+        // reset the tokens.
+        $this->tokens = array();
+        
+        // apply the parse() method of each requested rule to the source
+        // text.
+        foreach ($this->rules as $name) {
+            // do not parse the rules listed in $disable
+            if (! in_array($name, $this->disable)) {
+                
+                // load the parsing object
+                $this->loadParseObj($name);
+                
+                // load may have failed; only parse if
+                // an object is in the array now
+                if (is_object($this->parseObj[$name])) {
+                    $this->parseObj[$name]->parse();
+                }
+            }
+        }
+    }
+    
+    
+    /**
+    * 
+    * Renders tokens back into the source text, based on the requested format.
+    * 
+    * @access public
+    * 
+    * @param string $format The target output format, typically 'xhtml'. 
+    * If a rule does not support a given format, the output from that
+    * rule is rule-specific.
+    * 
+    * @return string The transformed wiki text.
+    * 
+    */
+    
+    function render($format = 'Xhtml')
+    {
+        // the rendering method we're going to use from each rule
+        $format = ucwords(strtolower($format));
+        
+        // the eventual output text
+        $output = '';
+        
+        // when passing through the parsed source text, keep track of when
+        // we are in a delimited section
+        $in_delim = false;
+        
+        // when in a delimited section, capture the token key number
+        $key = '';
+        
+        // load the format object
+        $this->loadFormatObj($format);
+        
+        // pre-rendering activity
+        if (is_object($this->formatObj[$format])) {
+            $output .= $this->formatObj[$format]->pre();
+        }
+        
+        // load the render objects
+        foreach (array_keys($this->parseObj) as $rule) {
+            $this->loadRenderObj($format, $rule);
+        }
+        
+        // pass through the parsed source text character by character
+        $k = strlen($this->source);
+        for ($i = 0; $i < $k; $i++) {
+            
+            // the current character
+            $char = $this->source{$i};
+            
+            // are alredy in a delimited section?
+            if ($in_delim) {
+            
+                // yes; are we ending the section?
+                if ($char == $this->delim) {
+                    
+                    // yes, get the replacement text for the delimited
+                    // token number and unset the flag.
+                    $key = (int)$key;
+                    $rule = $this->tokens[$key][0];
+                    $opts = $this->tokens[$key][1];
+                    $output .= $this->renderObj[$rule]->token($opts);
+                    $in_delim = false;
+                    
+                } else {
+                
+                    // no, add to the dlimited token key number
+                    $key .= $char;
+                    
+                }
+                
+            } else {
+                
+                // not currently in a delimited section.
+                // are we starting into a delimited section?
+                if ($char == $this->delim) {
+                    // yes, reset the previous key and
+                    // set the flag.
+                    $key = '';
+                    $in_delim = true;
+                } else {
+                    // no, add to the output as-is
+                    $output .= $char;
+                }
+            }
+        }
+        
+        // post-rendering activity
+        if (is_object($this->formatObj[$format])) {
+            $output .= $this->formatObj[$format]->post();
+        }
+        
+        // return the rendered source text.
+        return $output;
+    }
+    
+    
+    /**
+    * 
+    * Returns the parsed source text with delimited token placeholders.
+    * 
+    * @access public
+    * 
+    * @return string The parsed source text.
+    * 
+    */
+    
+    function getSource()
+    {
+        return $this->source;
+    }
+    
+    
+    /**
+    * 
+    * Returns tokens that have been parsed out of the source text.
+    * 
+    * @access public
+    * 
+    * @param array $rules If an array of rule names is passed, only return
+    * tokens matching these rule names.  If no array is passed, return all
+    * tokens.
+    * 
+    * @return array An array of tokens.
+    * 
+    */
+    
+    function getTokens($rules = null)
+    {
+        if (is_null($rules)) {
+            return $this->tokens;
+        } else {
+            settype($rules, 'array');
+            $result = array();
+            foreach ($this->tokens as $key => $val) {
+                if (in_array($val[0], $rules)) {
+                    $result[] = $val;
+                }
+            }
+            return $result;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Add a token to the Text_Wiki tokens array, and return a delimited
+    * token number.
+    * 
+    * @access public
+    * 
+    * @param array $options An associative array of options for the new
+    * token array element.  The keys and values are specific to the
+    * rule, and may or may not be common to other rule options.  Typical
+    * options keys are 'text' and 'type' but may include others.
+    * 
+    * @param boolean $id_only If true, return only the token number, not
+    * a delimited token string.
+    * 
+    * @return string|int By default, return the number of the
+    * newly-created token array element with a delimiter prefix and
+    * suffix; however, if $id_only is set to true, return only the token
+    * number (no delimiters).
+    * 
+    */
+    
+    function addToken($rule, $options = array(), $id_only = false)
+    {
+        // increment the token ID number.  note that if you parse
+        // multiple times with the same Text_Wiki object, the ID number
+        // will not reset to zero.
+        static $id;
+        if (! isset($id)) {
+            $id = 0;
+        } else {
+            $id ++;
+        }
+        
+        // force the options to be an array
+        settype($options, 'array');
+        
+        // add the token
+        $this->tokens[$id] = array(
+            0 => $rule,
+            1 => $options
+        );
+        
+        // return a value
+        if ($id_only) {
+            // return the last token number
+            return $id;
+        } else {
+            // return the token number with delimiters
+            return $this->delim . $id . $this->delim;
+        }
+    }
+    
+    
+    /**
+    * 
+    * Set or re-set a token with specific information, overwriting any
+    * previous rule name and rule options.
+    * 
+    * @access public
+    * 
+    * @param int $id The token number to reset.
+    * 
+    * @param int $rule The rule name to use.
+    * 
+    * @param array $options An associative array of options for the
+    * token array element.  The keys and values are specific to the
+    * rule, and may or may not be common to other rule options.  Typical
+    * options keys are 'text' and 'type' but may include others.
+    * 
+    * @return void
+    * 
+    */
+    
+    function setToken($id, $rule, $options = array())
+    {
+        // reset the token
+        $this->tokens[$id] = array(
+            0 => $rule,
+            1 => $options
+        );
+    }
+    
+    
+    /**
+    * 
+    * Load a rule parser class file.
+    * 
+    * @access public
+    * 
+    * @return bool True if loaded, false if not.
+    * 
+    */
+    
+    function loadParseObj($rule)
+    {
+        $rule = ucwords(strtolower($rule));
+        $file = $rule . '.php';
+        $class = "Text_Wiki_Parse_$rule";
+        
+        if (! class_exists($class)) {
+            $loc = $this->findFile('parse', $file);
+            if ($loc) {
+                // found the class
+                include_once $loc;
+            } else {
+                // can't find the class
+                $this->parseObj[$rule] = null;
+                return false;
+            }
+        }
+        
+        $this->parseObj[$rule] =& new $class($this);
+
+    }
+    
+    
+    /**
+    * 
+    * Load a rule-render class file.
+    * 
+    * @access public
+    * 
+    * @return bool True if loaded, false if not.
+    * 
+    */
+    
+    function loadRenderObj($format, $rule)
+    {
+        $format = ucwords(strtolower($format));
+        $rule = ucwords(strtolower($rule));
+        $file = "$format/$rule.php";
+        $class = "Text_Wiki_Render_$format" . "_$rule";
+        
+        if (! class_exists($class)) {
+            // load the class
+            $loc = $this->findFile('render', $file);
+            if ($loc) {
+                // found the class
+                include_once $loc;
+            } else {
+                // can't find the class
+                return false;
+            }
+        }
+        
+        $this->renderObj[$rule] =& new $class($this);
+    }
+    
+    
+    /**
+    * 
+    * Load a format-render class file.
+    * 
+    * @access public
+    * 
+    * @return bool True if loaded, false if not.
+    * 
+    */
+    
+    function loadFormatObj($format)
+    {
+        $format = ucwords(strtolower($format));
+        $file = $format . '.php';
+        $class = "Text_Wiki_Render_$format";
+        
+        if (! class_exists($class)) {
+            $loc = $this->findFile('render', $file);
+            if ($loc) {
+                // found the class
+                include_once $loc;
+            } else {
+                // can't find the class
+                return false;
+            }
+        }
+        
+        $this->formatObj[$format] =& new $class($this);
+    }
+    
+    
+    /**
+    * 
+    * Add a path to a path array.
+    * 
+    * @access public
+    * 
+    * @param string $type The path-type to add (parse or render).
+    * 
+    * @param string $dir The directory to add to the path-type.
+    * 
+    * @return void
+    * 
+    */
+    
+    function addPath($type, $dir)
+    {
+        $dir = $this->fixPath($dir);
+        if (! isset($this->path[$type])) {
+            $this->path[$type] = array($dir);
+        } else {
+            array_unshift($this->path[$type], $dir);
+        }
+    }
+    
+    
+    /**
+    * 
+    * Get the current path array for a path-type.
+    * 
+    * @access public
+    * 
+    * @param string $type The path-type to look up (plugin, filter, or
+    * template).  If not set, returns all path types.
+    * 
+    * @return array The array of paths for the requested type.
+    * 
+    */
+    
+    function getPath($type = null)
+    {
+        if (is_null($type)) {
+            return $this->path;
+        } elseif (! isset($this->path[$type])) {
+            return array();
+        } else {
+            return $this->path[$type];
+        }
+    }
+    
+    
+    /**
+    * 
+    * Searches a series of paths for a given file.
+    * 
+    * @param array $type The type of paths to search (template, plugin,
+    * or filter).
+    * 
+    * @param string $file The file name to look for.
+    * 
+    * @return string|bool The full path and file name for the target file,
+    * or boolean false if the file is not found in any of the paths.
+    *
+    */
+    
+    function findFile($type, $file)
+    {
+        // get the set of paths
+        $set = $this->getPath($type);
+        
+        // start looping through them
+        foreach ($set as $path) {
+            $fullname = $path . $file;
+            if (file_exists($fullname) && is_readable($fullname)) {
+                return $fullname;
+            }
+        }
+        
+        // could not find the file in the set of paths
+        return false;
+    }
+    
+    
+    /**
+    * 
+    * Append a trailing '/' to paths, unless the path is empty.
+    * 
+    * @access private
+    * 
+    * @param string $path The file path to fix
+    * 
+    * @return string The fixed file path
+    * 
+    */
+    
+    function fixPath($path)
+    {
+        $len = strlen($this->_dirSep);
+        
+        if (! empty($path) &&
+            substr($path, -1 * $len, $len) != $this->_dirSep)    {
+            return $path . $this->_dirSep;
+        } else {
+            return $path;
+        }
+    }
+}
+
+?>
\ No newline at end of file

Deleted: plugins/trunk/textparser/class/data/Wiki.php
===================================================================
--- plugins/trunk/textparser/class/data/Wiki.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/Wiki.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -1,1260 +0,0 @@
-<?php
-
-/**
-* The baseline abstract parser class.
-*/
-
-define( "TEXT_WIKI_BASE_INCLUDE_DIR", PLOG_CLASS_PATH."plugins/textparser/class/data/" );
-
-require_once TEXT_WIKI_BASE_INCLUDE_DIR.'Wiki/Parse.php';
-
-/**
-* The baseline abstract render class.
-*/
-
-require_once TEXT_WIKI_BASE_INCLUDE_DIR.'Wiki/Render.php';
-
-/**
-* 
-* Parse structured wiki text and render into arbitrary formats such as XHTML.
-* 
-* This is the "master" class for handling the management and convenience
-* functions to transform Wiki-formatted text.
-* 
-* $Id: Wiki.php,v 1.16 2004/07/20 15:55:43 pmjones Exp $
-* 
-* @author Paul M. Jones <pmjones at ciaweb.net>
-* 
-* @package Text_Wiki
-* 
-* @version 0.20.1 alpha
-* 
-*/
-
-class Text_Wiki {
-	
-	/**
-	* 
-	* The default list of rules, in order, to apply to the source text.
-	* 
-	* @access public
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $rules = array(
-		'Prefilter',
-		'Delimiter',
-		'Code',
-		'Html',
-		'Raw',
-		'Include',
-		'Embed',
-		'Anchor',
-		'Heading',
-		'Toc',
-		'Horiz',
-		'Break',
-		'Blockquote',
-		'List',
-		'Deflist',
-		'Table',
-		'Image',
-		'Phplookup',
-		'Newline',
-		'Center',
-		'Paragraph',
-		'Url',
-		'Freelink',
-		'Interwiki',
-		'Wikilink',
-		'Colortext',
-		'Strong',
-		'Bold',
-		'Emphasis',
-		'Italic',
-		'Tt',
-		'Superscript',
-		'Revise',
-		'Tighten',
-		'Translatehtml'
-	);
-	
-	
-	/**
-	* 
-	* The list of rules to not-apply to the source text.
-	* 
-	* @access public
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $disable = array(
-		'Html',
-		'Include',
-		'Embed'
-	);
-	
-	
-	/**
-	* 
-	* Custom configuration for rules at the parsing stage.
-	*
-	* In this array, the key is the parsing rule name, and the value is
-	* an array of key-value configuration pairs corresponding to the $conf
-	* property in the target parsing rule.
-	* 
-	* For example:
-	* 
-	* <code>
-	* $parseConf = array(
-	*     'Include' => array(
-	*         'base' => '/path/to/scripts/'
-	*     )
-	* );
-	* </code>
-	* 
-	* Note that most default rules do not need any parsing configuration.
-	* 
-	* @access public
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $parseConf = array();
-	
-	
-	/**
-	* 
-	* Custom configuration for rules at the rendering stage.
-	*
-	* Because rendering may be different for each target format, the
-	* first-level element in this array is always a format name (e.g.,
-	* 'Xhtml').
-	* 
-	* Within that first level element, the subsequent elements match the
-	* $parseConf format. That is, the sub-key is the rendering rule name,
-	* and the sub-value is an array of key-value configuration pairs
-	* corresponding to the $conf property in the target rendering rule.
-	* 
-	* @access public
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $renderConf = array(
-		'Docbook' => array(),
-		'Latex' => array(),
-		'Pdf' => array(),
-		'Plain' => array(),
-		'Rtf' => array(),
-		'Xhtml' => array()
-	);
-	
-	
-	/**
-	* 
-	* Custom configuration for the output format itself.
-	*
-	* Even though Text_Wiki will render the tokens from parsed text,
-	* the format itself may require some configuration.  For example,
-	* RTF needs to know font names and sizes, PDF requires page layout
-	* information, and DocBook needs a section hierarchy.  This array
-	* matches the $conf property of the the format-level renderer
-	* (e.g., Text_Wiki_Render_Xhtml).
-	* 
-	* In this array, the key is the rendering format name, and the value is
-	* an array of key-value configuration pairs corresponding to the $conf
-	* property in the rendering format rule.
-	* 
-	* @access public
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $formatConf = array(
-		'Docbook' => array(),
-		'Latex' => array(),
-		'Pdf' => array(),
-		'Plain' => array(),
-		'Rtf' => array(),
-		'Xhtml' => array()
-	);
-	
-	
-	/**
-	* 
-	* The delimiter for token numbers of parsed elements in source text.
-	* 
-	* @access public
-	* 
-	* @var string
-	* 
-	*/
-	
-	var $delim = "\xFF"; 
-	
-	
-	/**
-	* 
-	* The tokens generated by rules as the source text is parsed.
-	* 
-	* As Text_Wiki applies rule classes to the source text, it will
-	* replace portions of the text with a delimited token number.  This
-	* is the array of those tokens, representing the replaced text and
-	* any options set by the parser for that replaced text.
-	* 
-	* The tokens array is sequential; each element is itself a sequential
-	* array where element 0 is the name of the rule that generated the
-	* token, and element 1 is an associative array where the key is an
-	* option name and the value is an option value.
-	* 
-	* @access private
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $tokens = array();
-	
-	
-	/**
-	* 
-	* The source text to which rules will be applied.
-	* 
-	* This text will be transformed in-place, which means that it will
-	* change as the rules are applied.
-	* 
-	* @access private
-	* 
-	* @var string
-	* 
-	*/
-	
-	var $source = '';
-	
-	
-	/**
-	* 
-	* Array of rule parsers.
-	* 
-	* Text_Wiki creates one instance of every rule that is applied to
-	* the source text; this array holds those instances.  The array key
-	* is the rule name, and the array value is an instance of the rule
-	* class.
-	* 
-	* @access private
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $parseObj = array();
-	
-	
-	/**
-	* 
-	* Array of rule renderers.
-	* 
-	* Text_Wiki creates one instance of every rule that is applied to
-	* the source text; this array holds those instances.  The array key
-	* is the rule name, and the array value is an instance of the rule
-	* class.
-	* 
-	* @access private
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $renderObj = array();
-	
-	
-	/**
-	* 
-	* Array of format renderers.
-	* 
-	* @access private
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $formatObj = array();
-	
-	
-	/**
-	* 
-	* Array of paths to search, in order, for parsing and rendering rules.
-	* 
-	* @access private
-	* 
-	* @var array
-	* 
-	*/
-	
-	var $path = array(
-		'parse' => array(),
-		'render' => array()
-	);
-	
-	
-	
-	/**
-	* 
-	* The directory separator character.
-	* 
-	* @access private
-	* 
-	* @var string
-	* 
-	*/
-	
-	var $_dirSep = DIRECTORY_SEPARATOR;
-	
-	
-	/**
-	* 
-	* Constructor.
-	* 
-	* @access public
-	* 
-	* @param array $rules The set of rules to load for this object.
-	*	 
-	*/
-	
-	function Text_Wiki($rules = null)
-	{
-		if (is_array($rules)) {
-			$this->rules = $rules;
-		}
-		
-		$this->addPath(
-			'parse',
-			$this->fixPath(dirname(__FILE__)) . 'Wiki/Parse/'
-		);
-		
-		$this->addPath(
-			'render',
-			$this->fixPath(dirname(__FILE__)) . 'Wiki/Render/'
-		);
-		
-	}
-	
-	
-	/**
-	* 
-	* Set parser configuration for a specific rule and key.
-	* 
-	* @access public
-	* 
-	* @param string $rule The parse rule to set config for.
-	* 
-	* @param array|string $arg1 The full config array to use for the
-	* parse rule, or a conf key in that array.
-	* 
-	* @param string $arg2 The config value for the key.
-	* 
-	* @return void
-	*
-	*/
-	
-	function setParseConf($rule, $arg1, $arg2 = null)
-	{
-		$rule = ucwords(strtolower($rule));
-		
-		if (! isset($this->parseConf[$rule])) {
-			$this->parseConf[$rule] = array();
-		}
-		
-		// if first arg is an array, use it as the entire
-		// conf array for the rule.  otherwise, treat arg1
-		// as a key and arg2 as a value for the rule conf.
-		if (is_array($arg1)) {
-			$this->parseConf[$rule] = $arg1;
-		} else {
-			$this->parseConf[$rule][$arg1] = $arg2;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Get parser configuration for a specific rule and key.
-	* 
-	* @access public
-	* 
-	* @param string $rule The parse rule to get config for.
-	* 
-	* @param string $key A key in the conf array; if null,
-	* returns the entire conf array.
-	* 
-	* @return mixed The whole conf array if no key is specified,
-	* or the specific conf key value.
-	*
-	*/
-	
-	function getParseConf($rule, $key = null)
-	{
-		$rule = ucwords(strtolower($rule));
-		
-		// the rule does not exist
-		if (isset($this->parseConf[$rule])) {
-			return null;
-		}
-		
-		// no key requested, return the whole array
-		if (is_null($key)) {
-			return $this->parseConf[$rule];
-		}
-		
-		// does the requested key exist?
-		if (isset($this->parseConf[$rule][$key])) {
-			// yes, return that value
-			return $this->parseConf[$rule][$key];
-		} else {
-			// no
-			return null;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Set renderer configuration for a specific format, rule, and key.
-	* 
-	* @access public
-	* 
-	* @param string $format The render format to set config for.
-	* 
-	* @param string $rule The render rule to set config for in the format.
-	* 
-	* @param array|string $arg1 The config array, or the config key
-	* within the render rule.
-	* 
-	* @param string $arg2 The config value for the key.
-	* 
-	* @return void
-	*
-	*/
-	
-	function setRenderConf($format, $rule, $arg1, $arg2 = null)
-	{
-		$format = ucwords(strtolower($format));
-		$rule = ucwords(strtolower($rule));
-		
-		if (! isset($this->renderConf[$format])) {
-			$this->renderConf[$format] = array();
-		}
-		
-		if (! isset($this->renderConf[$format][$rule])) {
-			$this->renderConf[$format][$rule] = array();
-		}
-		
-		// if first arg is an array, use it as the entire
-		// conf array for the render rule.  otherwise, treat arg1
-		// as a key and arg2 as a value for the render rule conf.
-		if (is_array($arg1)) {
-			$this->renderConf[$format][$rule] = $arg1;
-		} else {
-			$this->renderConf[$format][$rule][$arg1] = $arg2;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Get renderer configuration for a specific format, rule, and key.
-	* 
-	* @access public
-	* 
-	* @param string $format The render format to get config for.
-	* 
-	* @param string $rule The render format rule to get config for.
-	* 
-	* @param string $key A key in the conf array; if null,
-	* returns the entire conf array.
-	* 
-	* @return mixed The whole conf array if no key is specified,
-	* or the specific conf key value.
-	*
-	*/
-	
-	function getRenderConf($format, $rule, $key = null)
-	{
-		$format = ucwords(strtolower($format));
-		$rule = ucwords(strtolower($rule));
-		
-		if (! isset($this->renderConf[$format]) ||
-			! isset($this->renderConf[$format][$rule])) {
-			return;
-		}
-		
-		// no key requested, return the whole array
-		if (is_null($key)) {
-			return $this->renderConf[$format][$rule];
-		}
-		
-		// does the requested key exist?
-		if (isset($this->renderConf[$format][$rule][$key])) {
-			// yes, return that value
-			return $this->renderConf[$format][$rule][$key];
-		} else {
-			// no
-			return null;
-		}
-		
-	}
-	
-	/**
-	* 
-	* Set format configuration for a specific rule and key.
-	* 
-	* @access public
-	* 
-	* @param string $format The format to set config for.
-	* 
-	* @param string $key The config key within the format.
-	* 
-	* @param string $val The config value for the key.
-	* 
-	* @return void
-	*
-	*/
-	
-	function setFormatConf($format, $arg1, $arg2 = null)
-	{
-		if (! is_array($this->formatConf[$format])) {
-			$this->formatConf[$format] = array();
-		}
-		
-		// if first arg is an array, use it as the entire
-		// conf array for the format.  otherwise, treat arg1
-		// as a key and arg2 as a value for the format conf.
-		if (is_array($arg1)) {
-			$this->formatConf[$format] = $arg1;
-		} else {
-			$this->formatConf[$format][$arg1] = $arg2;
-		}
-	}
-	
-	
-	
-	/**
-	* 
-	* Get configuration for a specific format and key.
-	* 
-	* @access public
-	* 
-	* @param string $format The format to get config for.
-	* 
-	* @param mixed $key A key in the conf array; if null,
-	* returns the entire conf array.
-	* 
-	* @return mixed The whole conf array if no key is specified,
-	* or the specific conf key value.
-	*
-	*/
-	
-	function getFormatConf($format, $key = null)
-	{
-		// the format does not exist
-		if (isset($this->formatConf[$format])) {
-			return null;
-		}
-		
-		// no key requested, return the whole array
-		if (is_null($key)) {
-			return $this->formatConf[$format];
-		}
-		
-		// does the requested key exist?
-		if (isset($this->formatConf[$format][$key])) {
-			// yes, return that value
-			return $this->formatConf[$format][$key];
-		} else {
-			// no
-			return null;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Inserts a rule into to the rule set.
-	* 
-	* @access public
-	* 
-	* @param string $name The name of the rule.  Should be different from
-	* all other keys in the rule set.
-	* 
-	* @param string $tgt The rule after which to insert this new rule.  By
-	* default (null) the rule is inserted at the end; if set to '', inserts
-	* at the beginning.
-	* 
-	* @return void
-	* 
-	*/
-	
-	function insertRule($name, $tgt = null)
-	{
-		$name = ucwords(strtolower($name));
-		if (! is_null($tgt)) {
-			$tgt = ucwords(strtolower($tgt));
-		}
-		
-		// does the rule name to be inserted already exist?
-		if (in_array($name, $this->rules)) {
-			// yes, return
-			return null;
-		}
-		
-		// the target name is not null, and not '', but does not exist
-		// in the list of rules. this means we're trying to insert after
-		// a target key, but the target key isn't there.
-		if (! is_null($tgt) && $tgt != '' &&
-			! in_array($tgt, $this->rules)) {
-			return false;
-		}
-		
-		// if $tgt is null, insert at the end.  We know this is at the
-		// end (instead of resetting an existing rule) becuase we exited
-		// at the top of this method if the rule was already in place.
-		if (is_null($tgt)) {
-			$this->rules[] = $name;
-			return true;
-		}
-		
-		// save a copy of the current rules, then reset the rule set
-		// so we can insert in the proper place later.
-		// where to insert the rule?
-		if ($tgt == '') {
-			// insert at the beginning
-			array_unshift($this->rules, $name);
-			return true;
-		}
-		
-		// insert after the named rule
-		$tmp = $this->rules;
-		$this->rules = array();
-		
-		foreach ($tmp as $val) {
-			$this->rules[] = $val;
-			if ($val == $tgt) {
-				$this->rules[] = $name;
-			}
-		}
-		
-		return true;
-		
-	}
-	
-	
-	/**
-	* 
-	* Delete (remove or unset) a rule from the $rules property.
-	* 
-	* @access public
-	* 
-	* @param string $rule The name of the rule to remove.
-	* 
-	* @return void
-	*	 
-	*/
-	
-	function deleteRule($name)
-	{
-		$name = ucwords(strtolower($name));
-		$key = array_search($name, $this->rules);
-		if ($key !== false) {
-			unset($this->rules[$key]);
-		}
-	}
-	
-	
-	/**
-	* 
-	* Change from one rule to another in-place.
-	* 
-	* @access public
-	* 
-	* @param string $old The name of the rule to change from.
-	* 
-	* @param string $new The name of the rule to change to.
-	* 
-	* @return void
-	*	 
-	*/
-	
-	function changeRule($old, $new)
-	{
-		$old = ucwords(strtolower($old));
-		$new = ucwords(strtolower($new));
-		$key = array_search($old, $this->rules);
-		if ($key !== false) {
-			$this->rules[$old] = $new;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Enables a rule so that it is applied when parsing.
-	* 
-	* @access public
-	* 
-	* @param string $rule The name of the rule to enable.
-	* 
-	* @return void
-	*	 
-	*/
-	
-	function enableRule($name)
-	{
-		$name = ucwords(strtolower($name));
-		$key = array_search($name, $this->disable);
-		if ($key !== false) {
-			unset($this->disable[$key]);
-		}
-	}
-	
-	
-	/**
-	* 
-	* Disables a rule so that it is not applied when parsing.
-	* 
-	* @access public
-	* 
-	* @param string $rule The name of the rule to disable.
-	* 
-	* @return void
-	*	 
-	*/
-	
-	function disableRule($name)
-	{
-		$name = ucwords(strtolower($name));
-		$key = array_search($name, $this->disable);
-		if ($key === false) {
-			$this->disable[] = $name;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Parses and renders the text passed to it, and returns the results.
-	* 
-	* First, the method parses the source text, applying rules to the
-	* text as it goes.  These rules will modify the source text
-	* in-place, replacing some text with delimited tokens (and
-	* populating the $this->tokens array as it goes).
-	* 
-	* Next, the method renders the in-place tokens into the requested
-	* output format.
-	* 
-	* Finally, the method returns the transformed text.  Note that the
-	* source text is transformed in place; once it is transformed, it is
-	* no longer the same as the original source text.
-	* 
-	* @access public
-	* 
-	* @param string $text The source text to which wiki rules should be
-	* applied, both for parsing and for rendering.
-	* 
-	* @param string $format The target output format, typically 'xhtml'.
-	*  If a rule does not support a given format, the output from that
-	* rule is rule-specific.
-	* 
-	* @return string The transformed wiki text.
-	* 
-	*/
-	
-	function transform($text, $format = 'Xhtml')
-	{
-		$this->parse($text);
-		return $this->render($format);
-	}
-	
-	
-	/**
-	* 
-	* Sets the $_source text property, then parses it in place and
-	* retains tokens in the $_tokens array property.
-	* 
-	* @access public
-	* 
-	* @param string $text The source text to which wiki rules should be
-	* applied, both for parsing and for rendering.
-	* 
-	* @return void
-	* 
-	*/
-	
-	function parse($text)
-	{
-		// set the object property for the source text
-		$this->source = $text;
-		
-		// reset the tokens.
-		$this->tokens = array();
-		
-		// apply the parse() method of each requested rule to the source
-		// text.
-		foreach ($this->rules as $name) {
-			// do not parse the rules listed in $disable
-			if (! in_array($name, $this->disable)) {
-				
-				// load the parsing object
-				$this->loadParseObj($name);
-				
-				// load may have failed; only parse if
-				// an object is in the array now
-				if (is_object($this->parseObj[$name])) {
-					$this->parseObj[$name]->parse();
-				}
-			}
-		}
-	}
-	
-	
-	/**
-	* 
-	* Renders tokens back into the source text, based on the requested format.
-	* 
-	* @access public
-	* 
-	* @param string $format The target output format, typically 'xhtml'. 
-	* If a rule does not support a given format, the output from that
-	* rule is rule-specific.
-	* 
-	* @return string The transformed wiki text.
-	* 
-	*/
-	
-	function render($format = 'Xhtml')
-	{
-		// the rendering method we're going to use from each rule
-		$format = ucwords(strtolower($format));
-		
-		// the eventual output text
-		$output = '';
-		
-		// when passing through the parsed source text, keep track of when
-		// we are in a delimited section
-		$in_delim = false;
-		
-		// when in a delimited section, capture the token key number
-		$key = '';
-		
-		// load the format object
-		$this->loadFormatObj($format);
-		
-		// pre-rendering activity
-		if (is_object($this->formatObj[$format])) {
-			$output .= $this->formatObj[$format]->pre();
-		}
-		
-		// load the render objects
-		foreach (array_keys($this->parseObj) as $rule) {
-			$this->loadRenderObj($format, $rule);
-		}
-		
-		// pass through the parsed source text character by character
-		$k = strlen($this->source);
-		for ($i = 0; $i < $k; $i++) {
-			
-			// the current character
-			$char = $this->source{$i};
-			
-			// are alredy in a delimited section?
-			if ($in_delim) {
-			
-				// yes; are we ending the section?
-				if ($char == $this->delim) {
-					
-					// yes, get the replacement text for the delimited
-					// token number and unset the flag.
-					$key = (int)$key;
-					$rule = $this->tokens[$key][0];
-					$opts = $this->tokens[$key][1];
-					$output .= $this->renderObj[$rule]->token($opts);
-					$in_delim = false;
-					
-				} else {
-				
-					// no, add to the dlimited token key number
-					$key .= $char;
-					
-				}
-				
-			} else {
-				
-				// not currently in a delimited section.
-				// are we starting into a delimited section?
-				if ($char == $this->delim) {
-					// yes, reset the previous key and
-					// set the flag.
-					$key = '';
-					$in_delim = true;
-				} else {
-					// no, add to the output as-is
-					$output .= $char;
-				}
-			}
-		}
-		
-		// post-rendering activity
-		if (is_object($this->formatObj[$format])) {
-			$output .= $this->formatObj[$format]->post();
-		}
-		
-		// return the rendered source text.
-		return $output;
-	}
-	
-	
-	/**
-	* 
-	* Returns the parsed source text with delimited token placeholders.
-	* 
-	* @access public
-	* 
-	* @return string The parsed source text.
-	* 
-	*/
-	
-	function getSource()
-	{
-		return $this->source;
-	}
-	
-	
-	/**
-	* 
-	* Returns tokens that have been parsed out of the source text.
-	* 
-	* @access public
-	* 
-	* @param array $rules If an array of rule names is passed, only return
-	* tokens matching these rule names.  If no array is passed, return all
-	* tokens.
-	* 
-	* @return array An array of tokens.
-	* 
-	*/
-	
-	function getTokens($rules = null)
-	{
-		if (is_null($rules)) {
-			return $this->tokens;
-		} else {
-			settype($rules, 'array');
-			$result = array();
-			foreach ($this->tokens as $key => $val) {
-				if (in_array($val[0], $rules)) {
-					$result[] = $val;
-				}
-			}
-			return $result;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Add a token to the Text_Wiki tokens array, and return a delimited
-	* token number.
-	* 
-	* @access public
-	* 
-	* @param array $options An associative array of options for the new
-	* token array element.  The keys and values are specific to the
-	* rule, and may or may not be common to other rule options.  Typical
-	* options keys are 'text' and 'type' but may include others.
-	* 
-	* @param boolean $id_only If true, return only the token number, not
-	* a delimited token string.
-	* 
-	* @return string|int By default, return the number of the
-	* newly-created token array element with a delimiter prefix and
-	* suffix; however, if $id_only is set to true, return only the token
-	* number (no delimiters).
-	* 
-	*/
-	
-	function addToken($rule, $options = array(), $id_only = false)
-	{
-		// increment the token ID number.  note that if you parse
-		// multiple times with the same Text_Wiki object, the ID number
-		// will not reset to zero.
-		static $id;
-		if (! isset($id)) {
-			$id = 0;
-		} else {
-			$id ++;
-		}
-		
-		// force the options to be an array
-		settype($options, 'array');
-		
-		// add the token
-		$this->tokens[$id] = array(
-			0 => $rule,
-			1 => $options
-		);
-		
-		// return a value
-		if ($id_only) {
-			// return the last token number
-			return $id;
-		} else {
-			// return the token number with delimiters
-			return $this->delim . $id . $this->delim;
-		}
-	}
-	
-	
-	/**
-	* 
-	* Set or re-set a token with specific information, overwriting any
-	* previous rule name and rule options.
-	* 
-	* @access public
-	* 
-	* @param int $id The token number to reset.
-	* 
-	* @param int $rule The rule name to use.
-	* 
-	* @param array $options An associative array of options for the
-	* token array element.  The keys and values are specific to the
-	* rule, and may or may not be common to other rule options.  Typical
-	* options keys are 'text' and 'type' but may include others.
-	* 
-	* @return void
-	* 
-	*/
-	
-	function setToken($id, $rule, $options = array())
-	{
-		// reset the token
-		$this->tokens[$id] = array(
-			0 => $rule,
-			1 => $options
-		);
-	}
-	
-	
-	/**
-	* 
-	* Load a rule parser class file.
-	* 
-	* @access public
-	* 
-	* @return bool True if loaded, false if not.
-	* 
-	*/
-	
-	function loadParseObj($rule)
-	{
-		$rule = ucwords(strtolower($rule));
-		$file = $rule . '.php';
-		$class = "Text_Wiki_Parse_$rule";
-		
-		if (! class_exists($class)) {
-			$loc = $this->findFile('parse', $file);
-			if ($loc) {
-				// found the class
-				include_once $loc;
-			} else {
-				// can't find the class
-				$this->parseObj[$rule] = null;
-				return false;
-			}
-		}
-		
-		$this->parseObj[$rule] =& new $class($this);
-
-	}
-	
-	
-	/**
-	* 
-	* Load a rule-render class file.
-	* 
-	* @access public
-	* 
-	* @return bool True if loaded, false if not.
-	* 
-	*/
-	
-	function loadRenderObj($format, $rule)
-	{
-		$format = ucwords(strtolower($format));
-		$rule = ucwords(strtolower($rule));
-		$file = "$format/$rule.php";
-		$class = "Text_Wiki_Render_$format" . "_$rule";
-		
-		if (! class_exists($class)) {
-			// load the class
-			$loc = $this->findFile('render', $file);
-			if ($loc) {
-				// found the class
-				include_once $loc;
-			} else {
-				// can't find the class
-				return false;
-			}
-		}
-		
-		$this->renderObj[$rule] =& new $class($this);
-	}
-	
-	
-	/**
-	* 
-	* Load a format-render class file.
-	* 
-	* @access public
-	* 
-	* @return bool True if loaded, false if not.
-	* 
-	*/
-	
-	function loadFormatObj($format)
-	{
-		$format = ucwords(strtolower($format));
-		$file = $format . '.php';
-		$class = "Text_Wiki_Render_$format";
-		
-		if (! class_exists($class)) {
-			$loc = $this->findFile('render', $file);
-			if ($loc) {
-				// found the class
-				include_once $loc;
-			} else {
-				// can't find the class
-				return false;
-			}
-		}
-		
-		$this->formatObj[$format] =& new $class($this);
-	}
-	
-	
-	/**
-	* 
-	* Add a path to a path array.
-	* 
-	* @access public
-	* 
-	* @param string $type The path-type to add (parse or render).
-	* 
-	* @param string $dir The directory to add to the path-type.
-	* 
-	* @return void
-	* 
-	*/
-	
-	function addPath($type, $dir)
-	{
-		$dir = $this->fixPath($dir);
-		if (! isset($this->path[$type])) {
-			$this->path[$type] = array($dir);
-		} else {
-			array_unshift($this->path[$type], $dir);
-		}
-	}
-	
-	
-	/**
-	* 
-	* Get the current path array for a path-type.
-	* 
-	* @access public
-	* 
-	* @param string $type The path-type to look up (plugin, filter, or
-	* template).  If not set, returns all path types.
-	* 
-	* @return array The array of paths for the requested type.
-	* 
-	*/
-	
-	function getPath($type = null)
-	{
-		if (is_null($type)) {
-			return $this->path;
-		} elseif (! isset($this->path[$type])) {
-			return array();
-		} else {
-			return $this->path[$type];
-		}
-	}
-	
-	
-	/**
-	* 
-	* Searches a series of paths for a given file.
-	* 
-	* @param array $type The type of paths to search (template, plugin,
-	* or filter).
-	* 
-	* @param string $file The file name to look for.
-	* 
-	* @return string|bool The full path and file name for the target file,
-	* or boolean false if the file is not found in any of the paths.
-	*
-	*/
-	
-	function findFile($type, $file)
-	{
-		// get the set of paths
-		$set = $this->getPath($type);
-		
-		// start looping through them
-		foreach ($set as $path) {
-			$fullname = $path . $file;
-			if (file_exists($fullname) && is_readable($fullname)) {
-				return $fullname;
-			}
-		}
-		
-		// could not find the file in the set of paths
-		return false;
-	}
-	
-	
-	/**
-	* 
-	* Append a trailing '/' to paths, unless the path is empty.
-	* 
-	* @access private
-	* 
-	* @param string $path The file path to fix
-	* 
-	* @return string The fixed file path
-	* 
-	*/
-	
-	function fixPath($path)
-	{
-		$len = strlen($this->_dirSep);
-		
-		if (! empty($path) &&
-			substr($path, -1 * $len, $len) != $this->_dirSep)	{
-			return $path . $this->_dirSep;
-		} else {
-			return $path;
-		}
-	}
-	
-	
-}
-
-?>
\ No newline at end of file

Modified: plugins/trunk/textparser/class/data/textile/textile2.php
===================================================================
--- plugins/trunk/textparser/class/data/textile/textile2.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/class/data/textile/textile2.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -37,7 +37,8 @@
 
   // head_offset sets the amount to increase header level (i.e. h1. becomes h3. if head_offset == 2)
   $textile->options['head_offset'] = 0;
-  $textile->options['char_encoding'] = 'utf-8';
+  // $textile->options['char_encoding'] = 'utf-8';
+  $textile->options['char_encoding'] = false;
 
   // do_quotes enables/disables "smart quotes"
   $textile->options['do_quotes'] = 1;

Modified: plugins/trunk/textparser/plugintextparser.class.php
===================================================================
--- plugins/trunk/textparser/plugintextparser.class.php	2005-03-05 12:56:33 UTC (rev 1322)
+++ plugins/trunk/textparser/plugintextparser.class.php	2005-03-05 16:20:22 UTC (rev 1323)
@@ -61,7 +61,7 @@
 			if( $filter == PLUGIN_TEXTPARSER_FILTER_WIKI ) {
 				// load the wiki engine... we're doing like this here because it's about 470kb of
 				// php code and that's quite a lot to load if we don't need it all!
-				include_once( PLOG_CLASS_PATH. "plugins/textparser/class/data/Wiki.php" );
+				include_once( PLOG_CLASS_PATH. "plugins/textparser/class/data/Text/Wiki.php" );
 				
 				// create and configure a wiki filter object
 				$wiki =& new Text_Wiki();




More information about the pLog-svn mailing list