[TxMt] context output to html

Allan Odgaard allan at macromates.com
Wed Apr 6 09:11:48 UTC 2005

On Apr 5, 2005, at 19:08, Robert Ullrey wrote:

> # If PDF file exists and not empty, display it. This is were I loose 
> it!
> [ -s ${tmp}.pdf ] && echo '</pre><meta http-equiv="Refresh"
> content="0;URL=file:///'${tmp}'.pdf">'

The “[ -s <file> ]” tests for the existence of <file> AND that <file> 
has a size greater than 0. If this condition is true, it will perform 
the echo and output the redirect-line. A more verbose version would be:

    if [ -s ${tmp}.pdf ]; then
       echo '</pre><meta http-equiv="Refresh" 

(I'm misusing the lazy/short-cut nature of the && operator as an 

> The command runs fine and displays the log file as it should, but does 
> not load the PDF. At the end of the context log, the output that 
> texexec registers is:
> Output written on c_position_authority.pdf (1 page, 7354 bytes).
> This is the name I gave to the original file, not texexecpdf.xxxxxxxx. 
> Should it be?

Well, the redirect (written using the echo) should at least point to 
the proper PDF file, the same goes for the if.

So I'm thinking the line should be something like:
    pdf=`basename "$TM_LATEX_MASTER"`.pdf
    [ -s $pdf ] && echo '</pre><meta http-equiv="Refresh" 

More information about the textmate mailing list