diff options
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/encoders/debug.rb | 1 | ||||
-rw-r--r-- | lib/coderay/helpers/file_type.rb | 1 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 1 | ||||
-rw-r--r-- | lib/coderay/scanners/diff.rb | 2 | ||||
-rwxr-xr-x | lib/coderay/token_kinds.rb | 2 | ||||
-rw-r--r-- | lib/coderay/tokens.rb | 1 | ||||
-rw-r--r-- | lib/coderay/version.rb | 2 |
7 files changed, 5 insertions, 5 deletions
diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb index 62f9f0a..c03d3fb 100644 --- a/lib/coderay/encoders/debug.rb +++ b/lib/coderay/encoders/debug.rb @@ -24,6 +24,7 @@ module Encoders end def text_token text, kind + raise 'empty token' if $CODERAY_DEBUG && text.empty? if kind == :space @out << text else diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb index b06b9bc..12556d0 100644 --- a/lib/coderay/helpers/file_type.rb +++ b/lib/coderay/helpers/file_type.rb @@ -99,6 +99,7 @@ module CodeRay 'mab' => :ruby, 'pas' => :delphi, 'patch' => :diff, + 'phtml' => :php, 'php' => :php, 'php3' => :php, 'php4' => :php, diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 137c1ab..dd4e830 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -180,7 +180,6 @@ module CodeRay rescue LoadError => boom if @plugin_map_loaded if h.has_key?(:default) - warn '%p could not load plugin %p; falling back to %p' % [self, id, h[:default]] h[:default] else raise PluginNotFound, '%p could not load plugin %p: %s' % [self, id, boom] diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index 38efaf4..af0f755 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -45,7 +45,7 @@ module Scanners if match = scan(/--- |\+\+\+ |=+|_+/) encoder.begin_line line_kind = :head encoder.text_token match, :head - if match = scan(/.*?(?=$|[\t\n\x00]| \(revision)/) + if match = scan(/[^\x00\n]+?(?=$|[\t\n]| \(revision)/) encoder.text_token match, :filename if options[:highlight_code] && match != '/dev/null' file_type = CodeRay::FileType.fetch(match, :text) diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb index 3b8d07e..8db8530 100755 --- a/lib/coderay/token_kinds.rb +++ b/lib/coderay/token_kinds.rb @@ -85,6 +85,4 @@ module CodeRay TokenKinds[:method] = TokenKinds[:function] TokenKinds[:escape] = TokenKinds[:delimiter] TokenKinds[:docstring] = TokenKinds[:comment] - - TokenKinds.freeze end diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb index c747017..6957d69 100644 --- a/lib/coderay/tokens.rb +++ b/lib/coderay/tokens.rb @@ -93,6 +93,7 @@ module CodeRay # This method is used by @Scanner#tokenize@ when called with an Array # of source strings. The Diff encoder uses it for inline highlighting. def split_into_parts *sizes + return Array.new(sizes.size) { Tokens.new } if size == 2 && first == '' parts = [] opened = [] content = nil diff --git a/lib/coderay/version.rb b/lib/coderay/version.rb index bfb5f24..4b4f085 100644 --- a/lib/coderay/version.rb +++ b/lib/coderay/version.rb @@ -1,3 +1,3 @@ module CodeRay - VERSION = '1.0.9' + VERSION = '1.1.0' end |