summaryrefslogtreecommitdiff
path: root/lib/coderay/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay/helpers')
-rw-r--r--lib/coderay/helpers/file_type.rb101
-rw-r--r--lib/coderay/helpers/gzip.rb41
2 files changed, 52 insertions, 90 deletions
diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb
index 1a43924..9c36b62 100644
--- a/lib/coderay/helpers/file_type.rb
+++ b/lib/coderay/helpers/file_type.rb
@@ -77,55 +77,58 @@ module CodeRay
end
TypeFromExt = {
- 'c' => :c,
- 'cfc' => :xml,
- 'cfm' => :xml,
- 'clj' => :clojure,
- 'css' => :css,
- 'diff' => :diff,
- 'dpr' => :delphi,
- 'erb' => :erb,
- 'gemspec' => :ruby,
- 'go' => :go,
- 'groovy' => :groovy,
- 'gvy' => :groovy,
- 'h' => :c,
- 'haml' => :haml,
- 'htm' => :html,
- 'html' => :html,
- 'html.erb' => :erb,
- 'java' => :java,
- 'js' => :java_script,
- 'json' => :json,
- 'mab' => :ruby,
- 'pas' => :delphi,
- 'patch' => :diff,
- 'phtml' => :php,
- 'php' => :php,
- 'php3' => :php,
- 'php4' => :php,
- 'php5' => :php,
- 'prawn' => :ruby,
- 'py' => :python,
- 'py3' => :python,
- 'pyw' => :python,
- 'rake' => :ruby,
- 'raydebug' => :raydebug,
- 'rb' => :ruby,
- 'rbw' => :ruby,
- 'rhtml' => :erb,
- 'rjs' => :ruby,
- 'rpdf' => :ruby,
- 'ru' => :ruby,
- 'rxml' => :ruby,
- 'sass' => :sass,
- 'sql' => :sql,
- 'tmproj' => :xml,
- 'xaml' => :xml,
- 'xhtml' => :html,
- 'xml' => :xml,
- 'yaml' => :yaml,
- 'yml' => :yaml,
+ 'c' => :c,
+ 'cfc' => :xml,
+ 'cfm' => :xml,
+ 'clj' => :clojure,
+ 'css' => :css,
+ 'diff' => :diff,
+ 'dpr' => :delphi,
+ 'erb' => :erb,
+ 'gemspec' => :ruby,
+ 'go' => :go,
+ 'groovy' => :groovy,
+ 'gvy' => :groovy,
+ 'h' => :c,
+ 'haml' => :haml,
+ 'htm' => :html,
+ 'html' => :html,
+ 'html.erb' => :erb,
+ 'java' => :java,
+ 'js' => :java_script,
+ 'json' => :json,
+ 'lua' => :lua,
+ 'mab' => :ruby,
+ 'pas' => :delphi,
+ 'patch' => :diff,
+ 'phtml' => :php,
+ 'php' => :php,
+ 'php3' => :php,
+ 'php4' => :php,
+ 'php5' => :php,
+ 'prawn' => :ruby,
+ 'py' => :python,
+ 'py3' => :python,
+ 'pyw' => :python,
+ 'rake' => :ruby,
+ 'raydebug' => :raydebug,
+ 'rb' => :ruby,
+ 'rbw' => :ruby,
+ 'rhtml' => :erb,
+ 'rjs' => :ruby,
+ 'rpdf' => :ruby,
+ 'ru' => :ruby,
+ 'rxml' => :ruby,
+ 'sass' => :sass,
+ 'sql' => :sql,
+ 'taskpaper' => :taskpaper,
+ 'template' => :json, # AWS CloudFormation template
+ 'tmproj' => :xml,
+ 'xaml' => :xml,
+ 'xhtml' => :html,
+ 'xml' => :xml,
+ 'yaml' => :yaml,
+ 'yml' => :yaml,
}
for cpp_alias in %w[cc cpp cp cxx c++ C hh hpp h++ cu]
TypeFromExt[cpp_alias] = :cpp
diff --git a/lib/coderay/helpers/gzip.rb b/lib/coderay/helpers/gzip.rb
deleted file mode 100644
index 245014a..0000000
--- a/lib/coderay/helpers/gzip.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-module CodeRay
-
- # A simplified interface to the gzip library +zlib+ (from the Ruby Standard Library.)
- module GZip
-
- require 'zlib'
-
- # The default zipping level. 7 zips good and fast.
- DEFAULT_GZIP_LEVEL = 7
-
- # Unzips the given string +s+.
- #
- # Example:
- # require 'gzip_simple'
- # print GZip.gunzip(File.read('adresses.gz'))
- def GZip.gunzip s
- Zlib::Inflate.inflate s
- end
-
- # Zips the given string +s+.
- #
- # Example:
- # require 'gzip_simple'
- # File.open('adresses.gz', 'w') do |file
- # file.write GZip.gzip('Mum: 0123 456 789', 9)
- # end
- #
- # If you provide a +level+, you can control how strong
- # the string is compressed:
- # - 0: no compression, only convert to gzip format
- # - 1: compress fast
- # - 7: compress more, but still fast (default)
- # - 8: compress more, slower
- # - 9: compress best, very slow
- def GZip.gzip s, level = DEFAULT_GZIP_LEVEL
- Zlib::Deflate.new(level).deflate s, Zlib::FINISH
- end
-
- end
-
-end