#!/bin/bash

# *Very* simple script to run Writer2LaTeX (unix version)
# Created by Henrik Just, october 2003
# modified by JB

W2LPATH="/usr/share/java/"

JAVAEXE="java"

W2LCONFIG="/home/baron/journ/jdm.xml"
# W2LCONFIG="/home/baron/bin/writer2latex05/clean.xml"

if [ -f $1.doc ]
then
    unoconv -f odt $1.doc
fi

if [ -f $1.docx ]
then
    unoconv -f odt $1.docx
#     unoconv -f doc $1.docx
fi

unoconv -f html $1.odt
elinks $1.html > ms.txt
$JAVAEXE -jar $W2LPATH/writer2latex.jar -config $W2LCONFIG $1.odt tmp1.tex
sed -f /home/baron/journ/w2l.sed tmp1.tex > $1.tex
/bin/rm $1.odt $1.html $1_html_* tmp1-img* tmp1.tex
# wvCleanLatex $1.doc tmp.tex
# java -jar /usr/share/java/writer2latex.jar -clean tmp1.tex
