--- t2m.pl.org 2009-04-04 10:38:05.000000000 +0900 +++ t2m.pl 2009-04-04 10:42:13.000000000 +0900 @@ -1,5 +1,8 @@ #!/usr/bin/perl # +# original script at http://fumi.me/2009/02/10/tdiary-to-wordpress/ +# modified by Kazuo Kohchi at 2009-04-04 +# # original script at http://kenstar.org/~kenstar/computer/program/t2m.html # modified by Fumihiro Kato at 2009-02-09 # @@ -22,7 +25,11 @@ binmode(STDOUT, ":utf8"); -$author="fumi"; +$author="wordpressauthorname"; +#$post_status = "Draft"; +$post_status = "Publish"; +$my_category = "originalcategoryname"; +#$DEBUG2 = 1; #画像の移行を行うばあいは設定必須 ${tdiary_imags_dir}="/home/kenstar/public_html/tdiary/images"; @@ -42,7 +49,7 @@ print << "__DIARY_FST__"; AUTHOR: $author TITLE: $title -STATUS: Draft +STATUS: $post_status ALLOW COMMENTS: 1 CONVERT BREAKS: __default__ ALLOW PINGS: 1 @@ -167,7 +174,7 @@ # MTの日付け書式に変換 $p_date = sprintf "%02d/%02d/%02d", ${mon}, ${day}, ${year}; }elsif(/Title: (.*)/){ -# $title{$diary_key}=$1; + $title{$diary_key}=$1; }elsif(/Last-Modified/){ # 無視 }elsif(/^Visible: (.*)/){ @@ -178,7 +185,7 @@ } # 無視 }elsif($title_switch==1){ - # 空行の次だったのでタイトルとして使用 + # 空行の次だったのでサブタイトルとして使用 $key++; $diary_key = "${date}-${key}"; @@ -393,7 +400,7 @@ print "$opt_d\n" if $DEBUG; &read_tdiary("${opt_d}2"); -&read_comment("${opt_d}c"); +&read_comment("${opt_d}r"); if ($opt_n){ @@ -423,8 +430,13 @@ print "D $key : $title{$key}\n" if $DEBUG2; print "D $date{$key}\n" if $DEBUG2; print "D $body{$key}\n" if $DEBUG2; + if($key =~ /-0$/) { + $mytitle = $title{$key}; + } if($visible{$key}==1){ - &print_body($title{$key}, $date{$key}, $body{$key}, $category{$key}); + $mybody = "

$title{$key}

\n$body{$key}"; + &print_body($mytitle, $date{$key}, $mybody, + $category{$key} ? $category{$key} : $my_category); # print つっこみ