From: Mutwin K. <mu...@us...> - 2004-10-16 15:55:41
|
Update of /cvsroot/fuwiki/fuwiki_1_0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5020 Modified Files: functions.inc parser.inc Log Message: many bugfixes on the long road to fuwiki 1.0 Index: functions.inc =================================================================== RCS file: /cvsroot/fuwiki/fuwiki_1_0/functions.inc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions.inc 15 Oct 2004 11:49:04 -0000 1.2 --- functions.inc 16 Oct 2004 15:55:32 -0000 1.3 *************** *** 48,52 **** else if($old_revision != null) return $WikiParser->compare($revision->text, $old_revision->text, $isMain); ! return $WikiParser->parse($revision->text, $isMain); } --- 48,52 ---- else if($old_revision != null) return $WikiParser->compare($revision->text, $old_revision->text, $isMain); ! return $WikiParser->parse($revision->text, $isMain) .($isMain ? "\n<a name=\"wiki_pageend\"></a>\n" : ""); } Index: parser.inc =================================================================== RCS file: /cvsroot/fuwiki/fuwiki_1_0/parser.inc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** parser.inc 15 Oct 2004 11:49:04 -0000 1.3 --- parser.inc 16 Oct 2004 15:55:32 -0000 1.4 *************** *** 52,55 **** --- 52,57 ---- function parse_links_callback($str) { + if(preg_match("/^#/", $str)) + $str = utf8_decode(_PAGENAME).$str; if(preg_match("/([^\|]*)\|(.*)/", $str, $out)) { $url = $out[1]; *************** *** 172,176 **** function fix_comments_callback2($str) { ! if(preg_match("/^\n*$/", $str) || preg_match("/\[comment[^\]]*\]/", $str)) return $str; return "[nocomment]".$str."[/nocomment]"; --- 174,178 ---- function fix_comments_callback2($str) { ! if(preg_match("/^[\n\r]*$/", $str) || preg_match("/\[comment[^\]]*\]/", $str)) return $str; return "[nocomment]".$str."[/nocomment]"; *************** *** 381,385 **** $string = stripslashes($string); $string = preg_replace("/\[comment[^\]]*\]/U", "", $string, -1); ! $string = preg_replace("/\[\/comment\]/", "", $string, -1); $string = preg_replace("/\[\/nocomment\]/", "", $string, -1); $string = preg_replace("/\[nocomment\]/", "", $string, -1); --- 383,387 ---- $string = stripslashes($string); $string = preg_replace("/\[comment[^\]]*\]/U", "", $string, -1); ! $string = preg_replace("/\[\/comment\]\n*(?!\n)/", "\n\n", $string, -1); $string = preg_replace("/\[\/nocomment\]/", "", $string, -1); $string = preg_replace("/\[nocomment\]/", "", $string, -1); *************** *** 445,449 **** $a = array(); $a2 = array(); $a3 = array(); ! $string = preg_replace("/\[url ([^\]]*)\](.*)\[\/url\]/e", "extract_callback(\$a, '[url \\1]\\2[/url]', '[url-placeholder]')", $string, -1); $string = preg_replace("/\[\[@([^\|]*)\|([^\]]*)\]\]/e", "extract_callback(\$a2, '[url \\2]\\1[/url]', '[url2-placeholder]')", $string, -1); $string = preg_replace("/\[img (.*)\]/e", "extract_callback(\$a3, '[img \\1]', '[img-placeholder]')", $string, -1); --- 447,451 ---- $a = array(); $a2 = array(); $a3 = array(); ! $string = preg_replace("/\[url([^\]]*)\](.*)\[\/url\]/e", "extract_callback(\$a, '[url\\1]\\2[/url]', '[url-placeholder]')", $string, -1); $string = preg_replace("/\[\[@([^\|]*)\|([^\]]*)\]\]/e", "extract_callback(\$a2, '[url \\2]\\1[/url]', '[url2-placeholder]')", $string, -1); $string = preg_replace("/\[img (.*)\]/e", "extract_callback(\$a3, '[img \\1]', '[img-placeholder]')", $string, -1); *************** *** 452,455 **** --- 454,458 ---- $string = preg_replace("/\[url2-placeholder\]/e", "insert_callback(\$a2)", $string, -1); $string = preg_replace("/\[img-placeholder\]/e", "insert_callback(\$a3)", $string, -1); + $string = preg_replace("/([^@\n ]+@[^\. @\n]+\.[^ @\n]+)(?= |\n)/", "[url \\1]mailto:\\1[/url]", $string, -1); //$string = preg_replace("/\[comment([^\]]*)\](.*)\n/", "[comment\\1]\n\\2", $string, -1); *************** *** 499,502 **** --- 502,506 ---- $string = preg_replace("/\[\[FWikiEdit\|([^\]]*)\]\]/", "<a href=\"index.php?".utf8_decode(_PAGENAME)."&edit=1&v=".(_REVNUM != 0 ? _REVNUM : 0)."\">\\1</a>", $string, -1); $string = preg_replace("/\[\[([^\]]*)\]\]/e", "parse_links_callback('\\1')", $string, -1); + $string = preg_replace("/\[a #([^\]]*)\]/", "<a name=\"\\1\"></a>", $string, -1); return $string; } *************** *** 575,582 **** $string = preg_replace("/^(.*)(\[comment[^\]]*\])/Use", "fix_comments_callback2('\\1').'\\2'", $string, 1); $string = preg_replace("/(\[\/comment\])(.*)(\[comment[^\]]*\])/Use", "'\\1'.fix_comments_callback2('\\2').'\\3'", $string, -1); ! ! $string = preg_replace("/(\[\/comment\])(?=\n*)(.*)(\[comment[^\]]*\])/Us", "\\1[nocomment]\\2[/nocomment]\\3", $string, -1); ! $string = preg_replace("/(\[\/comment\])(?=\n*)(.*)(?!\[comment[^\]]*\])$/Us", "\\1[nocomment]\\2[/nocomment]", $string, 1); ! $string = preg_replace("/(\[\/comment\])(\n*)(\[comment[^\]]*\])/", "\\1\n\r\\3", $string, -1); return $string; } --- 579,584 ---- $string = preg_replace("/^(.*)(\[comment[^\]]*\])/Use", "fix_comments_callback2('\\1').'\\2'", $string, 1); $string = preg_replace("/(\[\/comment\])(.*)(\[comment[^\]]*\])/Use", "'\\1'.fix_comments_callback2('\\2').'\\3'", $string, -1); ! $string = preg_replace("/(\[\/comment\])(?=\n*)(.*)(?!\[comment[^\]]*\])$/Use", "'\\1'.fix_comments_callback2('\\2')", $string, 1); ! $string = preg_replace("/(\[\/comment\])([\n\r]*)(\[comment[^\]]*\])/", "\\1\\3", $string, -1); return $string; } *************** *** 595,598 **** --- 597,601 ---- //$string = preg_replace("/\[url\]\[url\]/", "[url]", $string, -1); $string = preg_replace("/\[\/url\]\[\/url\]/", "[/url]", $string, -1); $string = preg_replace("/\[\[url\](.*)\[\/url\] ([^\]]*)\]/Ue", "parse_urls_callback('\\1', '\\2')", $string, -1); + $string = preg_replace("/\[\[url\](.*)\[\/url\]\]/Ue", "parse_urls_callback('\\1')", $string, -1); $string = preg_replace("/\[url ([^\]]*)\](.*)\[\/url\]/Ue", "parse_urls_callback('\\2', '\\1')", $string, -1); $string = preg_replace("/\[url\](.*)\[\/url\]/Ue", "parse_urls_callback('\\1')", $string, -1); *************** *** 621,625 **** function parse_code($string) { ! $string = preg_replace("/\[code\](.*)\[\/code\]/Us", "<pre class=\"WikiCode\">\\r\1\r</pre>\r", $string, -1); return $string; } --- 624,628 ---- function parse_code($string) { ! $string = preg_replace("/\[code\](.*)\[\/code\]/Us", "<pre class=\"WikiCode\">\r\\1\r</pre>\r", $string, -1); return $string; } |