From: Bernd P. <Ber...@cn...> - 2003-11-14 21:13:07
|
Carsten, same with me. I've also a very limited understanding of regexp... :-( And the funny thing is that the patch works here and not on your machine... I'll have a look what your new patch does to my wiki. /Bernd P.S.: Here's the compete patch for the list again. Carsten Klapp wrote: > Hi Bernd, > > This seems to fix the bug. It's probably not great, and incomplete > (i.e. " /0 - -" still does not work as a line either), due to my > limited experience with regex as well as my limited understanding of > the BlockParser classes: > > class Block_blockquote extends BlockMarkup > { > var $_depth; > > - var $_re = '\ +(?=\S)'; > + var $_re = '\ +(?=\S|\d)'; > > > Not that I'm not discounting your patch just yet, it just doesn't work > for me at the moment and I'm not 100% sure what is going on/program > flow inside these classes. > > I don't really understand why my fix works either. I thought that \S > included \d. If PHP's regex matching really is supposed to behave this > way, then there may be a bug in PHP itself because clearly \S is not > matching digits in this case. > > Carsten > > ref: http://ca3.php.net/manual/en/pcre.pattern.syntax.php > > The third use of backslash is for specifying generic character types: > \d any decimal digit > \D any character that is not a decimal digit > \s any whitespace character > \S any character that is not a whitespace character > \w any "word" character > \W any "non-word" character > > > On Thursday, November 13, 2003, at 04:17 pm, Bernd Porr wrote: > >> Hi Carsten, >> >> is would like to suggest a very simple fix for that problem: >> >> BlockParser.php: >> >> class Block_blockquote extends BlockMarkup >> { >> var $_depth; >> >> var $_re = '\ +(?=\S)'; >> >> var $_really_match = true; >> >> function _match (&$input, $m) { >> $this->_depth = strlen($m->match); >> $indent = sprintf("\\ {%d}", $this->_depth); >> $this->_element = new SubBlock($input, $indent, $m->match, >> 'blockquote'); >> return $this->_really_match; >> } >> >> function merge ($nextBlock) { >> if (get_class($nextBlock) == get_class($this)) { >> if (!($nextBlock->_depth < $this->_depth)) { >> $this->_really_match=false; >> return false; >> } >> $nextBlock->_element->unshiftContent($this->_element); >> $nextBlock->_tight_top = $this->_tight_top; >> return $nextBlock; >> } >> return false; >> } >> } >> >> Match always returned a true value. Now it is so that if >> !($nextBlock->_depth < $this->_depth) it returns the next time a >> false. This prevents the main loop from looping forever. >> >> Maybe this is not the best fix but it does not generate a crash with >> the "assert" function. >> >> /Bernd >> >> -- >> Contact information: >> http://www.cn.stir.ac.uk/~bp1/ >> >> > > > > ------------------------------------------------------- > This SF. Net email is sponsored by: GoToMyPC > GoToMyPC is the fast, easy and secure way to access your computer from > any Web browser or wireless device. Click here to Try it Free! > https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwiki-talk -- Contact information: http://www.cn.stir.ac.uk/~bp1/ |