summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2008-08-11 12:01:17 +0000
committermurphy <murphy@rubychan.de>2008-08-11 12:01:17 +0000
commit13fba921998464920d06fc7f014a7e6589d83d6c (patch)
tree23db734fa598221c4c8b08c17f78c10fbec1adaf
parentce3a4f1b699fb37eead1058a3be0593bbbf306fc (diff)
downloadcoderay-13fba921998464920d06fc7f014a7e6589d83d6c.tar.gz
Fixed FileType: .html.erb is now recognized as rhtml.
-rw-r--r--etc/coderay-lib.tmproj26
-rw-r--r--lib/coderay/helpers/file_type.rb8
2 files changed, 21 insertions, 13 deletions
diff --git a/etc/coderay-lib.tmproj b/etc/coderay-lib.tmproj
index d97a407..e030f32 100644
--- a/etc/coderay-lib.tmproj
+++ b/etc/coderay-lib.tmproj
@@ -74,12 +74,18 @@
<key>filename</key>
<string>../Rakefile</string>
<key>lastUsed</key>
- <date>2006-10-31T02:10:52Z</date>
- </dict>
- <dict>
- <key>filename</key>
- <string>../README</string>
+ <date>2008-08-06T18:57:10Z</date>
+ <key>selected</key>
+ <true/>
</dict>
+ <dict>
+ <key>filename</key>
+ <string>../README</string>
+ </dict>
+ <dict>
+ <key>filename</key>
+ <string>../diff</string>
+ </dict>
<dict>
<key>filename</key>
<string>../ROADMAP</string>
@@ -89,8 +95,6 @@
<string>../TODO</string>
<key>lastUsed</key>
<date>2008-01-21T03:03:08Z</date>
- <key>selected</key>
- <true/>
</dict>
<dict>
<key>name</key>
@@ -104,17 +108,19 @@
<key>filename</key>
<string>../test/scanners/coderay_suite.rb</string>
<key>lastUsed</key>
- <date>2006-10-31T02:10:48Z</date>
+ <date>2008-08-04T21:50:01Z</date>
</dict>
<dict>
<key>filename</key>
<string>../test/scanners/suite.rb</string>
<key>lastUsed</key>
- <date>2006-10-31T01:56:15Z</date>
+ <date>2008-08-04T21:50:01Z</date>
</dict>
<dict>
<key>filename</key>
<string>../bench/bench.rb</string>
+ <key>lastUsed</key>
+ <date>2008-08-04T21:50:12Z</date>
</dict>
</array>
<key>fileHierarchyDrawerWidth</key>
@@ -124,6 +130,6 @@
<key>showFileHierarchyDrawer</key>
<true/>
<key>windowFrame</key>
- <string>{{6, 14}, {643, 764}}</string>
+ <string>{{0, 4}, {1070, 774}}</string>
</dict>
</plist>
diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb
index 8d86e57..75c691f 100644
--- a/lib/coderay/helpers/file_type.rb
+++ b/lib/coderay/helpers/file_type.rb
@@ -34,12 +34,12 @@ module FileType
# That means you can get filetypes from files that don't exist.
def [] filename, read_shebang = false
name = File.basename filename
- ext = File.extname name
- ext.sub!(/^\./, '') # delete the leading dot
+ ext = File.extname(name).sub(/^\./, '') # from last dot, delete the leading dot
+ ext2 = filename[/\.(.*)/, 1] # from first dot
type =
- TypeFromExt[ext] ||
TypeFromExt[ext.downcase] ||
+ (TypeFromExt[ext2.downcase] if ext2) ||
TypeFromName[name] ||
TypeFromName[name.downcase]
type ||= shebang(filename) if read_shebang
@@ -94,6 +94,7 @@ module FileType
'xhtml' => :xhtml,
'raydebug' => :debug,
'rhtml' => :rhtml,
+ 'html.erb' => :rhtml,
'ss' => :scheme,
'sch' => :scheme,
'yaml' => :yaml,
@@ -173,6 +174,7 @@ class TC_FileType < Test::Unit::TestCase
assert_equal :xhtml, FileType['test.xhtml']
assert_equal :xhtml, FileType['test.html.xhtml']
assert_equal :rhtml, FileType['_form.rhtml']
+ assert_equal :rhtml, FileType['_form.html.erb']
end
def test_yaml