forked from drnic/ruby-tmbundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new command Show RDoc for current file/project. This will generat…
…e rdoc based on the current project (or file, if no project) and show it in the HTML window. Also override the new toggle quote command for Ruby. It will now cycle between all 4 common quote styles; additionally, it will fiddle with escapes properly so, for example, switching to standard double-quote style will escape any double quotes already present. git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/Ruby.tmbundle@3015 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
- Loading branch information
kevin
committed
Apr 12, 2006
1 parent
6546bb8
commit 85fa9e4
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?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>if (( ${#TM_PROJRECT_DIRECTORY} == 0 )); then | ||
cd "$TM_PROJECT_DIRECTORY" | ||
output="`basename "$TM_PROJECT_DIRECTORY"`" | ||
input="." | ||
else | ||
cd "$TM_DIRECTORY" | ||
output="$TM_FILENAME" | ||
input="$TM_FILENAME" | ||
fi | ||
output_dir="/tmp/rdoc_${output}" | ||
rm -rf "${output_dir}" | ||
rdoc -S -N -q -f html --op "${output_dir}" "$input" &>/dev/null | ||
echo "<html><head><meta http-equiv=\"refresh\" content=\"0;URL=tm-file://${output_dir}/index.html\"></head></html>" | ||
</string> | ||
<key>input</key> | ||
<string>none</string> | ||
<key>keyEquivalent</key> | ||
<string>^H</string> | ||
<key>name</key> | ||
<string>Show RDoc for current file/project</string> | ||
<key>output</key> | ||
<string>showAsHTML</string> | ||
<key>scope</key> | ||
<string>source.ruby</string> | ||
<key>uuid</key> | ||
<string>1AD6A138-2E89-4D6A-AB3F-416BF9CE968D</string> | ||
</dict> | ||
</plist> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?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>nop</string> | ||
<key>command</key> | ||
<string>#!/usr/bin/env ruby | ||
class String | ||
def escape(char) | ||
gsub(/\\.|#{Regexp.quote(char)}/) { |match| match == char ? "\\#{char}" : match } | ||
end | ||
def unescape(char) | ||
gsub(/\\./) { |match| match == "\\#{char}" ? char : match } | ||
end | ||
end | ||
print case str = STDIN.read | ||
when /\A"(.*)"\z/m: "%{" + $1.unescape('"').escape("}") + "}" | ||
when /\A%\{(.*)\}\z/m: "'" + $1.unescape("}").escape("'") + "'" | ||
when /\A'(.*)'\z/m: "%q{" + $1.unescape("'").escape("}") + "}" | ||
when /\A%q\{(.*)\}\z/m: '"' + $1.unescape("}").escape('"') + '"' | ||
else str | ||
end | ||
</string> | ||
<key>fallbackInput</key> | ||
<string>scope</string> | ||
<key>input</key> | ||
<string>selection</string> | ||
<key>keyEquivalent</key> | ||
<string>^"</string> | ||
<key>name</key> | ||
<string>Toggle Quote Style</string> | ||
<key>output</key> | ||
<string>replaceSelectedText</string> | ||
<key>scope</key> | ||
<string>source.ruby string.quoted.double, source.ruby string.quoted.single</string> | ||
<key>uuid</key> | ||
<string>6519CB08-8326-4B77-A251-54722FFBFC1F</string> | ||
</dict> | ||
</plist> |
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