Namazu-users-en(old)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: uninitialized value in substitution iterator
Earl> I was thinking of changing mhonarc.pl in Namazu to be smarter about
I have minor mod on mhonarc.pl to extract Date info from MHonArc generated
lines.
I am not sure this fits your requirement, but just for your information,
### we had some discussion after I have presented this patch, there may
be more some changes.. but I could not find easily... sorry
$NetBSD$
Index: filter/mhonarc.pl
===================================================================
RCS file: /a/j/tracking/namazu-tar/filter/mhonarc.pl,v
retrieving revision 1.2
retrieving revision 1.4
diff -u -r1.2 -r1.4
--- filter/mhonarc.pl 2002/02/23 06:15:55 1.2
+++ filter/mhonarc.pl 2002/02/23 11:29:06 1.4
@@ -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;
@@ -104,14 +105,26 @@
# Separate headers and a body message.
$$contref =~ s/<!--X-Head-Body-Sep-Begin-->/\n/;
+ $$contref =~ s/<!-- MHonArc v[0-9.]+ -->(.*)<!--X-Head-End-->//s;
+ $header = $1;
+ $$contref =~ s/<HTML>.*<BODY [^>]*>//s;
+ $header = XHeadertoheader($header);
+ if ( $header ) {
+ $$contref =~ s/(<!--X-Head-of-Message-->).*(<!--X-Head-of-Message-End-->)/$1$header$2/s;
+ }
+ 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 +133,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/-/-/g; # - -> (-)
+ 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;
---
Makoto Fujiwara,
Chiba, Japan, Narita Airport and Disneyland prefecture.