空白を含むページ名があると,touchgraphのファイル形式が空白を,要素の区切りと見なすため,複数のページがあると解釈されてしまいます. 空白をアンダースコアに変えるなどして,回避できるかとも思いましたが,TGWikiBrowserのページの呼び出しにも使われているのでうまくいきませんでした.
自分でどうにかしてみました.TGWikiBrowserのソースを見てみたところ,空白文字はどうしてもエスケープできないようです.
TGWikiBrowser の方にもパッチが必要という制限があるので,以下のパッチを採用いただけるかどうかは,開発者の方々におまかせします.
使用例は,見にくいですが http://www.neurosci.aist.go.jp/ibisforest/index.php?TGWikiBrowser です.
そこで,touchgraph プラグインの方で,空白を %20 に変換し,TGWikiBrowser の方で元に戻すパッチを作りました.
%20 への変換だと,TGWikiBrowser にパッチがなくても,とりあえずWikiのノードが分割される問題は回避でき,%20 がそのまま見えてしまうだけですみます.
Pukiwiki 1.4.6 の plugin/touchgraph.inc.php 用
--- touchgraph.inc.php.orig Thu Apr 13 18:04:32 2006 +++ touchgraph.inc.php Thu Apr 13 18:05:42 2006 @@ -40,11 +40,11 @@ $file = CACHE_DIR . encode($page) . '.rel'; if (file_exists($file)) { - echo $page; + echo str_replace(' ', '%20', $page); $data = file($file); foreach(explode("\t", trim($data[0])) as $name) { if (preg_match($non_list_pattern, $name)) continue; - echo ' ', $name; + echo ' ', str_replace(' ', '%20', $name); } echo "\n"; } @@ -62,11 +62,11 @@ $file = CACHE_DIR . encode($page) . '.ref'; if (file_exists($file)) { - echo $page; + echo str_replace(' ', '%20', $page); foreach (file($file) as $line) { list($name) = explode("\t", $line); if (preg_match($non_list_pattern, $name)) continue; - echo ' ', $name; + echo ' ', str_replace(' ', '%20', $name); } echo "\n"; }
TGWikiBrowser 1.0.2 用
--- com/touchgraph/wikibrowser/TGWikiBrowser.java.orig 2006-04-13 19:11:29.000000000 +0900 +++ com/touchgraph/wikibrowser/TGWikiBrowser.java 2006-04-13 19:10:05.000000000 +0900 @@ -166,7 +166,7 @@ private String generateNodeLabel(String labelOrUrl) { if(!labelOrUrl.startsWith("http://")) { - return labelOrUrl; //It's a label + return labelOrUrl.replaceAll("%20", " "); //It's a label } else { // Create a label from the URL String urlString = labelOrUrl;