Namazu-users-ja(旧)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mhonarc で作ったページの著者



>                                            千葉市中央区長洲
>                                                    藤原  誠
藤原> 修正内容はすぐには出て来ないので、必要ならまた後で。

必要とは言われていないのですが、見つかったのでお送りしておき
ます。つけやきば adhoc なので、あまり中を良く見ないで欲しいな
と思ったり .... もっと正しく変更して欲しいと思ったり ..
---
(藤原)

--- mhonarc.pl.orig	Tue Jan 29 13:41:23 2002
+++ mhonarc.pl	Tue Jan 29 16:34:52 2002
@@ -1,6 +1,6 @@
 #
 # -*- Perl -*-
-# $Id: mhonarc.pl,v 1.23.8.1 2001/09/15 00:36:16 kenji Exp $
+# $Id: mhonarc.pl,v 1.4 2002/01/29 05:39:36 makoto Exp $
 # Copyright (C) 1997-2000 Satoru Takabayashi ,
 #               1999 NOKUBI Takatsugu All rights reserved.
 #     This is free software with ABSOLUTELY NO WARRANTY.
@@ -95,6 +95,7 @@
 # Assume a normal message files by MHonArc v2.1.0
 sub mhonarc_filter ($$) {
     my ($contref, $weighted_str) = @_;
+    my ($header) ;
 
     # It's useful to handle MHonArc message files.
     $$contref =~ s/<!--X-MsgBody-End-->.*//s;
@@ -103,15 +104,28 @@
 
     # Separate headers and a body message.
     $$contref =~ s/<!--X-Head-Body-Sep-Begin-->/\n/;
+    $$contref =~ s/<!--X-Head-of-Message-->.*<!--X-Head-of-Message-End-->//s;
 
+    $$contref =~ s/<!-- MHonArc v[0-9.]+ -->(.*)<!--X-Head-End-->//s;
+    $header   = $1;
+    $$contref =~ s/<HTML>.*<BODY [^>]*>//s;
+    $header   = XHeadertoheader($header);
+    if ( $header ) {
+	$$contref = $header . "\n" . $$contref ;
+    }
+    else  {
     # Handle a field consists of two or more lines.
     $$contref =~ s!^(<LI>)(.*?)(</LI>$)!$1 . lftospace($2) . $3!gemsi;
 
     # For plugging spaces before headers
     $$contref =~ s/^<LI>//gim;
+    }
 
     # Make header's name not to be indexed words.
     $$contref =~ s!</?EM>!!gi;
+    util::dprint(_("contref after mhonarc:\n ").$$contref."\n");
+    util::dprint(_("header after mhonarc:\n ").$header."\n");
+
     $$contref =~ s/^\s+//;
 }
 
@@ -120,4 +134,22 @@
     $str =~ s/[\r\n]/ /g;
     return $str;
 }
+sub XHeadertoheader($) {
+    my ($str) = @_;
+    $str =~ s/<!--X-From-R13: (.*) -->\n<!--X-Date: .*([MTWFS][ouehrau][neduitn],.*)-->\n<!--X-Me/<!--X-Me/;
+    my ($from) = unrot13($1);
+    my ($date) = $2;
+    $str =~ s/<!--X-//g;
+    $str =~ s/-->//g;		  
+    $str .= "From: ".$from."\n";
+    $str .= "Date: ".$date."\n";
+    $str =~ s/&#45;/-/g;   # &#45 -> (-)
+    return $str;
+}
+sub unrot13 ($) {
+    my $str = shift;
+    $str =~ tr/N-Z[@A-Mn-za-m/@A-Z[a-z/;
+#   $str =~ tr/@A-Z[a-z/N-Z[@A-Mn-za-m/;
+    $str;
+    }
 1;