#!/usr/local/bin/perl -- # # link2html: # # Apr. 4,'96. OSHIRO Naoki. # # $Log: link2html,v $ # Revision 0.2 1996/05/14 09:10:47+09 oshiro # *** empty log message *** # # # [1996/04/26] # ・
 から " x $indent . "\n" if ($indent > 0);
	    $item="
  • "; # [1997/06/25] OSHIRO Naoki. added 1 line if (/^-+\s*/) { if ($opt_t) { print "$_\n"; } else { print "
    \n"; } } else { if ($opt_t) { print "$_\n"; } else { print "

    $_

    \n"; } } @spc=''; $indent=0; } next; } print " url:$_\n" if $debug; # # URL (http:) 処理 # ($spc, $url)=($1, $2); # URL(HTTP) 取得 $spc=&indent_check($spc, *spc) unless ($item eq "||"); last if (eof); print "[Get URL]:$url\n" if $debug; # 指定ファイルがカレントディレクトリにあるならば file: を除く $url=~s#^file:([^/])#$1#; # # ラベル処理 # do { # 行頭 "#" である # 日付である # ならばラベルでない $_=<>; # 次の行を取得 last if (eof); s/\t/ /g; &imgtag; } while (/^\s*#/ || /^\s*\[\d{4}\/\d{2}\/\d{2}\]/); # テスト中 $keep=$_; $next_item="
  • "; $next_item="||" if (s/^(\s*)\|+/$1/); # 行頭が '|' なら連結表示 if (/^(\s*)http:/ || !/^$spc\s/ # add "\s" for correction. [1997/06/29] || ($next_item eq "||") ) { print "!label:$_" if $debug; # 'http:' である # 行頭の空白が $spc と同じ,または,より小さい # 行頭 "||" である # ならばラベルでない print "$spc$item" . &basename($url) . "\n"; # $url のベースをラベルとして表示 $spc=&indent_check($spc, *spc) unless ($item eq "||"); $item=$next_item; $next_item="
  • "; # [1998/03/27] # $_=$keep; redo; # 取り込んだ行を処理しなおす } print " label:$_" if $debug; s/^\s*(.+)\s*/\1/; # ラベル取得 print "$spc$item$_\n"; $spc=&indent_check($spc, *spc) unless ($item eq "||"); $item=$next_item; } print "" x $indent . "\n" if ($indent>0); # 最後にラベルを閉じる @spc=''; $indent=0; &print_footer unless ($opt_t); sub indent_check { local($spc, *spc_pre)=@_; if ($debug) { print "spc:${spc}x\n"; foreach $_ (@spc_pre) { print "pre:${_}x\n"; } } for (;;) { return $spc_pre[0] if ($spc eq $spc_pre[0]); # 同じ深さなら何もしない. if ($spc gt $spc_pre[0]) { # 行頭の空白を以前のものと比較して大きければ print "$spc_pre[0] で閉じて shift(@spc_pre); $indent--; #インデントレベルを下げる } } } sub imgtag { local($spc, $file, $label); # 独自の img: タグを追加 [1997/11/28] OSHIRO Naoki. if (/(\s*)img:(.+\.(jpg|gif))\s(.*)\s*$/) { chop; ($spc, $file, $label)=($1, $2, $4); if ($label=~/^\s*$/) { $label=$file; $_=""; } else { $_=$label; } $_.="$spc\"$label\""; } else { s#img:(.+\.(p[pgb]m))\s#img:$1#g; } } # major-mode: perl