OSDN Git Service

make_heading()関数の引数を参照渡しに変更、戻り値を固有見出し本体に変更
authorarino <arino>
Sat, 17 May 2003 11:18:22 +0000 (20:18 +0900)
committerarino <arino>
Sat, 17 May 2003 11:18:22 +0000 (20:18 +0900)
html.php
plugin/bugtrack.inc.php
plugin/ls2.inc.php

index 25ca475..510e1c4 100644 (file)
--- a/html.php
+++ b/html.php
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: html.php,v 1.75 2003/05/16 05:46:46 arino Exp $
+// $Id: html.php,v 1.76 2003/05/17 11:14:46 arino Exp $
 //
 
 // ËÜʸ¤ò½ÐÎÏ
@@ -286,13 +286,26 @@ function make_search($page)
 }
 
 // ¸«½Ð¤·¤òÀ¸À® (Ãí¼á¤äHTML¥¿¥°¤ò½üµî)
-function make_heading($str)
+function make_heading(&$str,$strip=TRUE)
 {
        global $NotePattern;
        
        // ¸«½Ð¤·¤Î¸ÇÍ­IDÉô¤òºï½ü
-       $str = preg_replace('/^\*{0,3}(.*?)\[#[A-Za-z][\w-]+\](.*?)$/m','$1$2',$str);
+       $id = '';
+       if (preg_match('/^(\*{0,3})(.*?)\[#([A-Za-z][\w-]+)\](.*?)$/m',$str,$matches))
+       {
+               $str = ($strip ? '' : $matches[1]).$matches[2].$matches[4];
+               $id = $matches[3];
+       }
+       else
+       {
+               $str = ltrim($str,'*');
+       }
+       if ($strip)
+       {
+               $str = strip_htmltag(make_link(preg_replace($NotePattern,'',$str)));
+       } 
        
-       return strip_htmltag(make_link(preg_replace($NotePattern,'',$str)));
+       return $id; 
 }
 ?>
index 3001f13..066b5d9 100644 (file)
@@ -8,7 +8,7 @@
  * Êѹ¹ÍúÎò:
  *  2002.06.17: ºî¤ê»Ï¤á
  *
- * $Id: bugtrack.inc.php,v 1.13 2003/05/14 10:13:31 arino Exp $
+ * $Id: bugtrack.inc.php,v 1.14 2003/05/17 11:18:22 arino Exp $
  */
 
 function plugin_bugtrack_init()
@@ -263,7 +263,8 @@ function plugin_bugtrack_pageinfo($page,$no = NULL)
        }
        
        if (preg_match("/\*([^\n]+)/",$body,$matches)) {
-               $summary = make_heading($matches[1]);
+               $summary = $matches[1];
+               make_heading($summary);
        }
        
        return array($page, $no, $summary, $name, $priority, $state, $category);
index 4b3897d..a8120ac 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: ls2.inc.php,v 1.13 2003/05/16 05:54:35 arino Exp $
+// $Id: ls2.inc.php,v 1.14 2003/05/17 11:18:22 arino Exp $
 //
 
 /*
@@ -189,10 +189,11 @@ function ls2_get_headings($page,&$params,$level,$include = FALSE)
        {
                if ($params['title'] and preg_match('/^(\*{1,3})/',$line,$matches))
                {
+                       $id = make_heading($line);
                        $level = strlen($matches[1]);
                        $id = LS2_CONTENT_HEAD.$anchor++;
                        ls2_list_push($params,$level + strlen($level));
-                       array_push($params['result'], '<li>'.make_heading($line).
+                       array_push($params['result'], '<li>'.$line.
                                '<a href="'.$href.$id.'">'.$_ls2_messages['msg_go'].'</a>'
                        );
                }