[DRE-commits] [coderay] 01/01: Imported Upstream version 1.1.1

zeha at debian.org zeha at debian.org
Wed Mar 2 01:49:50 UTC 2016


This is an automated email from the git hooks/post-receive script.

zeha pushed a commit to annotated tag upstream/1.1.1
in repository coderay.

commit 79517b842960f90d0685945d7576edde4178b24a
Author: Christian Hofstaedtler <zeha at debian.org>
Date:   Tue Mar 1 22:50:32 2016 +0100

    Imported Upstream version 1.1.1
---
 bin/coderay                                       |   2 +-
 checksums.yaml.gz                                 | Bin 270 -> 0 bytes
 lib/coderay.rb                                    |  18 +-
 lib/coderay/encoders.rb                           |  18 ++
 lib/coderay/{ => encoders}/encoder.rb             |  11 --
 lib/coderay/encoders/html.rb                      |   5 +-
 lib/coderay/helpers/plugin.rb                     | 219 ----------------------
 lib/coderay/helpers/{plugin.rb => plugin_host.rb} |  53 ------
 lib/coderay/scanners.rb                           |  27 +++
 lib/coderay/scanners/diff.rb                      |   2 +-
 lib/coderay/scanners/java.rb                      |   2 +-
 lib/coderay/scanners/ruby.rb                      |  19 +-
 lib/coderay/scanners/ruby/patterns.rb             |   2 +-
 lib/coderay/scanners/ruby/string_state.rb         |   8 +
 lib/coderay/{ => scanners}/scanner.rb             |  18 --
 lib/coderay/scanners/sql.rb                       |  42 ++---
 lib/coderay/styles.rb                             |  15 ++
 lib/coderay/styles/alpha.rb                       |   3 +-
 lib/coderay/{ => styles}/style.rb                 |   7 +-
 lib/coderay/version.rb                            |   2 +-
 metadata.yml                                      |  28 +--
 21 files changed, 134 insertions(+), 367 deletions(-)

diff --git a/bin/coderay b/bin/coderay
index 889ae72..130a50b 100755
--- a/bin/coderay
+++ b/bin/coderay
@@ -35,7 +35,7 @@ defaults:
 
 common:
   coderay file.rb                      # highlight file to terminal
-  coderay file.rb > file.html          # highlight file to HTML page
+  coderay file.rb -page > file.html    # highlight file to HTML page
   coderay file.rb -div > file.html     # highlight file to HTML snippet
 
 configure output:
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
deleted file mode 100644
index a6391ab..0000000
Binary files a/checksums.yaml.gz and /dev/null differ
diff --git a/lib/coderay.rb b/lib/coderay.rb
index f759ed6..c3de20b 100644
--- a/lib/coderay.rb
+++ b/lib/coderay.rb
@@ -134,7 +134,7 @@ module CodeRay
     File.join CODERAY_PATH, *path
   end
   
-  require 'coderay/version'
+  autoload :VERSION, 'coderay/version'
   
   # helpers
   autoload :FileType,    coderay_path('helpers', 'file_type')
@@ -145,13 +145,13 @@ module CodeRay
   autoload :TokenKinds,  coderay_path('token_kinds')
   
   # Plugin system
-  autoload :PluginHost,  coderay_path('helpers', 'plugin')
+  autoload :PluginHost,  coderay_path('helpers', 'plugin_host')
   autoload :Plugin,      coderay_path('helpers', 'plugin')
   
   # Plugins
-  autoload :Scanners,    coderay_path('scanner')
-  autoload :Encoders,    coderay_path('encoder')
-  autoload :Styles,      coderay_path('style')
+  autoload :Scanners,    coderay_path('scanners')
+  autoload :Encoders,    coderay_path('encoders')
+  autoload :Styles,      coderay_path('styles')
   
   # convenience access and reusable Encoder/Scanner pair
   autoload :Duo,         coderay_path('duo')
@@ -166,7 +166,7 @@ module CodeRay
     #
     # See also demo/demo_simple.
     def scan code, lang, options = {}, &block
-      TokensProxy.new code, lang, options, block
+      CodeRay::TokensProxy.new code, lang, options, block
     end
     
     # Scans +filename+ (a path to a code file) with the Scanner for +lang+.
@@ -181,7 +181,7 @@ module CodeRay
     #  require 'coderay'
     #  page = CodeRay.scan_file('some_c_code.c').html
     def scan_file filename, lang = :auto, options = {}, &block
-      lang = FileType.fetch filename, :text, true if lang == :auto
+      lang = CodeRay::FileType.fetch filename, :text, true if lang == :auto
       code = File.read filename
       scan code, lang, options, &block
     end
@@ -258,7 +258,7 @@ module CodeRay
     #  ]
     #  #-> 2 out of 4 tokens have the kind :integer.
     def encoder format, options = {}
-      Encoders[format].new options
+      CodeRay::Encoders[format].new options
     end
     
     # Finds the Scanner class for +lang+ and creates an instance, passing
@@ -266,7 +266,7 @@ module CodeRay
     #
     # See Scanner.new.
     def scanner lang, options = {}, &block
-      Scanners[lang].new '', options, &block
+      CodeRay::Scanners[lang].new '', options, &block
     end
     
     # Extract the options for the scanner from the +options+ hash.
diff --git a/lib/coderay/encoders.rb b/lib/coderay/encoders.rb
new file mode 100644
index 0000000..6599186
--- /dev/null
+++ b/lib/coderay/encoders.rb
@@ -0,0 +1,18 @@
+module CodeRay
+  
+  # This module holds the Encoder class and its subclasses.
+  # For example, the HTML encoder is named CodeRay::Encoders::HTML
+  # can be found in coderay/encoders/html.
+  #
+  # Encoders also provides methods and constants for the register
+  # mechanism and the [] method that returns the Encoder class
+  # belonging to the given format.
+  module Encoders
+    
+    extend PluginHost
+    plugin_path File.dirname(__FILE__), 'encoders'
+    
+    autoload :Encoder, CodeRay.coderay_path('encoders', 'encoder')
+    
+  end
+end
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoders/encoder.rb
similarity index 93%
rename from lib/coderay/encoder.rb
rename to lib/coderay/encoders/encoder.rb
index d2d6c7e..fa5695d 100644
--- a/lib/coderay/encoder.rb
+++ b/lib/coderay/encoders/encoder.rb
@@ -1,17 +1,6 @@
 module CodeRay
-  
-  # This module holds the Encoder class and its subclasses.
-  # For example, the HTML encoder is named CodeRay::Encoders::HTML
-  # can be found in coderay/encoders/html.
-  #
-  # Encoders also provides methods and constants for the register
-  # mechanism and the [] method that returns the Encoder class
-  # belonging to the given format.
   module Encoders
     
-    extend PluginHost
-    plugin_path File.dirname(__FILE__), 'encoders'
-    
     # = Encoder
     #
     # The Encoder base class. Together with Scanner and
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index d2ebb5a..942b9c8 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -25,7 +25,8 @@ module Encoders
   # == Options
   #
   # === :tab_width
-  # Convert \t characters to +n+ spaces (a number.)
+  # Convert \t characters to +n+ spaces (a number or false.)
+  # false will keep tab characters untouched.
   # 
   # Default: 8
   #
@@ -180,7 +181,7 @@ module Encoders
       
       @break_lines = (options[:break_lines] == true)
       
-      @HTML_ESCAPE = HTML_ESCAPE.merge("\t" => ' ' * options[:tab_width])
+      @HTML_ESCAPE = HTML_ESCAPE.merge("\t" => options[:tab_width] ? ' ' * options[:tab_width] : "\t")
       
       @opened = []
       @last_opened = nil
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb
index 9a724ff..4567943 100644
--- a/lib/coderay/helpers/plugin.rb
+++ b/lib/coderay/helpers/plugin.rb
@@ -1,224 +1,5 @@
 module CodeRay
   
-  # = PluginHost
-  #
-  # A simple subclass/subfolder plugin system.
-  #
-  # Example:
-  #  class Generators
-  #    extend PluginHost
-  #    plugin_path 'app/generators'
-  #  end
-  #  
-  #  class Generator
-  #    extend Plugin
-  #    PLUGIN_HOST = Generators
-  #  end
-  #  
-  #  class FancyGenerator < Generator
-  #    register_for :fancy
-  #  end
-  #  
-  #  Generators[:fancy]  #-> FancyGenerator
-  #  # or
-  #  CodeRay.require_plugin 'Generators/fancy'
-  #  # or
-  #  Generators::Fancy
-  module PluginHost
-    
-    # Raised if Encoders::[] fails because:
-    # * a file could not be found
-    # * the requested Plugin is not registered
-    PluginNotFound = Class.new LoadError
-    HostNotFound   = Class.new LoadError
-    
-    PLUGIN_HOSTS = []
-    PLUGIN_HOSTS_BY_ID = {}  # dummy hash
-    
-    # Loads all plugins using list and load.
-    def load_all
-      for plugin in list
-        load plugin
-      end
-    end
-    
-    # Returns the Plugin for +id+.
-    #
-    # Example:
-    #  yaml_plugin = MyPluginHost[:yaml]
-    def [] id, *args, &blk
-      plugin = validate_id(id)
-      begin
-        plugin = plugin_hash.[](plugin, *args, &blk)
-      end while plugin.is_a? String
-      plugin
-    end
-    
-    alias load []
-    
-    # Tries to +load+ the missing plugin by translating +const+ to the
-    # underscore form (eg. LinesOfCode becomes lines_of_code).
-    def const_missing const
-      id = const.to_s.
-        gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
-        gsub(/([a-z\d])([A-Z])/,'\1_\2').
-        downcase
-      load id
-    end
-    
-    class << self
-      
-      # Adds the module/class to the PLUGIN_HOSTS list.
-      def extended mod
-        PLUGIN_HOSTS << mod
-      end
-      
-    end
-    
-    # The path where the plugins can be found.
-    def plugin_path *args
-      unless args.empty?
-        @plugin_path = File.expand_path File.join(*args)
-      end
-      @plugin_path ||= ''
-    end
-    
-    # Map a plugin_id to another.
-    #
-    # Usage: Put this in a file plugin_path/_map.rb.
-    #
-    #  class MyColorHost < PluginHost
-    #    map :navy => :dark_blue,
-    #      :maroon => :brown,
-    #      :luna => :moon
-    #  end
-    def map hash
-      for from, to in hash
-        from = validate_id from
-        to   = validate_id to
-        plugin_hash[from] = to unless plugin_hash.has_key? from
-      end
-    end
-    
-    # Define the default plugin to use when no plugin is found
-    # for a given id, or return the default plugin.
-    #
-    # See also map.
-    #
-    #  class MyColorHost < PluginHost
-    #    map :navy => :dark_blue
-    #    default :gray
-    #  end
-    #  
-    #  MyColorHost.default  # loads and returns the Gray plugin
-    def default id = nil
-      if id
-        id = validate_id id
-        raise "The default plugin can't be named \"default\"." if id == :default
-        plugin_hash[:default] = id
-      else
-        load :default
-      end
-    end
-    
-    # Every plugin must register itself for +id+ by calling register_for,
-    # which calls this method.
-    #
-    # See Plugin#register_for.
-    def register plugin, id
-      plugin_hash[validate_id(id)] = plugin
-    end
-    
-    # A Hash of plugion_id => Plugin pairs.
-    def plugin_hash
-      @plugin_hash ||= (@plugin_hash = make_plugin_hash).tap { load_plugin_map }
-    end
-    
-    # Returns an array of all .rb files in the plugin path.
-    #
-    # The extension .rb is not included.
-    def list
-      Dir[path_to('*')].select do |file|
-        File.basename(file)[/^(?!_)\w+\.rb$/]
-      end.map do |file|
-        File.basename(file, '.rb').to_sym
-      end
-    end
-    
-    # Returns an array of all Plugins.
-    # 
-    # Note: This loads all plugins using load_all.
-    def all_plugins
-      load_all
-      plugin_hash.values.grep(Class)
-    end
-    
-    # Loads the map file (see map).
-    #
-    # This is done automatically when plugin_path is called.
-    def load_plugin_map
-      mapfile = path_to '_map'
-      if File.exist? mapfile
-        require mapfile
-        true
-      else
-        false
-      end
-    end
-    
-  protected
-    
-    # Return a plugin hash that automatically loads plugins.
-    def make_plugin_hash
-      Hash.new do |h, plugin_id|
-        id = validate_id(plugin_id)
-        path = path_to id
-        begin
-          require path
-        rescue LoadError => boom
-          if h.has_key?(:default)
-            h[:default]
-          else
-            raise PluginNotFound, '%p could not load plugin %p: %s' % [self, id, boom]
-          end
-        else
-          # Plugin should have registered by now
-          if h.has_key? id
-            h[id]
-          else
-            raise PluginNotFound, "No #{self.name} plugin for #{id.inspect} found in #{path}."
-          end
-        end
-      end
-    end
-    
-    # Returns the expected path to the plugin file for the given id.
-    def path_to plugin_id
-      File.join plugin_path, "#{plugin_id}.rb"
-    end
-    
-    # Converts +id+ to a valid plugin ID String, or returns +nil+.
-    #
-    # Raises +ArgumentError+ for all other objects, or if the
-    # given String includes non-alphanumeric characters (\W).
-    def validate_id id
-      case id
-      when Symbol
-        id.to_s
-      when String
-        if id[/\w+/] == id
-          id.downcase
-        else
-          raise ArgumentError, "Invalid id given: #{id}"
-        end
-      else
-        raise ArgumentError, "Symbol or String expected, but #{id.class} given."
-      end
-    end
-    
-  end
-  
-  
   # = Plugin
   #
   #  Plugins have to include this module.
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin_host.rb
similarity index 83%
copy from lib/coderay/helpers/plugin.rb
copy to lib/coderay/helpers/plugin_host.rb
index 9a724ff..e9bc17c 100644
--- a/lib/coderay/helpers/plugin.rb
+++ b/lib/coderay/helpers/plugin_host.rb
@@ -218,57 +218,4 @@ module CodeRay
     
   end
   
-  
-  # = Plugin
-  #
-  #  Plugins have to include this module.
-  #
-  #  IMPORTANT: Use extend for this module.
-  #
-  #  See CodeRay::PluginHost for examples.
-  module Plugin
-    
-    attr_reader :plugin_id
-    
-    # Register this class for the given +id+.
-    # 
-    # Example:
-    #   class MyPlugin < PluginHost::BaseClass
-    #     register_for :my_id
-    #     ...
-    #   end
-    #
-    # See PluginHost.register.
-    def register_for id
-      @plugin_id = id
-      plugin_host.register self, id
-    end
-    
-    # Returns the title of the plugin, or sets it to the
-    # optional argument +title+.
-    def title title = nil
-      if title
-        @title = title.to_s
-      else
-        @title ||= name[/([^:]+)$/, 1]
-      end
-    end
-    
-    # The PluginHost for this Plugin class.
-    def plugin_host host = nil
-      if host.is_a? PluginHost
-        const_set :PLUGIN_HOST, host
-      end
-      self::PLUGIN_HOST
-    end
-    
-    def aliases
-      plugin_host.plugin_hash.inject [] do |aliases, (key, _)|
-        aliases << key if plugin_host[key] == self
-        aliases
-      end
-    end
-    
-  end
-  
 end
diff --git a/lib/coderay/scanners.rb b/lib/coderay/scanners.rb
new file mode 100644
index 0000000..3c7e594
--- /dev/null
+++ b/lib/coderay/scanners.rb
@@ -0,0 +1,27 @@
+require 'strscan'
+
+module CodeRay
+  
+  autoload :WordList, coderay_path('helpers', 'word_list')
+  
+  # = Scanners
+  #
+  # This module holds the Scanner class and its subclasses.
+  # For example, the Ruby scanner is named CodeRay::Scanners::Ruby
+  # can be found in coderay/scanners/ruby.
+  #
+  # Scanner also provides methods and constants for the register
+  # mechanism and the [] method that returns the Scanner class
+  # belonging to the given lang.
+  #
+  # See PluginHost.
+  module Scanners
+    
+    extend PluginHost
+    plugin_path File.dirname(__FILE__), 'scanners'
+    
+    autoload :Scanner, CodeRay.coderay_path('scanners', 'scanner')
+    
+  end
+  
+end
diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb
index fd1aed6..74a6c27 100644
--- a/lib/coderay/scanners/diff.rb
+++ b/lib/coderay/scanners/diff.rb
@@ -100,7 +100,7 @@ module Scanners
             next
           elsif match = scan(/-/)
             deleted_lines_count += 1
-            if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/)
+            if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && changed_lines_count <= 100_000 && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/)
               deleted_lines  = Array.new(changed_lines_count) { |i| skip(/\n\-/) if i > 0; scan(/.*/) }
               inserted_lines = Array.new(changed_lines_count) { |i| skip(/\n\+/)         ; scan(/.*/) }
               
diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb
index b282864..962154e 100644
--- a/lib/coderay/scanners/java.rb
+++ b/lib/coderay/scanners/java.rb
@@ -36,7 +36,7 @@ module Scanners
       add(BuiltinTypes::List, :predefined_type).
       add(BuiltinTypes::List.select { |builtin| builtin[/(Error|Exception)$/] }, :exception).
       add(DIRECTIVES, :directive)  # :nodoc:
-
+    
     ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x  # :nodoc:
     UNICODE_ESCAPE =  / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x  # :nodoc:
     STRING_CONTENT_PATTERN = {
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb
index 80165ca..5b8de42 100644
--- a/lib/coderay/scanners/ruby.rb
+++ b/lib/coderay/scanners/ruby.rb
@@ -164,15 +164,19 @@ module Scanners
               end
               
             elsif match = scan(/ ' (?:(?>[^'\\]*) ')? | " (?:(?>[^"\\\#]*) ")? /mx)
-              encoder.begin_group :string
               if match.size == 1
+                kind = check(self.class::StringState.simple_key_pattern(match)) ? :key : :string
+                encoder.begin_group kind
                 encoder.text_token match, :delimiter
-                state = self.class::StringState.new :string, match == '"', match  # important for streaming
+                state = self.class::StringState.new kind, match == '"', match  # important for streaming
               else
+                kind = value_expected == true && scan(/:/) ? :key : :string
+                encoder.begin_group kind
                 encoder.text_token match[0,1], :delimiter
                 encoder.text_token match[1..-2], :content if match.size > 2
                 encoder.text_token match[-1,1], :delimiter
-                encoder.end_group :string
+                encoder.end_group kind
+                encoder.text_token ':', :operator if kind == :key
                 value_expected = false
               end
               
@@ -191,11 +195,14 @@ module Scanners
                 encoder.text_token match, :error
                 method_call_expected = false
               else
-                encoder.text_token match, self[1] ? :float : :integer  # TODO: send :hex/:octal/:binary
+                kind = self[1] ? :float : :integer  # TODO: send :hex/:octal/:binary
+                match << 'r' if match !~ /e/i && scan(/r/)
+                match << 'i' if scan(/i/)
+                encoder.text_token match, kind
               end
               value_expected = false
               
-            elsif match = scan(/ [-+!~^\/]=? | [:;] | [*|&]{1,2}=? | >>? /x)
+            elsif match = scan(/ [-+!~^\/]=? | [:;] | &\. | [*|&]{1,2}=? | >>? /x)
               value_expected = true
               encoder.text_token match, :operator
               
@@ -208,7 +215,7 @@ module Scanners
               encoder.end_group kind
               heredocs ||= []  # create heredocs if empty
               heredocs << self.class::StringState.new(kind, quote != "'", delim,
-                self[1] == '-' ? :indented : :linestart)
+                self[1] ? :indented : :linestart)
               value_expected = false
               
             elsif value_expected && match = scan(/#{patterns::FANCY_STRING_START}/o)
diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb
index 0b36e13..e5a156d 100644
--- a/lib/coderay/scanners/ruby/patterns.rb
+++ b/lib/coderay/scanners/ruby/patterns.rb
@@ -114,7 +114,7 @@ module Scanners
     # NOTE: This is not completely correct, but
     # nobody needs heredoc delimiters ending with \n.
     HEREDOC_OPEN = /
-      << (-)?              # $1 = float
+      << ([-~])?           # $1 = float
       (?:
         ( [A-Za-z_0-9]+ )  # $2 = delim
       |
diff --git a/lib/coderay/scanners/ruby/string_state.rb b/lib/coderay/scanners/ruby/string_state.rb
index 28ddd6c..95f1e83 100644
--- a/lib/coderay/scanners/ruby/string_state.rb
+++ b/lib/coderay/scanners/ruby/string_state.rb
@@ -37,6 +37,14 @@ module Scanners
         end
       end
       
+      def self.simple_key_pattern delim
+        if delim == "'"
+          / (?> (?: [^\\']+ | \\. )* ) ' : /mx
+        else
+          / (?> (?: [^\\"\#]+ | \\. | \#\$[\\"] | \#\{[^\{\}]+\} | \#(?!\{) )* ) " : /mx
+        end
+      end
+      
       def initialize kind, interpreted, delim, heredoc = false
         if heredoc
           pattern = heredoc_pattern delim, interpreted, heredoc == :indented
diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanners/scanner.rb
similarity index 94%
rename from lib/coderay/scanner.rb
rename to lib/coderay/scanners/scanner.rb
index b3f7e17..efa710d 100644
--- a/lib/coderay/scanner.rb
+++ b/lib/coderay/scanners/scanner.rb
@@ -1,25 +1,7 @@
 # encoding: utf-8
-require 'strscan'
 
 module CodeRay
-  
-  autoload :WordList, coderay_path('helpers', 'word_list')
-  
-  # = Scanners
-  #
-  # This module holds the Scanner class and its subclasses.
-  # For example, the Ruby scanner is named CodeRay::Scanners::Ruby
-  # can be found in coderay/scanners/ruby.
-  #
-  # Scanner also provides methods and constants for the register
-  # mechanism and the [] method that returns the Scanner class
-  # belonging to the given lang.
-  #
-  # See PluginHost.
   module Scanners
-    extend PluginHost
-    plugin_path File.dirname(__FILE__), 'scanners'
-    
     
     # = Scanner
     #
diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb
index 93aeaf3..7d57f77 100644
--- a/lib/coderay/scanners/sql.rb
+++ b/lib/coderay/scanners/sql.rb
@@ -57,6 +57,12 @@ module Scanners
     
     STRING_PREFIXES = /[xnb]|_\w+/i
     
+    STRING_CONTENT_PATTERN = {
+      '"' => / (?: [^\\"] | "" )+ /x,
+      "'" => / (?: [^\\'] | '' )+ /x,
+      '`' => / (?: [^\\`] | `` )+ /x,
+    }
+    
     def scan_tokens encoder, options
       
       state = :initial
@@ -90,7 +96,7 @@ module Scanners
             state = :string
             encoder.text_token match, :delimiter
             
-          elsif match = scan(/ @? [A-Za-z_][A-Za-z_0-9]* /x)
+          elsif match = scan(/ @? [A-Za-z_][A-Za-z_0-9\$]* /x)
             encoder.text_token match, name_expected ? :ident : (match[0] == ?@ ? :variable : IDENT_KIND[match])
             name_expected = false
             
@@ -115,40 +121,26 @@ module Scanners
           end
           
         elsif state == :string
-          if match = scan(/[^\\"'`]+/)
-            string_content << match
-            next
+          if match = scan(STRING_CONTENT_PATTERN[string_type])
+            encoder.text_token match, :content
           elsif match = scan(/["'`]/)
             if string_type == match
               if peek(1) == string_type  # doubling means escape
-                string_content << string_type << getch
-                next
-              end
-              unless string_content.empty?
-                encoder.text_token string_content, :content
-                string_content = ''
+                encoder.text_token match + getch, :content
+              else
+                encoder.text_token match, :delimiter
+                encoder.end_group :string
+                state = :initial
+                string_type = nil
               end
-              encoder.text_token match, :delimiter
-              encoder.end_group :string
-              state = :initial
-              string_type = nil
             else
-              string_content << match
+              encoder.text_token match, :content
             end
           elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
-            unless string_content.empty?
-              encoder.text_token string_content, :content
-              string_content = ''
-            end
             encoder.text_token match, :char
           elsif match = scan(/ \\ . /mox)
-            string_content << match
-            next
+            encoder.text_token match, :content
           elsif match = scan(/ \\ | $ /x)
-            unless string_content.empty?
-              encoder.text_token string_content, :content
-              string_content = ''
-            end
             encoder.text_token match, :error unless match.empty?
             encoder.end_group :string
             state = :initial
diff --git a/lib/coderay/styles.rb b/lib/coderay/styles.rb
new file mode 100644
index 0000000..d8fa8aa
--- /dev/null
+++ b/lib/coderay/styles.rb
@@ -0,0 +1,15 @@
+module CodeRay
+
+  # This module holds the Style class and its subclasses.
+  # 
+  # See Plugin.
+  module Styles
+    
+    extend PluginHost
+    plugin_path File.dirname(__FILE__), 'styles'
+    
+    autoload :Style, CodeRay.coderay_path('styles', 'style')
+    
+  end
+  
+end
diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb
index d304dc4..f21cefe 100644
--- a/lib/coderay/styles/alpha.rb
+++ b/lib/coderay/styles/alpha.rb
@@ -82,7 +82,8 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
 .exception { color:#C00; font-weight:bold }
 .float { color:#60E }
 .function { color:#06B; font-weight:bold }
-.function .delimiter { color:#024; font-weight:bold }
+.function .delimiter { color:#059 }
+.function .content { color:#037 }
 .global-variable { color:#d70 }
 .hex { color:#02b }
 .id  { color:#33D; font-weight:bold }
diff --git a/lib/coderay/style.rb b/lib/coderay/styles/style.rb
similarity index 64%
rename from lib/coderay/style.rb
rename to lib/coderay/styles/style.rb
index df4704f..a335386 100644
--- a/lib/coderay/style.rb
+++ b/lib/coderay/styles/style.rb
@@ -1,11 +1,6 @@
 module CodeRay
-
-  # This module holds the Style class and its subclasses.
-  # 
-  # See Plugin.
+  
   module Styles
-    extend PluginHost
-    plugin_path File.dirname(__FILE__), 'styles'
     
     # Base class for styles.
     # 
diff --git a/lib/coderay/version.rb b/lib/coderay/version.rb
index 4b4f085..7ea3f70 100644
--- a/lib/coderay/version.rb
+++ b/lib/coderay/version.rb
@@ -1,3 +1,3 @@
 module CodeRay
-  VERSION = '1.1.0'
+  VERSION = '1.1.1'
 end
diff --git a/metadata.yml b/metadata.yml
index 3686c2d..4f0a85a 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: coderay
 version: !ruby/object:Gem::Version
-  version: 1.1.0
+  version: 1.1.1
 platform: ruby
 authors:
 - Kornelius Kalnbach
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2013-08-31 00:00:00.000000000 Z
+date: 2016-02-20 00:00:00.000000000 Z
 dependencies: []
 description: Fast and easy syntax highlighting for selected languages, written in
   Ruby. Comes with RedCloth integration and LOC counter.
@@ -22,15 +22,17 @@ extra_rdoc_files:
 files:
 - README_INDEX.rdoc
 - Rakefile
+- bin/coderay
 - lib/coderay.rb
 - lib/coderay/duo.rb
-- lib/coderay/encoder.rb
+- lib/coderay/encoders.rb
 - lib/coderay/encoders/_map.rb
 - lib/coderay/encoders/comment_filter.rb
 - lib/coderay/encoders/count.rb
 - lib/coderay/encoders/debug.rb
 - lib/coderay/encoders/debug_lint.rb
 - lib/coderay/encoders/div.rb
+- lib/coderay/encoders/encoder.rb
 - lib/coderay/encoders/filter.rb
 - lib/coderay/encoders/html.rb
 - lib/coderay/encoders/html/css.rb
@@ -51,8 +53,9 @@ files:
 - lib/coderay/for_redcloth.rb
 - lib/coderay/helpers/file_type.rb
 - lib/coderay/helpers/plugin.rb
+- lib/coderay/helpers/plugin_host.rb
 - lib/coderay/helpers/word_list.rb
-- lib/coderay/scanner.rb
+- lib/coderay/scanners.rb
 - lib/coderay/scanners/_map.rb
 - lib/coderay/scanners/c.rb
 - lib/coderay/scanners/clojure.rb
@@ -78,14 +81,16 @@ files:
 - lib/coderay/scanners/ruby/patterns.rb
 - lib/coderay/scanners/ruby/string_state.rb
 - lib/coderay/scanners/sass.rb
+- lib/coderay/scanners/scanner.rb
 - lib/coderay/scanners/sql.rb
 - lib/coderay/scanners/taskpaper.rb
 - lib/coderay/scanners/text.rb
 - lib/coderay/scanners/xml.rb
 - lib/coderay/scanners/yaml.rb
-- lib/coderay/style.rb
+- lib/coderay/styles.rb
 - lib/coderay/styles/_map.rb
 - lib/coderay/styles/alpha.rb
+- lib/coderay/styles/style.rb
 - lib/coderay/token_kinds.rb
 - lib/coderay/tokens.rb
 - lib/coderay/tokens_proxy.rb
@@ -94,31 +99,30 @@ files:
 - test/functional/examples.rb
 - test/functional/for_redcloth.rb
 - test/functional/suite.rb
-- bin/coderay
 homepage: http://coderay.rubychan.de
 licenses:
 - MIT
 metadata: {}
 post_install_message: 
 rdoc_options:
-- -SNw2
-- -mREADME_INDEX.rdoc
-- -t CodeRay Documentation
+- "-SNw2"
+- "-mREADME_INDEX.rdoc"
+- "-t CodeRay Documentation"
 require_paths:
 - lib
 required_ruby_version: !ruby/object:Gem::Requirement
   requirements:
-  - - '>='
+  - - ">="
     - !ruby/object:Gem::Version
       version: 1.8.6
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
-  - - '>='
+  - - ">="
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
 rubyforge_project: coderay
-rubygems_version: 2.0.3
+rubygems_version: 2.5.1
 signing_key: 
 specification_version: 4
 summary: Fast syntax highlighting for selected languages.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/coderay.git



More information about the Pkg-ruby-extras-commits mailing list