Re: [gedit-list] Making an external tool to Metapost compiling



Denis LE FUR wrote:
Hello,

I try to make an external tool that compile a metapost file and show the n creates figures in a file name mproof.pdf. The problem is the variable number of figures ... This code works as far as 6 figures, which is fine normally.

I am very bad in bash stuff. I need some help to improve this tool.
You don't have to write the tool in bash though, pick any interpreted language (python, ruby, perl, php). That said, it seems what you need is either a for loop, or a better way of extracting the used images in your document (e.g. regex over the document from your tool). If you insist on writing it in bash, take a look here: http://tldp.org/LDP/abs/html/loops1.html


Jesse

-----------------------------------------------------------
#!/bin/sh
# [Gedit Tool]
# Comment=Mpost
# Name=Mpost
# Shortcut=F12
# Applicability=all
# Input=nothing
# Output=output-panel

xdotool key "ctrl+s"
mpost "$GEDIT_CURRENT_DOCUMENT_NAME"
i="$GEDIT_CURRENT_DOCUMENT_NAME"
j=${i%.*}
if [ -f "$j.6" ]; then tex mproof "$j.1" "$j.2" "$j.3" "$j.4" "$j.5" "$j.6"
elif [ -f "$j.5" ];
then tex mproof "$j.1" "$j.2" "$j.3" "$j.4" "$j.5" elif [ -f "$j.4" ]; then tex mproof "$j.1" "$j.2" "$j.3" "$j.4" elif [ -f "$j.3" ]; then tex mproof "$j.1" "$j.2" "$j.3" elif [ -f "$j.2" ]; then tex mproof "$j.1" "$j.2" elif [ -f "$j.2" ]; then tex mproof "$j.1" "$j.2" else tex mproof "$j.1"
fi
dvips -ta4 mproof.dvi -o
ps2pdf mproof.ps <http://mproof.ps>
evince mproof.pdf&
-----------------------------------------------------------------------------------------

Thank you


--
Denis LE FUR
dlefur gmail com <mailto:dlefur gmail com>

http://mathsp.tuxfamily.org/
------------------------------------------------------------------------

_______________________________________________
gedit-list mailing list
gedit-list gnome org
http://mail.gnome.org/mailman/listinfo/gedit-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]