#!/usr/bin/env ruby
require "rexml/document"
require "#{ENV['TM_SUPPORT_PATH']}/lib/textmate.rb"
include REXML
string = ENV['TM_CURRENT_LINE'].dup
if !string.empty?
if !string.include?('script')
r = string.scan(/\/\>/)
if r.length == 0
string.chop!
string << "/>"
end
end
if ENV['TM_FILEPATH']
current_path = File.dirname(ENV['TM_FILEPATH'].dup)
puts ENV['TM_PROJECT_DIRECTORY']
doc = Document.new string
if doc.root
path = doc.root.attributes['href'] || doc.root.attributes['src'] || doc.root.attributes['template']
if ENV['TM_PROJECT_DIRECTORY']
current_path = ENV['TM_PROJECT_DIRECTORY'].dup
end
puts file_path = current_path + '/' + path
TextMate.go_to :file => file_path
end
end
end
#===========