Created
March 26, 2009 12:30
-
-
Save perifer/86065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'cgi' | |
require ENV['TM_SUPPORT_PATH'] + '/lib/escape' | |
FILEPATH = ENV['TM_FILEPATH'] | |
lint = `~/Library/JSLint/jslint.sh` | |
lint.gsub!(/^Lint at line (\d*) character (\d*):(.+?)\n(?:(.+?)\n\n)?/m) do | |
"<p><span>Lint at <a href=\"txmt://open?url=file://#{e_url FILEPATH}&line=#{$1}&column=#{$2}\">line #{CGI.escapeHTML($1)}</a>:</span><span class=\"message\">#{CGI.escapeHTML($3)}<span></p>" << | |
($3 ? "<pre>#{CGI.escapeHTML($4)}</pre>" : '') | |
end | |
lint.gsub!(/^(jslint:)(.+?)$/, '<p><strong>\1</strong>\2</p>') | |
print <<HTML | |
<!doctype> | |
<html> | |
<head> | |
<style type="text/css"> | |
p { margin-bottom: 0; } | |
pre { | |
background: #f5f5f5; | |
border: 1px solid #cfcfcf; | |
font-size: 12px; | |
margin-top: 2px; | |
padding: 2px 4px; | |
} | |
a {text-decoration:none; color: #1FA8E4} | |
.message {color: #C76136} | |
</style> | |
</head> | |
<body> | |
#{lint} | |
</body> | |
</html> | |
HTML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment