add support for rtf
This commit is contained in:
parent
2aedcddb9b
commit
dc67c31a5d
74
src/filters/rclrtf
Executable file
74
src/filters/rclrtf
Executable file
@ -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("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO8859-1\">\n")
|
||||||
|
gothead = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
print
|
||||||
|
}
|
||||||
|
'
|
||||||
@ -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.
|
# Recoll : associations of mime types to processing filters.
|
||||||
# There are different sections for decompression, 'interning' for indexing
|
# 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/x-gaim-log = exec rclgaim
|
||||||
|
|
||||||
|
text/rtf = exec rclrtf
|
||||||
|
|
||||||
##
|
##
|
||||||
# External viewers, launched when you double-click a result entry
|
# External viewers, launched when you double-click a result entry
|
||||||
[view]
|
[view]
|
||||||
|
|||||||
@ -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
|
# Recoll: associations of file name extensions to mime types
|
||||||
.txt = text/plain
|
.txt = text/plain
|
||||||
.text = text/plain
|
.text = text/plain
|
||||||
.d = text/plain
|
.d = text/plain
|
||||||
|
|
||||||
|
.rtf = text/rtf
|
||||||
|
|
||||||
.html = text/html
|
.html = text/html
|
||||||
.htm = text/html
|
.htm = text/html
|
||||||
.shtml = text/html
|
.shtml = text/html
|
||||||
|
|||||||
@ -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 default configuration file. This should be copied to
|
||||||
# ~/.recoll/recoll.conf
|
# ~/.recoll/recoll.conf
|
||||||
@ -33,7 +33,7 @@ mimeconffile = mimeconf
|
|||||||
# you will have to copy the pngs from the distribution to wherever you want
|
# you will have to copy the pngs from the distribution to wherever you want
|
||||||
# to store them (the associations are decided in mimeconf)
|
# to store them (the associations are decided in mimeconf)
|
||||||
showicons = 1
|
showicons = 1
|
||||||
iconsdir = ~/.recoll
|
iconsdir = /usr/local/share/recoll/images
|
||||||
|
|
||||||
# Where to store the database.
|
# Where to store the database.
|
||||||
dbdir = ~/.recoll/xapiandb
|
dbdir = ~/.recoll/xapiandb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user