Permalink
Browse files

Added preview command, largely heisted from Textile bundle

Signed-off-by: alkemist <ld@ldaley.com>
  • Loading branch information...
1 parent 0822790 commit a4dd3c15a9cfcfc6c9d455ed1ce3892605ca868a @purp purp committed with Jun 3, 2009
Showing with 1,182 additions and 0 deletions.
  1. +42 −0 Commands/Preview.tmCommand
  2. +10 −0 Support/bin/Preview.rb
  3. +1,130 −0 Support/lib/redcloth.rb
View
@@ -0,0 +1,42 @@
+<?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>nop</string>
+ <key>command</key>
+ <string>. "$TM_SUPPORT_PATH/lib/html.sh"
+
+if [[ -z $TM_FILENAME ]]
+ then title="Textile as HTML"
+ else title="${TM_FILENAME%.*} as HTML"
+fi
+
+htmlHeader "$title" '&lt;style type="text/css"&gt;
+ body {
+ background-color: #eee;
+ }
+ .contents {
+ background: white;
+ font-family: Verdena, sans-serif;
+ font-size: 13px;
+ border: 1px #888 solid;
+ padding: 0 1em;
+ }
+ &lt;/style&gt;'
+beginTag div 'contents'
+ "$TM_BUNDLE_SUPPORT/bin/Preview.rb"
+endTag
+htmlFooter</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>keyEquivalent</key>
+ <string>^~@p</string>
+ <key>name</key>
+ <string>Preview</string>
+ <key>output</key>
+ <string>showAsHTML</string>
+ <key>uuid</key>
+ <string>EC3CA023-3BAC-446E-92E6-403353B9BA44</string>
+</dict>
+</plist>
View
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+begin
+ require 'redcloth'
+rescue LoadError
+ $LOAD_PATH << File.join(ENV['TM_BUNDLE_SUPPORT'], 'lib')
+ require 'redcloth'
+end
+
+puts(RedCloth.new($stdin.readlines.join()).to_html(:textile))
Oops, something went wrong.

0 comments on commit a4dd3c1

Please sign in to comment.