<?php
// PukiWiki - Yet another WikiWikiWeb clone
-// $Id: convert_html.php,v 1.13 2005/06/30 13:20:05 henoheno Exp $
+// $Id: convert_html.php,v 1.14 2005/07/03 14:16:23 henoheno Exp $
// Copyright (C)
// 2002-2005 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
$matches = array();
// Seems block plugin?
- if (preg_match('/^\#([^\(]+)(?:\((.*)\))?/', $text, $matches) &&
- exist_plugin_convert($matches[1])) {
- return new Div($matches);
+ if (PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK) {
+ // Usual code
+ if (preg_match('/^\#([^\(]+)(?:\((.*)\))?/', $text, $matches) &&
+ exist_plugin_convert($matches[1])) {
+ return new Div($matches);
+ }
+ } else {
+ // Hack code
+ if(preg_match('/^#([^\(\{]+)(?:\(([^\r]*)\))?(\{*)/', $text, $matches) &&
+ exist_plugin_convert($matches[1])) {
+ $len = strlen($matches[3]);
+ $body = array();
+ if ($len == 0) {
+ return new Div($matches); // Seems legacy block plugin
+ } else if (preg_match('/\{{' . $len . '}\s*\r(.*)\r\}{' . $len . '}/', $text, $body)) {
+ $matches[2] .= "\r" . $body[1] . "\r";
+ return new Div($matches); // Seems multiline-enabled block plugin
+ }
+ }
}
return new Paragraph($text);
continue;
}
+ // Multiline-enabled block plugin
+ if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK &&
+ preg_match('/^#[^{]+(\{\{+)\s*$/', $line, $matches)) {
+ $len = strlen($matches[1]);
+ $line .= "\r"; // Delimiter
+ while (! empty($lines)) {
+ $next_line = preg_replace("/[\r\n]*$/", '', array_shift($lines));
+ if (preg_match('/\}{' . $len . '}/', $next_line)) {
+ $line .= $next_line;
+ break;
+ } else {
+ $line .= $next_line .= "\r"; // Delimiter
+ }
+ }
+ }
+
// The first character
$head = $line{0};
<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: file.php,v 1.29 2005/07/03 02:55:54 henoheno Exp $
+// $Id: file.php,v 1.30 2005/07/03 14:16:23 henoheno Exp $
// Copyright (C)
// 2002-2005 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
$lines = explode("\n", $source);
$count = count($lines);
- $matches = array();
+ $modify = TRUE;
+ $multiline = 0;
+ $matches = array();
for ($i = 0; $i < $count; $i++) {
$line = & $lines[$i]; // Modify directly
// Ignore null string and preformatted texts
if ($line == '' || $line{0} == ' ' || $line{0} == "\t") continue;
+ // Modify this line?
+ if ($modify) {
+ if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK &&
+ $multiline == 0 &&
+ preg_match('/#[^{]*(\{\{+)\s*$/', $line, $matches)) {
+ // Multiline convert plugin start
+ $modify = FALSE;
+ $multiline = strlen($matches[1]); // Set specific number
+ }
+ } else {
+ if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK &&
+ $multiline != 0 &&
+ preg_match('/^\}{' . $multiline . '}\s*$/', $line)) {
+ // Multiline convert plugin end
+ $modify = TRUE;
+ $multiline = 0;
+ }
+ }
+ if ($modify === FALSE) continue;
+
// Replace with $str_rules
foreach ($str_rules as $pattern => $replacement)
$line = preg_replace('/' . $pattern . '/', $replacement, $line);
}
}
+ // Multiline part has no stopper
+ if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK &&
+ $modify === FALSE && $multiline != 0)
+ $lines[] = str_repeat('}', $multiline);
+
return implode("\n", $lines);
}
<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: plugin.php,v 1.14 2005/06/30 13:20:05 henoheno Exp $
+// $Id: plugin.php,v 1.15 2005/07/03 14:16:23 henoheno Exp $
// Copyright (C)
// 2002-2005 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
if(do_plugin_init($name) === FALSE)
return '[Plugin init failed: ' . $name . ']';
+ if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK) {
+ // Multiline plugin?
+ $pos = strpos($args, "\r"); // "\r" is just a delimiter
+ if ($pos !== FALSE) {
+ $body = substr($args, $pos + 1);
+ $args = substr($args, 0, $pos);
+ }
+ }
+
if ($args === '') {
$aryargs = array(); // #plugin()
} else {
$aryargs = csv_explode(',', $args); // #plugin(A,B,C,D)
}
+ if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK) {
+ if (isset($body)) $aryargs[] = & $body; // #plugin(){{body}}
+ }
$_digest = $digest;
$retvar = call_user_func_array('plugin_' . $name . '_convert', $aryargs);
<?php
// PukiWiki - Yet another WikiWikiWeb clone
-// $Id: pukiwiki.ini.php,v 1.126 2005/06/07 14:37:47 henoheno Exp $
+// $Id: pukiwiki.ini.php,v 1.127 2005/07/03 14:16:23 henoheno Exp $
// Copyright (C)
// 2002-2005 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
define('PKWK_QUERY_STRING_MAX', 640); // Bytes, 0 = OFF
/////////////////////////////////////////////////
+// Experimental features
+
+// Multiline plugin hack (See BugTrack2/84)
+// EXAMPLE(with a known BUG):
+// #plugin(args1,args2,...,argsN){{
+// argsN+1
+// argsN+1
+// #memo(foo)
+// argsN+1
+// }}
+// #memo(This makes '#memo(foo)' to this)
+define('PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK', 1); // 1 = Disabled
+
+/////////////////////////////////////////////////
// Language / Encoding settings
// LANG - Internal content encoding ('en', 'ja', or ...)