最近、DanaのLauncherにセットして使っているもの。言語仕様を一通り使って動くので公開。
日記マークアップ言語dml仕様
%categories = ( "rn" => "更新履歴", "cw" => "Cygwin", "ps" => "PS2 Linux", "com" => "コミュニケーション", "ai" => "A.I.", "book" => "蔵書目録", "awking" => "AWKING Project", "awk" => "AWK", "net" => ".net", "os" => "Operating System", "tt" => "立花 隆", "perl" => "Perl", "ruby" => "Ruby", "tcl" => "Tcl/Tk", "python" => "Python", "prolog" => "Prolog", "linux" => "Linux", "printing" => "Printing", "hiroshima" => "ひろしま", "an" => "ArrangeNote", "qnx" => "QNX", "web" => "Web Development", "diary" => "日記", "scheme" => "Scheme", "tsn" => "TS Network", "tip" => "Tips", "col" => "コラム", "xml" => "XML", "vm" => "VMware", "freebsd" => "FreeBSD", "computing" => "Computing", "lang" => "言語", "card" => "カード", "oo" => "OpenOffice", "sf" => "SF", "wbh" => "WinBatchEh", ); $title = ""; $category = ""; sub linking{ $id = time; $_[0] =~ s/\[U:\s+([^;]+);T:\s+([^\]]+)\]/<a href="$1">$2<\/a>/gi; $_[0] =~ s/\[N:\s+([^;]+);T:\s+([^\]]+)\]/<a name="${1}_$id">$2<\/a>/gi; $_[0] =~ s/\[U:\s+([^;\]]+)\]/<a href="$1">$1<\/a>/i; $_[0] =~ s/\[I:\s+([^;\]]+)\]/<IMG SRC="$1" ALIGN=CENTER HSPACE=20 ALT="$1">/i; $_[0] =~ s/^\[U:\s+([^;]+);I:\s+([^;]+);T:\s+([^\]]+)\]$/<a href="$1"><IMG SRC="$2" ALIGN=CENTER HSPACE=20 ALT="$2"><\/a>$3/i; $_[0] =~ s/^\[U:\s+([^;]+);I:\s+([^;]+);U:\s+([^;]+);T:\s+([^\]]+)\]$/<a href="$1"><IMG SRC="$2" ALIGN=CENTER HSPACE=20 ALT="$2"><\/a><a href="$3">$4<\/a>/i; return $_[0]; } while(<>){ chomp; if(/^DA:$/i){ $thisday = ("Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat.")[(localtime)[6]]; $mon = (localtime)[4] + 1; $mday = (localtime)[3]; $year = (localtime)[5] + 1900; print "<DT>$mon/$mday/$year ($thisday)<DD>\n"; }elsif(/^C:\s+(.+)$/i){ $category = $1; if($title ne ""){ $catid = time; print "<div class=\"emph\"><A HREF=\"renewal_index.html#$category\">[$categories{$category}]</A> <A NAME=\"${category}_$catid\">$title</A></div>\n"; $title = ""; } }elsif(/^T:\s+(.+)$/i){ $title = $1; $title =~ s/\[U:\s+([^;]+);T:\s+([^\]]+)\]/<a href="$1">$2<\/a>/i; $title =~ s/\[U:\s+([^;\]]+)\]/<a href="$1">$1<\/a>/i; if($category ne ""){ $catid = time; print "<div class=\"emph\"><A HREF=\"renewal_index.html#$category\">[$categories{$category}]</A> <A NAME=\"${category}_$catid\">$title</A></div>\n"; $category = ""; } }elsif(/^DE:\s+(.+)$/i){ $cont = $1; $description = &linking($cont); print "<p>$description</p>\n"; }elsif(/^PRE:$/i){ print "<pre>\n"; $pre = 1; next; }elsif(/^\/PRE:/i){ print "</pre>\n"; $pre = 0; next; }elsif(/^HTML:$/i){ $html = 1; next; }elsif(/^\/HTML:$/i){ $html = 0; next; }elsif(/^UL:$/i){ print "<ul>\n"; $ul = 1; next; }elsif(/^\/UL:$/i){ print "</ul>\n"; $ul = 0; next; }elsif(/^OL:$/i){ print "<ol>\n"; $ol = 1; next; }elsif(/^\/OL/i){ print "</ol>\n"; $ol = 0; next; } if($pre == 1){ s/</</g; s/>/>/g; print $_, "\n"; } if($html == 1){ print $_, "\n"; } if($ul == 1){ $str = &linking($_); print "<li>$str\n"; } if($ol == 1){ $str = &linking($_); print "<li>$str\n"; } }