adapt rcllyx to newer lyx which apparently always export utf-8

This commit is contained in:
Jean-Francois Dockes 2010-09-30 17:49:38 +02:00
parent 7b803170c2
commit 910f995530
2 changed files with 72 additions and 57 deletions

View File

@ -139,8 +139,22 @@ textfile=$workdir/`basename "$binfile" .lyx`.txt
#echo binfile: $binfile;echo lyxfile: $lyxfile ; ls -l $lyxfile; echo textfile: $textfile #echo binfile: $binfile;echo lyxfile: $lyxfile ; ls -l $lyxfile; echo textfile: $textfile
# Run lyx --export # Run lyx --export
lyx --export text "$lyxfile" lyx --export text "$lyxfile" || senderror "lyx --export not working"
# Need the lyx version. After some point -export prints utf-8,
# whatever the input version
LYXOUTPUTUTF=No
vline=`lyx --version 2>&1 | head -1 | tr '.' ' '`
set $vline
maj=`expr $2 '*' 10000` || senderror "Bad lyx version string $vline"
med=`expr $3 '*' 100` || senderror "Bad lyx version string $vline"
min=`expr $4 '*' 1` || senderror "Bad lyx version string $vline"
version=`expr $maj + $med + $min` || senderror "Bad lyx version string $vline"
if test $version -ge 10607 ; then
LYXOUTPUTUTF=Yes
fi
if test X$LYXOUTPUTUTF = XNo ; then
echo "OLD VERSION"
# Charset and language # Charset and language
formatline=`egrep '^\\\lyxformat ' "$lyxfile"` formatline=`egrep '^\\\lyxformat ' "$lyxfile"`
if test -n "$formatline" ; then if test -n "$formatline" ; then
@ -196,6 +210,8 @@ else
esac esac
fi fi
fi fi
# End Old lyx needing output tweaking
fi
if test -n "$charset" ; then if test -n "$charset" ; then
inputcmd="iconv -f $charset -t UTF-8 -c -s" inputcmd="iconv -f $charset -t UTF-8 -c -s"

View File

@ -5,12 +5,11 @@ topdir=`dirname $0`/..
initvariables $0 initvariables $0
recollq 'Bienvenue Dans Univers De Lyx' 2> $mystderr | (
egrep -v '^Recoll query: ' > $mystdout recollq 'Bienvenue Dans Univers De Lyx'
recollq 'Welcome To Lyx' 2>> $mystderr | recollq 'Welcome To Lyx'
egrep -v '^Recoll query: ' >> $mystdout recollq 'Udvozli Ont A LyX'
recollq 'Udvozli Ont A LyX' 2>> $mystderr | ) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout
egrep -v '^Recoll query: ' >> $mystdout
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1 diff -w ${myname}.txt $mystdout > $mydiffs 2>&1