#!/bin/bash

for file in /home/khelleb/swigra/test-corpus/corpus-dev/*/*/*
do
    echo $file
    base=`basename $file .xml`
    dir=`dirname $file`
    rm test.tex test.pdf 2>/dev/null
    swipl -g "[semgra], parse(\"$file\")." -t "halt."
    pdflatex test.tex >/dev/null
    if [ -e test.pdf ]; then
	echo "mv test.pdf $dir/$base.pdf"
        mv test.pdf $dir/$base.pdf
    else
	echo "Porażka"
    fi
done

for file in /home/khelleb/swigra/test-corpus/corpus-test/*/*/*
do
    echo $file
    base=`basename $file .xml`
    dir=`dirname $file`
    rm test.tex test.pdf 2>/dev/null
    swipl -g "[semgra], parse(\"$file\")." -t "halt."
    pdflatex test.tex >/dev/null
    if [ -e test.pdf ]; then
	echo "mv test.pdf $dir/$base.pdf"
        mv test.pdf $dir/$base.pdf
    else
	echo "Porażka"
    fi
done


