Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (101 sloc) 2.87 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] &amp;&amp; . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
# Run Gri, convert the PostScript to PDF, and then show the latter.
# The code is patterned on that for the "LaTeX and view" command.
# GPL 2005 Dan Kelley.
# (I hope it's OK to GPL something in TM!)
. "${TM_SUPPORT_PATH}/lib/html.sh"
# The comment and line below are copied from the "LaTeX and view" command.
# Get the viewer program. Any program (that works with open -a &lt;name&gt;) can be used,
# except 'html' which is reserved to mean the internal HTML window. This is also the
# default option.
V=${TM_LATEX_VIEWER:=html}
DIR=`dirname "$TM_FILEPATH"`
FILE=`basename "$TM_FILEPATH"`
PSFILE=`basename "$FILE" .gri`.ps
PDFFILE=`basename "$FILE" .gri`.pdf
CWD="`pwd`/"
TOPDF="epstopdf"
# Switch to the right directory.
cd "$TM_PROJECT_DIRECTORY"
cd "$DIR"
# Prepare output window.
htmlHeader "Running Gri on file ${FILE}"
echo "&lt;h1&gt;Running Gri on ${FILE}...&lt;/h1&gt;";
# Function to close window if the error level is low enough.
close() {
if (($RC == 0)); then closeWindow; fi
}
# Compile. Bail out on errors.
echo "gri -output ${DIR}/${PSFILE} ${TM_FILEPATH}";
echo "&lt;BR&gt;";
"${TM_GRI:-gri}" -output "${DIR}/${PSFILE}" "${TM_FILEPATH}";
RC=$?
if (($RC != 0)); then exit; fi
echo "${TOPDF} ${DIR}/$PSFILE ${DIR}/$PDFFILE";
echo "&lt;BR&gt;";
${TOPDF} "${DIR}/$PSFILE" &gt; "${DIR}/$PDFFILE";
# View...
if [ "$V" == html ]; then
if [ -s "${PDFFILE}" ]; then
WEB_LOC="file://${DIR}/${PDFFILE}"
if (($RC != 0)); then
link "${WEB_LOC}" 'Click Here to Preview'
else
redirect "${WEB_LOC}"
fi
else
strong "Error: PDF file not written to disk"
fi
htmlFooter
else
echo "HUH?&lt;br&gt;"
open -a "$V" "${DIR}/${PDFFILE}"
close
fi
</string>
<key>input</key>
<string>none</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@b</string>
<key>name</key>
<string>Gri and View</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>html</string>
<key>outputLocation</key>
<string>newWindow</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>gri</string>
<key>locations</key>
<array>
<string>/opt/local/bin/gri</string>
<string>/usr/local/bin/gri</string>
</array>
<key>variable</key>
<string>TM_GRI</string>
</dict>
</array>
<key>scope</key>
<string>source.gri</string>
<key>semanticClass</key>
<string>process.build.gri</string>
<key>uuid</key>
<string>41A8F343-48CB-482E-A395-34C31CE9A5AB</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
Jump to Line
Something went wrong with that request. Please try again.