|
From: <var...@us...> - 2009-01-23 13:22:56
|
Revision: 6432
http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6432&view=rev
Author: vargenau
Date: 2009-01-23 13:22:51 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
Moving Mediawiki 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 13:07:05 UTC (rev 6431)
+++ trunk/lib/BlockParser.php 2009-01-23 13:22:51 UTC (rev 6432)
@@ -367,7 +367,7 @@
if (!is_object($_regexpset)) {
$Block_types = array
- ('oldlists', 'list', 'dl', 'table_dl', 'table_wikicreole',
+ ('oldlists', 'list', 'dl', 'table_dl', 'table_wikicreole', 'table_mediawiki',
'blockquote', 'heading', 'heading_wikicreole', 'hr', 'pre', 'email_blockquote',
'plugin', 'plugin_wikicreole', 'p');
// insert it before p!
@@ -1038,6 +1038,36 @@
}
}
+/** ENABLE_MARKUP_MEDIAWIKI_TABLE
+ * Table syntax similar to Mediawiki
+ * {|
+ * => <?plugin MediawikiTable
+ * |}
+ * => ?>
+ */
+class Block_table_mediawiki extends Block_pre
+{
+ var $_re = '{\|';
+
+ function _match (&$input, $m) {
+ $pos = $input->getPos();
+ $pi = $m->postmatch;
+ while (!preg_match('/(?<!'.ESCAPE_CHAR.')\|}\s*$/', $pi)) {
+ if (($line = $input->nextLine()) === false) {
+ $input->setPos($pos);
+ return false;
+ }
+ $pi .= "\n$line";
+ }
+ $input->advance();
+
+ $pi = str_replace("\|}", "", $pi);
+ $pi = '<'.'?plugin MediawikiTable ' . $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 13:07:05 UTC (rev 6431)
+++ trunk/lib/InlineParser.php 2009-01-23 13:22:51 UTC (rev 6432)
@@ -975,23 +975,6 @@
}
}
-/** ENABLE_MARKUP_MEDIAWIKI_TABLE
- * Table syntax similar to Mediawiki
- * {|
- * => <?plugin MediawikiTable
- * |}
- * => ?>
- */
-class Markup_mediawikitable_plugin extends SimpleMarkup
-{
- var $_match_regexp = '\{\|.*?\|\}';
-
- function markup ($match) {
- $s = '<'.'?plugin MediawikiTable ' . $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?)
@@ -1087,8 +1070,6 @@
$this->_addMarkup(new Markup_wikicreole_preformatted);
if (ENABLE_MARKUP_TEMPLATE and !$non_default)
$this->_addMarkup(new Markup_template_plugin);
- if (ENABLE_MARKUP_MEDIAWIKI_TABLE)
- $this->_addMarkup(new Markup_mediawikitable_plugin);
// This does not work yet
if (0 and PLUGIN_MARKUP_MAP and !$non_default)
$this->_addMarkup(new Markup_xml_plugin);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|