Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /cowiki/includes/cowiki/class/parse/, /cowiki/includes/cowiki/class/render/, /cowiki/misc/development/tests/

cowiki
Discussion topic

Back to topic list

CVS update: /cowiki/includes/cowiki/class/parse/, /cowiki/includes/cowiki/class/render/, /cowiki/misc/development/tests/

Author cmarble
Full name Archie Campbell
Date 2006-05-07 07:04:05 PDT
Message User: cmarble Date: 2006-05-07 07:04:05-0700 Modified: cowiki/includes/cowiki/class/parse/class.WikiParser.php cowiki/includes/cowiki/class/parse/class.WikiReverseParser.php cowiki/includes/cowiki/class/render/class.FrontHtmlTransformer.php cowiki/misc/development/tests/RunTests.php cowiki/misc/development/tests/class.ParserTest.php Log: WikiReverseParser now prepends xml version & encoding tag. Otherwise invalid characters still throwing error. Change to htmltransformer deals properly with tables. Also couple of changes to tests reflect this. 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.61&r2=1.62 Delta lines: +3 -3 ------------------- --- class.WikiParser.php 2006-03-20 08:53:57-0700 1.61 +++ class.WikiParser.php 2006-05-07 07:03:57-0700 1.62 @@ -2,7 +2,7 @@ /** * - * $Id: class.WikiParser.php,v 1.61 2006/03/20 15:53:57 cmarble Exp $ + * $Id: class.WikiParser.php,v 1.62 2006/05/07 14:03:57 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, * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.61 $ + * @version $Revision: 1.62 $ * */ @@ -37,7 +37,7 @@ * @author Archie Campbell * @since coWiki 0.4.0 * - * Whilst debugging, try query-replace "debug = false" with "debug = true" + * Whilst debugging, try query-replace "debug = false" with "debug = false" * */ class WikiParser extends Object { File [changed]: class.WikiReverseParser.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/parse/class.WikiReverseParser.php?r1=1.28&r2=1.29 Delta lines: +35 -29 --------------------- --- class.WikiReverseParser.php 2006-03-20 08:53:57-0700 1.28 +++ class.WikiReverseParser.php 2006-05-07 07:03:57-0700 1.29 @@ -2,7 +2,7 @@ /** * - * $Id: class.WikiReverseParser.php,v 1.28 2006/03/20 15:53:57 cmarble Exp $ + * $Id: class.WikiReverseParser.php,v 1.29 2006/05/07 14:03:57 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, * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.28 $ + * @version $Revision: 1.29 $ * */ @@ -33,7 +33,7 @@ * @author Archie Campbell * @since coWiki 0.4.0 * - * Whilst debugging, try query-replace "debug = false" with "debug = true" + * Whilst debugging, try query-replace "debug = false" with "debug = false" * * @todo [D11N] Complete documentation */ @@ -321,7 +321,7 @@ return false; } - $this->rParser = @xml_parser_create(); + $this->rParser = @xml_parser_create("ISO-8859-1"); if (!$this->rParser) { return false; @@ -329,6 +329,8 @@ xml_parser_set_option($this->rParser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($this->rParser, XML_OPTION_SKIP_WHITE, 1); + xml_parser_set_option($this->rParser, + XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); // Replace web/document delimiter $sStr = str_replace('¦', '|', $sStr); @@ -344,6 +346,7 @@ if(!preg_match('#^#',$sStr)) { $sStr = '' . $sStr . ''; } + $sStr = "".$sStr; xml_set_default_handler( $this->rParser, array(&$this,'xml_default_handler') ); @@ -370,6 +373,7 @@ $this->appendRow( "
".$aLines[$lc]."
\n" ); if($debug) { echo "Error on line ".($lc)."\n"; + echo "in ".$aLines[$lc]."\n"; } } $lc++; @@ -761,6 +765,9 @@ } else { $this->sLink[0] = $this->sOrigin; } + if ( !isset( $this->sLink[2] ) ) { + $this->sLink[2] = ''; + } $sStr = call_user_func($this->fLink, $this->sLink); $this->sContent .= $sStr; break; @@ -768,6 +775,25 @@ $this->popStateSanity(30,"origin"); if(end($this->aState)==10 && $this->sOrigin == 'doubled') { $this->aTable[$this->nTd] = "||"; + }else{ + switch(end($this->aState)) { + case 22: + $this->sContent .= ($this->sOrigin=='html'? + '':'--'); + break; + case 23: + $this->sContent .= ($this->sOrigin=='html'?'':'=='); + break; + case 24: + $this->sContent .= ($this->sOrigin=='html'?'':'**'); + break; + case 25: + $this->sContent .= ($this->sOrigin=='html'?'':'__'); + break; + case 26: + $this->sContent .= ($this->sOrigin=='html'?'':'//'); + break; + } } break; case 'name': @@ -808,45 +834,25 @@ //emphasis (strike,tt,b,u,i) case 'strike': $this->popStateSanity(22,"strike"); - if($this->sOrigin == 'html') { - $this->sContent = "" . $this->sContent . ""; - } else { - $this->sContent = "--" . $this->sContent . "--"; - } + $this->sContent .= ($this->sOrigin == 'html'?"":"--"); break; case 'tt': $this->popStateSanity(23,"tt"); - if($this->sOrigin == 'html') { - $this->sContent = "" . $this->sContent . ""; - } else { - $this->sContent = "==" . $this->sContent . "=="; - } + $this->sContent .= ($this->sOrigin == 'html'?"":"=="); break; case 'strong': case 'b': $this->popStateSanity(24,"bold"); - if($this->sOrigin == 'html') { - $this->sContent = "" . $this->sContent . ""; - } else { - $this->sContent = "**" . $this->sContent . "**"; - } + $this->sContent .= ($this->sOrigin == 'html'?"":"**"); break; case 'u': $this->popStateSanity(25,"underline"); - if($this->sOrigin == 'html') { - $this->sContent = "" . $this->sContent . ""; - } else { - $this->sContent = "__" . $this->sContent . "__"; - } + $this->sContent .= ($this->sOrigin == 'html'?"":"__"); break; case 'em': case 'i': $this->popStateSanity(26,"italic"); - if($this->sOrigin == 'html') { - $this->sContent = "" . $this->sContent . ""; - } else { - $this->sContent = "//" . $this->sContent . "//"; - } + $this->sContent .= ($this->sOrigin == 'html'?"":"//"); break; default: $nItem = false; Directory: /cowiki/includes/cowiki/class/render/ ================================================ File [changed]: class.FrontHtmlTransformer.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/render/class.FrontHtmlTransformer.php?r1=1.46&r2=1.47 Delta lines: +3 -2 ------------------- --- class.FrontHtmlTransformer.php 2006-03-20 08:53:57-0700 1.46 +++ class.FrontHtmlTransformer.php 2006-05-07 07:03:57-0700 1.47 @@ -2,7 +2,7 @@ /** * - * $Id: class.FrontHtmlTransformer.php,v 1.46 2006/03/20 15:53:57 cmarble Exp $ + * $Id: class.FrontHtmlTransformer.php,v 1.47 2006/05/07 14:03:57 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, * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.46 $ + * @version $Revision: 1.47 $ * */ @@ -817,6 +817,7 @@ }else if(preg_match('=^=Usi',$table,$aMatch)) { if($cursor){ $sStr.='>'; } $sStr .= ""; + $cursor = false; /* recognised tags */ }else if(preg_match('=^<(/?)(b|i|u|tt|strike|sub|sup|left|right|center|noop|rem|code|pre|posting|q|ul|ol|li|caption)>=Usi',$table,$aMatch)){ if($cursor){ $sStr.='>'; } Directory: /cowiki/misc/development/tests/ ========================================== File [changed]: RunTests.php Url: http://cowiki.tigris.org/source/browse/cowiki/misc/development/tests/RunTests.php?r1=1.8&r2=1.9 Delta lines: +3 -3 ------------------- --- RunTests.php 2006-03-20 08:54:05-0700 1.8 +++ RunTests.php 2006-05-07 07:03:57-0700 1.9 @@ -1,7 +1,7 @@ * @copyright (C) Paul Hanchett, 2005 * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ * */ // @@ -65,7 +65,7 @@ $suite->addTestSuite('ParserBlockFormattingTest'); -$suite->addTestSuite('ParserTestTest'); +//$suite->addTestSuite('ParserTestTest'); $suite->run($result); File [changed]: class.ParserTest.php Url: http://cowiki.tigris.org/source/browse/cowiki/misc/development/tests/class.ParserTest.php?r1=1.8&r2=1.9 Delta lines: +48 -24 --------------------- --- class.ParserTest.php 2006-03-20 08:54:05-0700 1.8 +++ class.ParserTest.php 2006-05-07 07:03:57-0700 1.9 @@ -1,7 +1,7 @@ * @copyright (C) Paul Hanchett, 2005 * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ * */ @@ -1561,6 +1561,17 @@ $this->assertEquals($outputString, $this->p->parse($inputString)); $this->assertEquals($inputString, $this->r->parse($outputString)); } + //------------------------------------------------------------------ + // emphasis spans links + //------------------------------------------------------------------ + function testLinkSpan() + { + $inputString = "**Le portail internet des sociétés calédoniennes ((XL Programmation Micro)) et ((Pecsi)).**"; + $outputString = ""; + + $this->assertEquals($outputString,$this->p->parse($inputString)); + $this->assertEquals($inputString,$this->r->parse($outputString)); + } } //-------------------------------------------------------------------------- @@ -1589,33 +1600,26 @@ $this->c = WikiPseudoXmlConverter :: getInstance(); } - /* - function testBlock() { + function testCharacters() { + $sStr = << -
2 Feb 2005
-

After the transfer of the coWiki project to the new maintainer Paul Hanchett, the new site is up and running. Latest versions and updates are available there. I'll successively close most coWiki related pages here on develnet.org.

+**Le portail internet des sociétés calédoniennes ((XL Programmation Micro)) et ((Pecsi)).** EOF; - echo "\n\nPOOR XML\n".$sStr."\n\n"; - - $sStr = $this->c->parse($sStr); - - echo "STRICT XML\n".$sStr."\n\n"; - - $sStr = $this->r->parse($sStr); + $this->assertEquals($this->r->parse($this->p->parse($sStr)),$sStr); +} - echo "NEW WIKI\n".$sStr."\n\n"; + /* + +
2 Feb 2005
+

After the transfer of the coWiki project to the new maintainer Paul Hanchett, the new site is up and running. Latest versions and updates are available there. I'll successively close most coWiki related pages here on develnet.org.

-} */ - function testTest() { - $xml = "Alias"; - - echo $this->r->parse($xml); + function testCharacters2() { + $xml = ""; + $sStr = "((Hakan Küçükyilmaz)(Alias))"; + $this->assertEquals($this->r->parse($xml),$sStr); } - - } //-------------------------------------------------------------------------- // Basic tests for formatting text within paragraphs @@ -1643,14 +1647,14 @@ $this->c = WikiPseudoXmlConverter :: getInstance(); } + /* function testBlock() { $inputString = "\n quote test with \n"; $outputString = ""; $this->assertEquals($outputString, $this->p->parse($inputString)); $this->assertEquals($inputString, $this->r->parse($outputString)); } - /* - function testBlock() { + function testBlock2() { $inputString = "12345678901234567890123456789012345678901234567890"; //$outputString = ""; //$this->assertEquals($outputString, $this->p->parse($inputString)); @@ -1658,5 +1662,25 @@ echo $this->p->parse($inputString); } */ + function testBlock() { +$sStr = << +Ceci est donc notre wiki. Son objectif est évidemment d'y mettre en commun toute la documentation, les howtos et outils nécéssaire à notre travail quotidien. + + + +| +| +
+ +EOF; + $xml = $this->p->parse($sStr); + $text = $this->r->parse($xml); + $this->assertEquals($text,$sStr); + } } ?>

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /cowiki/includes/cowiki/class/parse/, /cowiki/includes/cowiki/class/render/, /cowiki/misc/development/tests/ cmarble Archie Campbell 2006-05-07 07:04:05 PDT
Messages per page: