CVS update: /cowiki/includes/cowiki/class/parse/, /cowiki/misc/development/tests/
[email protected] 21 Jun 2005 16:37:51 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: cmarble Date: 2005/06/21 09:37:51 Modified: cowiki/includes/cowiki/class/parse/class.CoWikiParser.php cowiki/includes/cowiki/class/parse/class.CoWikiReverseParser.php cowiki/includes/cowiki/class/parse/class.TestReverseParser.php cowiki/includes/cowiki/class/parse/class.TestWikiParser.php cowiki/includes/cowiki/class/parse/class.WikiParser.php cowiki/includes/cowiki/class/parse/class.WikiReverseParser.php cowiki/misc/development/tests/RunTests.php cowiki/misc/development/tests/class.ParserTest.php Log: Issue number: 201, 231 Parser correctly recognises and reproduces CamelCase links. File Changes: Directory: /cowiki/includes/cowiki/class/parse/ =============================================== File [changed]: class.CoWikiParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.CoWikiParser.php?r1=1.15&r2=1.16 Delta lines: +15 -15 --------------------- --- class.CoWikiParser.php 30 May 2005 17:08:36 -0000 1.15 +++ class.CoWikiParser.php 21 Jun 2005 16:37:48 -0000 1.16 @@ -2,7 +2,7 @@ /** * - * $Id: class.CoWikiParser.php,v 1.15 2005/05/30 17:08:36 cmarble Exp $ + * $Id: class.CoWikiParser.php,v 1.16 2005/06/21 16:37:48 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 @@ -17,7 +17,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.15 $ + * @version $Revision: 1.16 $ * */ @@ -71,9 +71,9 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createLinkElement($sStr, $bSquare = false) { + protected function createLinkElement($sStr, $sSquare ) { - $aStr = explode(($bSquare?"][":")("),$sStr); + $aStr = explode(($sSquare=="square"?"][":")("),$sStr); $sRef = false; $sAlias = false; @@ -90,7 +90,7 @@ $sPattern = '^(http://|https://|ftp://|mailto:|news:).*'; if (preg_match('=' . $sPattern . '=', $sRef)) { - return $this->createUriLinkElement($sRef, $sAlias, $bSquare); + return $this->createUriLinkElement($sRef, $sAlias, $sSquare); } // Obviously the reference string is not an URI. Check if it has @@ -101,12 +101,12 @@ if (sizeof($aWebRef) > 1) { $sWeb = trim($aWebRef[0]); $sRef = trim($aWebRef[1]); - return $this->createGlobalLinkElement($sWeb, $sRef, $sAlias, $bSquare); + return $this->createGlobalLinkElement($sWeb, $sRef, $sAlias, $sSquare); } // The reference string was not an URI and it has no reference // to an other web -> Look up in database. - return $this->createLocalLinkElement($sRef, $sAlias, $bSquare); + return $this->createLocalLinkElement($sRef, $sAlias, $sSquare); } /** @@ -122,8 +122,8 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createUriLinkElement($sRef, $sAlias, $bSquare) { - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + protected function createUriLinkElement($sRef, $sAlias, $sSquare) { + $sStr = '<link origin="'.$sSquare,'"'). ' href="'. $sRef . '">'; if ($sAlias && $sAlias != '') { @@ -149,7 +149,7 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createGlobalLinkElement($sWeb, $sRef, $sAlias, $bSquare) { + protected function createGlobalLinkElement($sWeb, $sRef, $sAlias, $sSquare) { $Context = RuntimeContext::getInstance(); $sWebStr = unescape($sWeb); @@ -185,7 +185,7 @@ $this->addReferencedNode($Node); // Create element - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + $sStr = '<link origin="'.$sSquare.'"'. ' idref="' . $Node->get('id') . '">'; $sStr .= $sAlias; $sStr .= '</link>'; @@ -193,7 +193,7 @@ } if (!is_object($WebNode) || !is_object($Node)) { - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + $sStr = '<link origin="'.$sSquare.'"'. ' strref="' . $sWeb . '¦' . $sRef . '">'; $sStr .= $sAlias; $sStr .= '</link>'; @@ -215,7 +215,7 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createLocalLinkElement($sRef, $sAlias, $bSquare) { + protected function createLocalLinkElement($sRef, $sAlias, $sSquare) { $Context = RuntimeContext::getInstance(); // Get current directory/document object @@ -237,14 +237,14 @@ $this->addReferencedNode($NewNode); // Create element - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + $sStr = '<link origin="'.$sSquare.'"'. ' idref="' . $NewNode->get('id') . '">'; $sStr .= $sAlias; $sStr .= '</link>'; } if (!is_object($NewNode)) { - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + $sStr = '<link origin="'.$sSquare.'"'. ' strref="' . $sRef . '">'; $sStr .= $sAlias; $sStr .= '</link>'; File [changed]: class.CoWikiReverseParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.CoWikiReverseParser.php?r1=1.17&r2=1.18 Delta lines: +56 -54 --------------------- --- class.CoWikiReverseParser.php 30 May 2005 17:08:36 -0000 1.17 +++ class.CoWikiReverseParser.php 21 Jun 2005 16:37:48 -0000 1.18 @@ -2,7 +2,7 @@ /** * - * $Id: class.CoWikiReverseParser.php,v 1.17 2005/05/30 17:08:36 cmarble Exp $ + * $Id: class.CoWikiReverseParser.php,v 1.18 2005/06/21 16:37:48 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 @@ -17,7 +17,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.17 $ + * @version $Revision: 1.18 $ * */ @@ -144,14 +144,16 @@ // If no referenced document was found if (!is_object($RefNode)) { - if ($aMatches[0]=='square') { + switch ( $aMatches[0] ) { + case 'square': return '['.'['.$aMatches[1].']['.$aMatches[2].']'. __('I18N_DOC_DELETED_DOCUMENT').']'; - - } else { + case 'round': return '['.'('.$aMatches[1].')('.$aMatches[2].')'. __('I18N_DOC_DELETED_DOCUMENT').']'; - + case 'camel': + return $this->makeCamelCase( $aMatches[1] ). + __('I18N_DOC_DELETED_DOCUMENT'); } } @@ -177,18 +179,26 @@ // Link directly to a web with an alias if ($aMatches[2] != '') { - if( $aMatches[0]=='square' ) { - return '[['.$sPrefix.']['.escape($aMatches[2]).']]'; - } else { - return '(('.$sPrefix.')('.escape($aMatches[2]).'))'; + switch ( $aMatches[0] ) { + case 'square': + return '[['.$sPrefix.'][' + .escape($aMatches[2]).']]'; + case 'round': + return '(('.$sPrefix.')(' + .escape($aMatches[2]).'))'; + case 'camel': + return $this->makeCamelCase( $sPrefix ); } } // Link directly to a web without alias - if ($aMatches[0]=='square') { - return '[['.$sPrefix.']]'; - } else { - return '(('.$sPrefix.'))'; + switch ( $aMatches[0] ) { + case 'square': + return '[['.$sPrefix.']['; + case 'round': + return '(('.$sPrefix.')('; + case 'camel': + return $this->makeCamelCase( $sPrefix ); } } } @@ -197,42 +207,28 @@ // Generate normal link without alias if ($aMatches[2] == '') { - if ($aMatches[0]=='square') { - return - '[[' - .$sPrefix - .escape($RefNode->get('name')) - .']]'; - } else { - return - '((' - .$sPrefix - .escape($RefNode->get('name')) - .'))'; + switch ($aMatches[0]) { + case 'square': + return '[['.$sPrefix .escape($RefNode->get('name')).']]'; + case 'round': + return '(('.$sPrefix .escape($RefNode->get('name')).'))'; + case 'camel': + return $this->makeCamelCase( $sPrefix ); } } // Generate normal link with an alias - if ($aMatches[0] == 'square' ) { - return '[' - .'[' - .$sPrefix + switch ($aMatches[0]) { + case 'square': + return '[['.$sPrefix .$this->noopDelimiters(escape($RefNode->get('name'))) - .']' - .'[' - .escape($aMatches[2]) - . ']' - .']'; - } else { - return '(' - .'(' - .$sPrefix + .']['.escape($aMatches[2]). ']]'; + case 'round': + return '(('.$sPrefix .$this->noopDelimiters(escape($RefNode->get('name'))) - .')' - .'(' - .escape($aMatches[2]) - . ')' - .')'; + .')(' .escape($aMatches[2]).'))'; + case 'camel': + return $this->makeCamelCase( $sPrefix ); } } @@ -252,16 +248,22 @@ */ protected function buildHyperRefLink(&$aMatches) { if (trim($aMatches[2]) == '') { - if( $aMatches[0] == 'square' ) { + switch( $aMatches[0] ) { + case 'square': return '[[' . $aMatches[1] . ']]'; - } else { + case 'round': return '((' . $aMatches[1] . '))'; + case 'camel': + return $this->makeCamelCase ($aMatches[1]); } } - if( $aMatches[0] == 'square' ) { + switch( $aMatches[0] ) { + case 'square': return '[[' . $aMatches[1] . '][' . $aMatches[2] . ']]'; - } else { + case 'round': return '((' . $aMatches[1] . ')(' . $aMatches[2] . '))'; + case 'camel': + return $this->makeCamelCase( $aMatches[1] ); } } File [changed]: class.TestReverseParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.TestReverseParser.php?r1=1.2&r2=1.3 Delta lines: +23 -14 --------------------- --- class.TestReverseParser.php 30 May 2005 17:08:36 -0000 1.2 +++ class.TestReverseParser.php 21 Jun 2005 16:37:48 -0000 1.3 @@ -2,7 +2,7 @@ /** * - * $Id: class.TestReverseParser.php,v 1.2 2005/05/30 17:08:36 cmarble Exp $ + * $Id: class.TestReverseParser.php,v 1.3 2005/06/21 16:37:48 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 @@ -17,7 +17,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.2 $ + * @version $Revision: 1.3 $ * */ @@ -76,10 +76,13 @@ * @since coWiki 0.4.0 */ protected function buildIdRefLink(&$aMatches) { - if ($aMatches[0]=='square') { + switch($aMatches[0]) { + case 'square': return '['.'['.$aMatches[1].']['.$aMatches[2].']'.']'; - } else { + case 'round': return '('.'('.$aMatches[1].')('.$aMatches[2].')'.')'; + case 'camel': + return $this->makeCamelCase( $aMatches[1] ); } } @@ -95,16 +98,22 @@ */ protected function buildHyperRefLink(&$aMatches) { if (trim($aMatches[2]) == '') { - if( $aMatches[0] == 'square' ) { + switch( $aMatches[0] ) { + case 'square': return '[[' . $aMatches[1] . ']]'; - } else { + case 'round': return '((' . $aMatches[1] . '))'; + case 'camel': + return $this->makeCamelCase( $aMatches[1] ); } } - if( $aMatches[0] == 'square' ) { + switch( $aMatches[0] ) { + case 'square': return '[[' . $aMatches[1] . '][' . $aMatches[2] . ']]'; - } else { + case 'round': return '((' . $aMatches[1] . ')(' . $aMatches[2] . '))'; + case 'camel': + return $this->makeCamelCase( $aMatches[1] ); } } File [changed]: class.TestWikiParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.TestWikiParser.php?r1=1.2&r2=1.3 Delta lines: +13 -13 --------------------- --- class.TestWikiParser.php 30 May 2005 17:08:36 -0000 1.2 +++ class.TestWikiParser.php 21 Jun 2005 16:37:48 -0000 1.3 @@ -2,7 +2,7 @@ /** * - * $Id: class.TestWikiParser.php,v 1.2 2005/05/30 17:08:36 cmarble Exp $ + * $Id: class.TestWikiParser.php,v 1.3 2005/06/21 16:37:48 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 @@ -17,7 +17,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.2 $ + * @version $Revision: 1.3 $ * */ @@ -67,9 +67,9 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createLinkElement($sStr, $bSquare = false) { + protected function createLinkElement($sStr, $sSquare) { - $aStr = explode(($bSquare?"][":")("),$sStr); + $aStr = explode(($sSquare!="square"?")(":"]["),$sStr); $sRef = false; $sAlias = false; @@ -86,7 +86,7 @@ $sPattern = '^(http://|https://|ftp://|mailto:|news:).*'; if (preg_match('=' . $sPattern . '=', $sRef)) { - return $this->createUriLinkElement($sRef, $sAlias, $bSquare); + return $this->createUriLinkElement($sRef, $sAlias, $sSquare); } // Obviously the reference string is not an URI. Check if it has @@ -97,12 +97,12 @@ if (sizeof($aWebRef) > 1) { $sWeb = trim($aWebRef[0]); $sRef = trim($aWebRef[1]); - return $this->createGlobalLinkElement($sWeb, $sRef, $sAlias, $bSquare); + return $this->createGlobalLinkElement($sWeb, $sRef, $sAlias, $sSquare); } // The reference string was not an URI and it has no reference // to an other web -> Look up in database. - return $this->createLocalLinkElement($sRef, $sAlias, $bSquare); + return $this->createLocalLinkElement($sRef, $sAlias, $sSquare); } /** @@ -118,8 +118,8 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createUriLinkElement($sRef, $sAlias, $bSquare) { - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + protected function createUriLinkElement($sRef, $sAlias, $sSquare) { + $sStr = '<link origin="'.$sSquare.'"'. ' href="'. $sRef . '">'; if ($sAlias && $sAlias != '') { @@ -145,7 +145,7 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createGlobalLinkElement($sWeb, $sRef, $sAlias, $bSquare) { + protected function createGlobalLinkElement($sWeb, $sRef, $sAlias, $sSquare) { $sWebStr = unescape($sWeb); $sRefStr = unescape($sRef); @@ -158,7 +158,7 @@ */ // Create element as though not found in database - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + $sStr = '<link origin="'.$sSquare.'"'. ' strref="' . $sWeb . '¦' . $sRef . '">'; $sStr .= $sAlias; $sStr .= '</link>'; @@ -179,7 +179,7 @@ * @author Archie Campbell <[email protected]> * @since coWiki 0.4.0 */ - protected function createLocalLinkElement($sRef, $sAlias, $bSquare) { + protected function createLocalLinkElement($sRef, $sAlias, $sSquare) { $aData = false; $sRefStr = unescape($sRef); @@ -192,7 +192,7 @@ */ // Create element as though not found in database - $sStr = '<link origin='.($bSquare?'"square"':'"round"'). + $sStr = '<link origin="'.$sSquare.'"'. ' strref="' . $sRef . '">'; $sStr .= $sAlias; $sStr .= '</link>'; File [changed]: class.WikiParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.WikiParser.php?r1=1.53&r2=1.54 Delta lines: +9 -20 -------------------- --- class.WikiParser.php 12 Jun 2005 13:44:30 -0000 1.53 +++ class.WikiParser.php 21 Jun 2005 16:37:48 -0000 1.54 @@ -2,7 +2,7 @@ /** * - * $Id: class.WikiParser.php,v 1.53 2005/06/12 13:44:30 cmarble Exp $ + * $Id: class.WikiParser.php,v 1.54 2005/06/21 16:37:48 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.53 $ + * @version $Revision: 1.54 $ * */ @@ -446,28 +446,28 @@ '\)\)=Usx', $sStr, $aMatches )) { if($debug){echo "6\n";} - $sRet .= $this->createLinkElement( $aMatches[1] ); + $sRet .= $this->createLinkElement( $aMatches[1], "round" ); //links [[][]] }else if( preg_match( '=^\[\['. '([^\[\]]+\]\[[^\[\]]+)'. '\]\]=Usx', $sStr, $aMatches )) { if($debug){echo "7\n";} - $sRet .= $this->createLinkElement( $aMatches[1], true ); + $sRet .= $this->createLinkElement( $aMatches[1], "square" ); //links (()) }else if( preg_match( '=^\(\('. '([^\(\)]+)'. '\)\)=Usx', $sStr, $aMatches )) { if($debug){echo "6\n";} - $sRet .= $this->createLinkElement( $aMatches[1] ); + $sRet .= $this->createLinkElement( $aMatches[1], "round" ); //links [[]] }else if( preg_match( '=^\[\['. '([^\[\]]+)'. '\]\]=Usx', $sStr, $aMatches )) { if($debug){echo "7\n";} - $sRet .= $this->createLinkElement( $aMatches[1], true ); + $sRet .= $this->createLinkElement( $aMatches[1], "square" ); }else if( preg_match( '=^\(\(?[^\(\)]+\)?=Ui', $sStr, $aMatches )) { if($debug){echo "8\n";} $sRet .= $aMatches[0]; @@ -482,24 +482,13 @@ if($debug){echo "10.5\n";} $sRet .= $aMatches[0]; */ - /* //WikiWords }else if( preg_match( '=^([A-Z][a-z]+([A-Z][a-z]+)+)=s', $sStr, $aMatches )) { - $sLink = trim(preg_replace( '=([A-Z])=', ' \1', + $sLink = ltrim(preg_replace( '=([A-Z])=', ' \1', $aMatches[1] )); - $sRet .= '<link strref="' . $sLink . '">' . - $sLink . '</link>'; - */ - /* - //urls - }else if( preg_match( '=^<url(\s+)( - (http://|https://|ftp://|mailto:|news:) - ([-_A-Z0-9\S]*) - (\*\s|\=\s|"|<|>|<|>|\(|\)|\s|$)?? - )>=six', - $sStr, $aMatches ) ) { - */ + $sRet .= $this->createLinkElement($sLink.")(" + .$aMatches[1],"camel" ); //URIs }else if( preg_match( '=^(http://|https://|ftp://|mailto:|news:) File [changed]: class.WikiReverseParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.WikiReverseParser.php?r1=1.24&r2=1.25 Delta lines: +33 -13 --------------------- --- class.WikiReverseParser.php 12 Jun 2005 13:44:30 -0000 1.24 +++ class.WikiReverseParser.php 21 Jun 2005 16:37:48 -0000 1.25 @@ -2,7 +2,7 @@ /** * - * $Id: class.WikiReverseParser.php,v 1.24 2005/06/12 13:44:30 cmarble Exp $ + * $Id: class.WikiReverseParser.php,v 1.25 2005/06/21 16:37:48 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 @@ -17,7 +17,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.24 $ + * @version $Revision: 1.25 $ * */ @@ -174,6 +174,20 @@ $a =& $this->aTable[sizeof($this->aTable)-1]; $a[sizeof($a)-1] .= $sData; } + /** + * make CamelCase from link target + * + * @access protected + * + * @author Archie Campbell <[email protected]> + * @since coWiki 0.4.0 + * + */ + protected function makeCamelCase( $sStr ) + { + return preg_replace( '=( ([A-Z]))=', '\2', $sStr ); + } + /** * Parse @@ -770,7 +784,6 @@ case 15: */ // -------------------------------------------------------------------- - /** * Build str ref link * @@ -785,20 +798,27 @@ */ protected function buildStrRefLink(&$aMatches) { if ($aMatches[1] == $aMatches[2] || trim($aMatches[2]) == '') { - if( $aMatches[0] == 'square' ) { + switch( $aMatches[0] ) { + case 'square': return '[[' . $this->noopDelimiters($aMatches[1]) . ']]'; - } else { + case 'round': return '((' . $this->noopDelimiters($aMatches[1]) . '))'; + case 'camel': + return $this->makeCamelCase( $aMatches[1] ); } } - if($aMatches[0] == 'square' ) { + switch( $aMatches[0] ) { + case 'square': return '[[' . $this->noopDelimiters($aMatches[1]) . ']' .'[' . $aMatches[2] . ']]'; - } else { + case 'round': return '((' . $this->noopDelimiters($aMatches[1]) . ')' .'(' . $aMatches[2] . '))'; + case 'camel': + return $this->makeCamelCase( $aMatches[1] ); } + return "insanity in buildStrRefLink".implode("\n",$aMatches)."\n"; } } // of class Directory: /cowiki/misc/development/tests/ ========================================== File [changed]: RunTests.php Url: http://cowiki.tigris.org/source/browse/cowiki/misc/development/tests/RunTests.php?r1=1.5&r2=1.6 Delta lines: +2 -3 ------------------- --- RunTests.php 12 Jun 2005 13:44:30 -0000 1.5 +++ RunTests.php 21 Jun 2005 16:37:48 -0000 1.6 @@ -1,7 +1,7 @@ <?php /** * - * $Id: RunTests.php,v 1.5 2005/06/12 13:44:30 cmarble Exp $ + * $Id: RunTests.php,v 1.6 2005/06/21 16:37:48 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 @@ -16,7 +16,7 @@ * @author Paul Hanchett <[email protected]> * @copyright (C) Paul Hanchett, 2005 * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * */ // @@ -63,7 +63,6 @@ $suite->addTestSuite(ParserQTagFormattingTest); $suite->addTestSuite(ParserOtherProcessContentFormattingTest); - $suite->addTestSuite(ParserOtherParseFormattingTest); //$suite->addTestSuite(ParserBlockFormattingTest); File [changed]: class.ParserTest.php Url: http://cowiki.tigris.org/source/browse/cowiki/misc/development/tests/class.ParserTest.php?r1=1.5&r2=1.6 Delta lines: +16 -34 --------------------- --- class.ParserTest.php 12 Jun 2005 13:44:30 -0000 1.5 +++ class.ParserTest.php 21 Jun 2005 16:37:48 -0000 1.6 @@ -1,7 +1,7 @@ <?php /** * - * $Id: class.ParserTest.php,v 1.5 2005/06/12 13:44:30 cmarble Exp $ + * $Id: class.ParserTest.php,v 1.6 2005/06/21 16:37:48 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 @@ -16,7 +16,7 @@ * @author Paul Hanchett <[email protected]> * @copyright (C) Paul Hanchett, 2005 * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * */ @@ -1103,6 +1103,17 @@ } //-------------------------------------------------------------------------- + // CamelCase + //-------------------------------------------------------------------------- + function testCamelCase() + { + $inputString = 'A CamelCase link'; + $outputString = '<p>A <link origin="camel" strref="Camel Case">CamelCase</link> link</p>'; + $this->assertEquals($outputString, $this->p->parse($inputString)); + $this->assertEquals(trim($inputString),trim($this->r->parse($outputString))); + } + + //-------------------------------------------------------------------------- // URIs //-------------------------------------------------------------------------- function testURIElement() @@ -1539,40 +1550,11 @@ function testBlock() { $inputString = <<<EOD -<code> -// An example of why tradition shared hosting is not secure - -copyr('/home/companya/', '/home/joeuser/www/stolenfiles'); - -function copyr($source, $dest){ - // Simple copy for a file - if (is_file($source)) { - return copy($source, $dest); - } - // Make destination directory - if (!is_dir($dest)) { - mkdir($dest); - } - // Loop through the folder - $dir = dir($source); - while (false !== $entry = $dir->read()) { - // Skip pointers - if ($entry == '.' || $entry == '..') { - continue; - } - // Deep copy directories - if ($dest !== "$source/$entry") { - copyr("$source/$entry", "$dest/$entry"); - } - } - // Clean up - $dir->close(); - return true;} -</code> +CamelCase becomes a link EOD; - $outputString = "??"; + $outputString = '??'; $this->assertEquals($outputString, $this->p->parse($inputString)); - //$this->assertEquals(trim($inputString),trim($this->r->parse($outputString))); + $this->assertEquals(trim($inputString),trim($this->r->parse($outputString))); } } ?>