OSDN Git Service

改行関係の調整
authorpanda <panda>
Tue, 4 Feb 2003 01:15:40 +0000 (10:15 +0900)
committerpanda <panda>
Tue, 4 Feb 2003 01:15:40 +0000 (10:15 +0900)
convert_html.php
pukiwiki.ini.php

index 8fcefca..7ed8f10 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: convert_html.php,v 1.11 2003/02/03 12:46:56 panda Exp $
+// $Id: convert_html.php,v 1.12 2003/02/04 01:15:40 panda Exp $
 //
 
 function &convert_html(&$lines)
@@ -575,10 +575,6 @@ class Pre extends Block
        function Pre($text)
        {
                parent::Block();
-               $tab = 8;
-               while (preg_match('/^([^\t]*)(\t+)(.+)$/',$text,$m)) {
-                       $text = $m[1].str_repeat(' ',strlen($m[2]) * $tab - strlen($m[1]) % $tab).$m[3];
-               }
                $this->elements[] = htmlspecialchars($text,ENT_NOQUOTES);
        }
        function canContain(&$obj)
@@ -610,12 +606,12 @@ class Div extends Block
        }
        function toString()
        {
-               if (preg_match("/^\#([^\(]+)(.*)$/",$this->text,$out) and exist_plugin_convert($out[1])) {
+               if (preg_match("/^\#([^\(]+)(.*)/",$this->text,$out) and exist_plugin_convert($out[1])) {
                        if ($out[2]) {
-                               $_plugin = preg_replace("/^\#([^\(]+)\((.*)\)$/ex","do_plugin_convert('$1','$2')",$this->text);
+                               $_plugin = preg_replace("/^\#([^\(]+)\((.*)\)/ex","do_plugin_convert('$1','$2')",$this->text);
                        }
                        else {
-                               $_plugin = preg_replace("/^\#([^\(]+)$/ex","do_plugin_convert('$1','$2')",$this->text);
+                               $_plugin = preg_replace("/^\#([^\(]+)/ex","do_plugin_convert('$1','$2')",$this->text);
                        }
                        $text = "\t$_plugin";
                }
@@ -674,12 +670,11 @@ class Body extends Block
                $last =& $this;
                
                foreach ($lines as $line) {
+                       
                        if (substr($line,0,2) == '//') { //¥³¥á¥ó¥È¤Ï½èÍý¤·¤Ê¤¤
                                continue;
                        }
                        
-                       $line = rtrim($line);
-                       
                        $align = '';
                        if (preg_match('/^(LEFT|CENTER|RIGHT):(.*)$/',$line,$matches)) {
                                $last =& $last->add(new Align(strtolower($matches[1]))); // <div style="text-align:...">
@@ -689,6 +684,8 @@ class Body extends Block
                                $line = $matches[2];
                        }
                        
+                       $line = preg_replace("/[\r\n]*$/",'',$line);
+                       
                        // ¹ÔƬʸ»ú
                        $head = substr($line,0,1);
                        
@@ -706,7 +703,7 @@ class Body extends Block
                        }
                        else {
                                if (substr($line,-1) == '~') {
-                                       $line .= "\r";
+                                       $line = substr($line,0,-1)."\r";
                                }
                                if      ($head == '-') { // UList
                                        $last =& $last->add(new UList($line)); // inline
@@ -770,7 +767,6 @@ class Body extends Block
                // ´ØÏ¢¤¹¤ë¥Ú¡¼¥¸
                // <p>¤Î¤È¤­¤Ï¹ÔƬ¤«¤é¡¢<del>¤Î¤È¤­¤Ï¾¤ÎÍ×ÁǤλÒÍ×ÁǤȤ·¤Æ¸ºß
                $text = preg_replace('/<(p|del)>#related<\/\1>/e','make_related($vars[\'page\'],\'$1\')',$text);
-               
                return $text;
        }
 }
index 150c919..4b2504d 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: pukiwiki.ini.php,v 1.20 2003/02/03 12:46:56 panda Exp $
+// $Id: pukiwiki.ini.php,v 1.21 2003/02/04 01:15:40 panda Exp $
 //
 // PukiWiki setting file
 
@@ -228,7 +228,7 @@ $line_rules = array(
 "'''(?!')((?:(?!''').)*)'''" => '<em>$1</em>',
 "''(?!')((?:(?!'').)*)''" => '<strong>$1</strong>',
 '&amp;(#[0-9]+|#x[0-9a-f]+|[0-9a-zA-Z]+);' => '&$1;',
-"~\r" => '<br />', /* ¹ÔËö¤Ë¥Á¥ë¥À¤Ï²þ¹Ô */
+"\r" => "<br />\n", /* ¹ÔËö¤Ë¥Á¥ë¥À¤Ï²þ¹Ô */
 '#related' => '<del>#related</del>',
 );