Namazu-users-ja(旧)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: msword.pl
In message <200112280845.fBS8jjG20060@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
on Fri, 28 Dec 2001 17:45:45 +0900,
Takahiro Kambe <taca@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> > あと、$wordconvpath に doccat が含まれることもありますが、この対策は大
> > 丈夫なのでしょうか。
> ちょっと見直します。
見直しました。
--
神戸 隆博(かんべ たかひろ) at home
$NetBSD$
--- filter/excel.pl.orig Fri Dec 15 14:37:41 2000
+++ filter/excel.pl
@@ -26,6 +26,7 @@
package excel;
use strict;
+use File::Basename;
use File::Copy;
require 'util.pl';
require 'gfilter.pl';
@@ -33,13 +34,15 @@
my $xlconvpath = undef;
my $utfconvpath = undef;
+my $convname = undef;
sub mediatype() {
return ('application/excel');
}
sub status() {
- $xlconvpath = util::checkcmd('xlHtml');
+ $xlconvpath = util::checkcmd('xlhtml') or util::checkcmd('xlHtml');
+ $convname = basename($xlconvpath);
# return 'no' unless defined $xlconvpath;
if (defined $xlconvpath) {
if (!util::islang("ja")) {
@@ -83,7 +86,7 @@
= @_;
my $err = undef;
- if (util::checkcmd('xlHtml')) {
+ if ($convname =~ /xlhtml/i) {
$err = filter_xl($orig_cfile, $cont, $weighted_str, $headings, $fields);
} else {
$err = filter_doccat($orig_cfile, $cont, $weighted_str, $headings, $fields);
$NetBSD$
--- filter/msword.pl.orig Fri Jul 13 10:14:26 2001
+++ filter/msword.pl
@@ -25,6 +25,7 @@
package msword;
use strict;
+use File::Basename;
use File::Copy;
require 'util.pl';
require 'gfilter.pl';
@@ -33,6 +34,7 @@
my $wordconvpath = undef;
my $utfconvpath = undef;
my $wvversionpath = undef;
+my $wordconvname = undef;
sub mediatype() {
return ('application/msword');
@@ -80,7 +82,10 @@
= @_;
my $err = undef;
- if (util::checkcmd('wvHtml')) {
+ if (not defined $wordconvname) {
+ $wordconvname = basename($wordconvpath);
+ }
+ if ($wordconvname =~ /wvhtml/i) {
$err = filter_wv($orig_cfile, $cont, $weighted_str, $headings, $fields);
} else {
$err = filter_doccat($orig_cfile, $cont, $weighted_str, $headings, $fields);
@@ -95,7 +100,7 @@
my $tmpfile = util::tmpnam('NMZ.word');
my $tmpfile2 = util::tmpnam('NMZ.word2');
-
+ my ($ofile, $tpath, $options, $version);
if (util::islang("ja")) {
}
@@ -107,8 +112,17 @@
print $fh $$cont;
}
+ $version = `$wordconvpath --version 2>/dev/null`;
+ chomp $version;
+ if ($version ne "" and $version !~ /usage/i and $version ge "0.7") {
+ ($ofile, $tpath) = fileparse($tmpfile2);
+ $options = "--targetdir=$tpath";
+ } else {
+ $ofile = $tmpfile2;
+ }
+
if (!util::islang("ja")) {
- system("$wordconvpath $tmpfile $tmpfile2");
+ system("$wordconvpath $options $tmpfile $ofile");
} else {
my $version = "unknown";
my $supported = undef;
@@ -125,7 +139,7 @@
}
}
return _("Unsupported format: ") . $version unless $supported;
- system("$wordconvpath $tmpfile $tmpfile2");
+ system("$wordconvpath $options $tmpfile $ofile");
system("$utfconvpath -Iu8 -Oej $tmpfile2 > $tmpfile");
unlink($tmpfile2);
rename($tmpfile, $tmpfile2);
$NetBSD$
--- filter/powerpoint.pl.orig Tue Dec 26 13:59:01 2000
+++ filter/powerpoint.pl
@@ -25,6 +25,7 @@
package powerpoint;
use strict;
+use File::Basename;
use File::Copy;
require 'util.pl';
require 'gfilter.pl';
@@ -32,13 +33,15 @@
my $pptconvpath = undef;
my $utfconvpath = undef;
+my $pptconvname = undef;
sub mediatype() {
return ('application/powerpoint');
}
sub status() {
- $pptconvpath = util::checkcmd('pptHtml');
+ $pptconvpath = util::checkcmd('ppthtml') or util::checkcmd('pptHtml');
+ $pptconvname = basename($pptconvpath);
# return 'no' unless defined $pptconvpath
if (defined $pptconvpath) {
if (!util::islang("ja")) {
@@ -82,7 +85,7 @@
= @_;
my $err = undef;
- if (util::checkcmd('pptHtml')) {
+ if ($pptconvname =~ /ppthtml/i) {
$err = filter_ppt($orig_cfile, $cont, $weighted_str, $headings, $fields);
} else {
$err = filter_doccat($orig_cfile, $cont, $weighted_str, $headings, $fields);