From: <var...@us...> - 2009-01-23 13:07:16
|
Revision: 6431 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6431&view=rev Author: vargenau Date: 2009-01-23 13:07:05 +0000 (Fri, 23 Jan 2009) Log Message: ----------- Moving Wikicreole tables from InlineParser to BlockParser Modified Paths: -------------- trunk/lib/BlockParser.php trunk/lib/InlineParser.php Modified: trunk/lib/BlockParser.php =================================================================== --- trunk/lib/BlockParser.php 2009-01-23 12:33:28 UTC (rev 6430) +++ trunk/lib/BlockParser.php 2009-01-23 13:07:05 UTC (rev 6431) @@ -1,6 +1,7 @@ <?php rcs_id('$Id$'); /* Copyright (C) 2002 Geoffrey T. Dairiki <da...@da...> * Copyright (C) 2004,2005 Reini Urban + * Copyright (C) 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. * @@ -22,10 +23,6 @@ require_once('lib/CachedMarkup.php'); require_once('lib/InlineParser.php'); -//////////////////////////////////////////////////////////////// -// -// - /** * Deal with paragraphs and proper, recursive block indents * for the new style markup (version 2) @@ -370,7 +367,7 @@ if (!is_object($_regexpset)) { $Block_types = array - ('oldlists', 'list', 'dl', 'table_dl', + ('oldlists', 'list', 'dl', 'table_dl', 'table_wikicreole', 'blockquote', 'heading', 'heading_wikicreole', 'hr', 'pre', 'email_blockquote', 'plugin', 'plugin_wikicreole', 'p'); // insert it before p! @@ -1008,6 +1005,39 @@ } } +class Block_table_wikicreole extends Block_pre +{ + var $_re = '\s*\|'; + + function _match (&$input, $m) { + $pos = $input->getPos(); + $pi = "|" . $m->postmatch; + + $intable = true; + while ($intable) { + if (($line = $input->nextLine()) === false) { + $input->setPos($pos); + return false; + } + if (!$line) { + $intable = false; + $trimline = $line; + } else { + $trimline = trim($line); + if ($trimline[0] != "|") { + $intable = false; + } + } + $pi .= "\n$trimline"; + } + + $pi = '<'.'?plugin WikicreoleTable ' . $pi . '?'.'>'; + + $this->_element = new Cached_PluginInvocation($pi); + return true; + } +} + class Block_email_blockquote extends BlockMarkup { var $_attr = array('class' => 'mail-style-quote'); Modified: trunk/lib/InlineParser.php =================================================================== --- trunk/lib/InlineParser.php 2009-01-23 12:33:28 UTC (rev 6430) +++ trunk/lib/InlineParser.php 2009-01-23 13:07:05 UTC (rev 6431) @@ -2,7 +2,7 @@ rcs_id('$Id$'); /* Copyright (C) 2002 Geoffrey T. Dairiki <da...@da...> * Copyright (C) 2004-2008 Reini Urban - * Copyright (C) 2008 Marc-Etienne Vargenau, Alcatel-Lucent + * Copyright (C) 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. * @@ -992,16 +992,6 @@ } } -class Markup_wikicreoletable_plugin extends SimpleMarkup -{ - var $_match_regexp = '^\|=.*?\?>'; - - function markup ($match) { - $s = '<'.'?plugin WikicreoleTable ' . $match . '?'.'>'; - return new Cached_PluginInvocation($s); - } -} - // "..." => "…" browser specific display (not cached?) // Support some HTML::Entities: (C) for copy, --- for mdash, -- for ndash // TODO: "--" => "&emdash;" browser specific display (not cached?) @@ -1093,7 +1083,6 @@ $this->_addMarkup(new Markup_html_divspan); if (ENABLE_MARKUP_COLOR and !$non_default) $this->_addMarkup(new Markup_color); - $this->_addMarkup(new Markup_wikicreoletable_plugin); // Markup_wikicreole_preformatted must be before Markup_template_plugin $this->_addMarkup(new Markup_wikicreole_preformatted); if (ENABLE_MARKUP_TEMPLATE and !$non_default) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |