[Goodies-commits] r3651 - thunar-thumbnailers/trunk/tex-thumbnailer

Erlend Davidson erland at xfce.org
Thu Nov 29 02:37:33 CET 2007


Author: erland
Date: 2007-11-29 01:37:33 +0000 (Thu, 29 Nov 2007)
New Revision: 3651

Modified:
   thunar-thumbnailers/trunk/tex-thumbnailer/tex-thumbnailer
Log:
Hopefully fixed bug #3608: latex thumbnails will only be generated when 
\begin{document} and \end{document} are present.

It would be better to find a way of making these documents compile (i.e. 
inserting \begin \end in the right place) but it's difficult to do 
reliably.


Modified: thunar-thumbnailers/trunk/tex-thumbnailer/tex-thumbnailer
===================================================================
--- thunar-thumbnailers/trunk/tex-thumbnailer/tex-thumbnailer	2007-11-28 22:37:02 UTC (rev 3650)
+++ thunar-thumbnailers/trunk/tex-thumbnailer/tex-thumbnailer	2007-11-29 01:37:33 UTC (rev 3651)
@@ -32,6 +32,20 @@
 # the output file will be called ${file}.dvi where ${file}=`basename $ifile .tex`
 file=`basename "${ifile}" .tex`
 
+# check we have \begin{document} and \end{document}
+C1=`grep -c "begin{document}" "${ifile}"`
+C2=`grep -c "end{document}" "${ifile}"`
+
+if [ $C1 -lt "1" ]; then
+    echo "tex-thumbnailer: no \begin{document}"
+    exit 1
+fi
+
+if [ $C2 -lt "1" ]; then
+    echo "tex-thumbnailer: no \end{document}"
+    exit 1
+fi
+
 latex -interaction=nonstopmode -output-directory=/tmp/${file} "$ifile"
 
 if [ ! -f ${tmpfile} ]; then




More information about the Goodies-commits mailing list