Skip to content

Instantly share code, notes, and snippets.

@jbueza
Created May 11, 2010 21:13
Show Gist options
  • Save jbueza/397891 to your computer and use it in GitHub Desktop.
Save jbueza/397891 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$: << ENV['TM_SUPPORT_PATH'] + '/lib'
require 'escape'
def esc(str)
e_sn(str).gsub(/\}/, '\\}') # escaping inside a placeholder
end
s = STDIN.read
if s.empty? then
print "<strike>$1</strike>"
elsif s =~ /^\*{2}(.*)\*{2}$/ then
print "${1:#{esc $1}}"
elsif ENV.has_key? 'TM_SELECTED_TEXT'
print "${1:<strike>#{esc s}</strike>}"
else
print "<strike>#{e_sn s}</strike>"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment