diff --git a/src/filters/rclrtf b/src/filters/rclrtf new file mode 100755 index 00000000..90f89e75 --- /dev/null +++ b/src/filters/rclrtf @@ -0,0 +1,74 @@ +#!/bin/sh +# @(#$Id: rclrtf,v 1.1 2005-11-21 16:05:07 dockes Exp $ (C) 2004 J.F.Dockes +# Some inspiration from estraier +#================================================================ +# rclrtf +# convert rtf to html, by executing the unrtf program: +# http://www.gnu.org/software/unrtf/unrtf.html +#================================================================ + + +# set variables +LANG=C ; export LANG +LC_ALL=C ; export LC_ALL +progname="rclrtl" + +# show help message +if test $# -ne 1 -o "$1" = "--help" +then + printf 'Convert RTF to HTML for Recoll input.\n' + printf 'Usage: %s [infile]\n' "$progname" + exit 1 +fi + +infile="$1" + +# check the input file existence +if test ! -f "$infile" +then + printf '%s: %s: no such file\n' "$progname" "$infile" + exit 1 +fi + +iscmd() +{ + cmd=$1 + case $cmd in + */*) + if test -x $cmd ; then return 0; else return 1; fi ;; + *) + oldifs=$IFS; IFS=":"; set -- $PATH; IFS=$oldifs + for d in $*;do test -x $d/$cmd && return 0;done + return 1 ;; + esac +} +checkcmds() +{ + for cmd in $*;do + if iscmd $cmd + then + a=1 + else + echo $cmd not found 1>&2 + exit 1 + fi + done +} +checkcmds awk unrtf + +# output the result +unrtf --nopict --html "$infile" 2> /dev/null | +awk ' +BEGIN { + gothead = 0 +} +/<\/head>/{ + if (gothead == 0) { + printf("\n") + gothead = 1 + } +} +{ + print +} +' diff --git a/src/sampleconf/mimeconf b/src/sampleconf/mimeconf index c9d7b8c7..4401cd5b 100644 --- a/src/sampleconf/mimeconf +++ b/src/sampleconf/mimeconf @@ -1,4 +1,4 @@ -# @(#$Id: mimeconf,v 1.9 2005-11-21 14:31:24 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: mimeconf,v 1.10 2005-11-21 16:05:07 dockes Exp $ (C) 2004 J.F.Dockes # Recoll : associations of mime types to processing filters. # There are different sections for decompression, 'interning' for indexing @@ -47,6 +47,8 @@ application/vnd.sun.xml.writer.template = exec rclsoff text/x-gaim-log = exec rclgaim +text/rtf = exec rclrtf + ## # External viewers, launched when you double-click a result entry [view] diff --git a/src/sampleconf/mimemap b/src/sampleconf/mimemap index f0abfe8a..08bd9df1 100644 --- a/src/sampleconf/mimemap +++ b/src/sampleconf/mimemap @@ -1,10 +1,12 @@ -# @(#$Id: mimemap,v 1.9 2005-11-21 14:31:24 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: mimemap,v 1.10 2005-11-21 16:05:07 dockes Exp $ (C) 2004 J.F.Dockes # Recoll: associations of file name extensions to mime types .txt = text/plain .text = text/plain .d = text/plain +.rtf = text/rtf + .html = text/html .htm = text/html .shtml = text/html diff --git a/src/sampleconf/recoll.conf b/src/sampleconf/recoll.conf index b0ddf742..0818da02 100644 --- a/src/sampleconf/recoll.conf +++ b/src/sampleconf/recoll.conf @@ -1,4 +1,4 @@ -# @(#$Id: recoll.conf,v 1.9 2005-11-21 14:31:24 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: recoll.conf,v 1.10 2005-11-21 16:05:07 dockes Exp $ (C) 2004 J.F.Dockes # Recoll default configuration file. This should be copied to # ~/.recoll/recoll.conf @@ -33,7 +33,7 @@ mimeconffile = mimeconf # you will have to copy the pngs from the distribution to wherever you want # to store them (the associations are decided in mimeconf) showicons = 1 -iconsdir = ~/.recoll +iconsdir = /usr/local/share/recoll/images # Where to store the database. dbdir = ~/.recoll/xapiandb