Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Er, I forgot to 'add' before my 'commit'. Well, some have said that I…

… have commitment problems :-)

git-svn-id: http://svn.textmate.org/trunk/Bundles/Gri.tmbundle@1457 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit 0b1514dce1ce414c51947d29cde3f14530789a0b 1 parent f478e38
Dan Kelley authored
Showing with 136 additions and 0 deletions.
  1. +84 −0 Commands/Gri and view.plist
  2. +52 −0 Snippets/Gri logo.plist
View
84 Commands/Gri and view.plist
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//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># 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}
+
+GRI=gri
+DIR=`dirname "$TM_FILEPATH"`
+FILE=`basename "$TM_FILEPATH"`
+PSFILE=`basename $FILE .gri`.ps
+PDFFILE=`basename $FILE .gri`.pdf
+CWD="`pwd`/"
+
+# 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;";
+gri -output ${DIR}/${PSFILE} ${TM_FILEPATH};
+RC=$?
+if (($RC != 0)); then exit; fi
+echo "convert ${DIR}/$PSFILE ${DIR}/$PDFFILE";
+echo "&lt;BR&gt;";
+convert "${DIR}/$PSFILE" "${DIR}/$PDFFILE";
+
+# View...
+if [ "$V" == html ]; then
+ if [ -s "${PDFFILE}" ]; then
+ WEB_LOC="tm-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>keyEquivalent</key>
+ <string>@r</string>
+ <key>name</key>
+ <string>Gri and view</string>
+ <key>output</key>
+ <string>showAsHTML</string>
+ <key>scope</key>
+ <string>text.gri</string>
+ <key>uuid</key>
+ <string>41A8F343-48CB-482E-A395-34C31CE9A5AB</string>
+</dict>
+</plist>
View
52 Snippets/Gri logo.plist
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>//
+// `date`
+// ${1:Dan Kelley}
+//
+set x size 5
+set y size 5
+set y margin 20
+set x axis 0 1 0.25
+set y axis 0 20 10
+set font size 0
+\\background_color = "hsb 0.6 0.2 1.0"
+\\line_color = "red"
+\\word_color = "rgb 0.0 0.1 0.6"
+
+read columns x y
+0.0 12.5
+0.25 19
+0.5 12
+0.75 15
+1 13
+
+draw axes none
+set color \\background_color
+set line width axis rapidograph 6
+draw curve filled to ..ybottom.. y
+set color black
+#draw axes frame
+
+set color \\line_color
+set line width 10
+draw curve
+
+set color \\word_color
+set font size 100
+set font to Helvetica
+draw label "Gri" at 0.05 1.3
+</string>
+ <key>name</key>
+ <string>Icon (icon)</string>
+ <key>scope</key>
+ <string>source.gri</string>
+ <key>tabTrigger</key>
+ <string>icon</string>
+ <key>uuid</key>
+ <string>68248C77-9EB9-4B05-BEA6-162719D55AE0</string>
+</dict>
+</plist>
Please sign in to comment.
Something went wrong with that request. Please try again.