diff options
author | murphy <murphy@rubychan.de> | 2010-06-29 07:11:21 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-06-29 07:11:21 +0000 |
commit | a1330de9438827abcdc331c85dbd7e358b0e118a (patch) | |
tree | 7f3fa69a87b529f815525e0a24e85504907d5753 /lib/coderay/encoders/html.rb | |
parent | 13a98cec5c7f19e8e7231899645b8f51464becb4 (diff) | |
download | coderay-a1330de9438827abcdc331c85dbd7e358b0e118a.tar.gz |
Use autoload instead of require (speeds up CodeRay startup) for CodeRay, Scanner, Tokens, and Encoders::HTML.
Diffstat (limited to 'lib/coderay/encoders/html.rb')
-rw-r--r-- | lib/coderay/encoders/html.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index bd48a72..02b3550 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -110,8 +110,10 @@ module Encoders :hint => false, } - - helper :output, :numbering, :css + + # TODO: Make Plugin use autoload, too. + helper :output, :css + autoload :Numbering, 'coderay/encoders/html/numbering' attr_reader :css @@ -144,9 +146,9 @@ module Encoders end end - TRANSPARENT_TOKEN_KINDS = [ + TRANSPARENT_TOKEN_KINDS = Set[ :delimiter, :modifier, :content, :escape, :inline_delimiter, - ].to_set + ] # Generate a hint about the given +kinds+ in a +hint+ style. # @@ -226,7 +228,9 @@ module Encoders @out.extend Output @out.css = @css - @out.number! options[:line_numbers], options + if options[:line_numbers] + Numbering.number! @out, options[:line_numbers], options + end @out.wrap! options[:wrap] @out.apply_title! options[:title] |