CVS update: /cowiki/includes/cowiki/class/parse/

[email protected] 31 May 2005 11:39:58 -0000
Newsgroups gmane.comp.php.cowiki.cvs
Message-ID <[email protected]>
User: cmarble 
Date: 2005/05/31 04:39:58

Modified:
   cowiki/includes/cowiki/class/parse/class.WikiParser.php

Log:
 Now deals correctly with ((link|)) and parentheses in text.

File Changes:

Directory: /cowiki/includes/cowiki/class/parse/
===============================================

File [changed]: class.WikiParser.php
Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.WikiParser.php?r1=1.51&r2=1.52
Delta lines:  +23 -4
--------------------
--- class.WikiParser.php	30 May 2005 17:08:36 -0000	1.51
+++ class.WikiParser.php	31 May 2005 11:39:55 -0000	1.52
@@ -2,7 +2,7 @@
 
 /**
  *
- * $Id: class.WikiParser.php,v 1.51 2005/05/30 17:08:36 cmarble Exp $
+ * $Id: class.WikiParser.php,v 1.52 2005/05/31 11:39:55 cmarble Exp $
  *
  * This file is part of coWiki. coWiki is free software under the terms of
  * the GNU General Public License (GPL). Read the LICENSE file. If you did
@@ -21,7 +21,7 @@
  * @author      Daniel T. Gorski, <[email protected]>
  * @copyright   (C) Daniel T. Gorski, {@link http://www.develnet.org}
  * @license     http://www.gnu.org/licenses/gpl.html
- * @version     $Revision: 1.51 $
+ * @version     $Revision: 1.52 $
  *
  */
 
@@ -452,15 +452,34 @@
                                   $sStr, $aMatches )) {
               if($debug){echo "7\n";}
                 $sRet .= $this->createLinkElement( $aMatches[1], true );
-            }else if( preg_match( '=^\(\([^\(\)]+\)?=Ui', $sStr, $aMatches )) {
+            //links (())
+            }else if( preg_match( '=^\(\('.
+                                    '([^\(\)]+)'.
+                                    '\)\)=Usx',
+                                  $sStr, $aMatches )) {
+              if($debug){echo "6\n";}
+                $sRet .= $this->createLinkElement( $aMatches[1] );
+            //links [[]]
+            }else if( preg_match( '=^\[\['.
+                                    '([^\[\]]+)'.
+                                    '\]\]=Usx',
+                                  $sStr, $aMatches )) {
+              if($debug){echo "7\n";}
+                $sRet .= $this->createLinkElement( $aMatches[1], true );
+            }else if( preg_match( '=^\(\(?[^\(\)]+\)?=Ui', $sStr, $aMatches )) {
               if($debug){echo "8\n";}
                 $sRet .= $aMatches[0];
-            }else if( preg_match( '=^\(?[^\(\)]+\)\)=Ui', $sStr, $aMatches )) {
+            }else if( preg_match( '=^\(?[^\(\)]+\)\)?=Ui', $sStr, $aMatches )) {
               if($debug){echo "9\n";}
                 $sRet .= $aMatches[0];
             }else if( preg_match( '=^[^\(\)]+\)\([^\(\)]+=Ui', $sStr, $aMatches )) {
               if($debug){echo "10\n";}
                 $sRet .= $aMatches[0];
+		/*
+            }else if( preg_match( '=^\([^\(\)]+\)=Ui', $sStr, $aMatches )) {
+              if($debug){echo "10.5\n";}
+                $sRet .= $aMatches[0];
+		*/
                 /*
             //WikiWords
             }else if( preg_match( '=^([A-Z][a-z]+([A-Z][a-z]+)+)=s',