diff options
author | murphy <murphy@rubychan.de> | 2011-07-04 00:38:27 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2011-07-04 00:38:27 +0000 |
commit | 6a52b213edf1f146fb72a055466a35fe219e5a0d (patch) | |
tree | 2f0b49ff6ecbce2b24fc56d7eb9a2a883136bc5a /lib/coderay/encoders | |
parent | 498df2b7654c210c8f47e2757efc33cd94689b57 (diff) | |
download | coderay-6a52b213edf1f146fb72a055466a35fe219e5a0d.tar.gz |
cleanups: Page encoder is default for HTML, benchmark KB/s instead of tokens/s
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r-- | lib/coderay/encoders/_map.rb | 15 | ||||
-rw-r--r-- | lib/coderay/encoders/div.rb | 17 | ||||
-rw-r--r-- | lib/coderay/encoders/html.rb | 2 | ||||
-rw-r--r-- | lib/coderay/encoders/html/output.rb | 2 | ||||
-rw-r--r-- | lib/coderay/encoders/page.rb | 4 | ||||
-rw-r--r-- | lib/coderay/encoders/span.rb | 19 |
6 files changed, 31 insertions, 28 deletions
diff --git a/lib/coderay/encoders/_map.rb b/lib/coderay/encoders/_map.rb index c9a20cc..24ada0a 100644 --- a/lib/coderay/encoders/_map.rb +++ b/lib/coderay/encoders/_map.rb @@ -2,15 +2,16 @@ module CodeRay module Encoders map \ - :loc => :lines_of_code, - :term => :terminal, - :tty => :terminal, - :plain => :text, - :plaintext => :text, + :loc => :lines_of_code, + :html => :page, + :plain => :text, + :plaintext => :text, :remove_comments => :comment_filter, - :stats => :statistic + :stats => :statistic, + :term => :terminal, + :tty => :terminal - # No default because Tokens#nonsense would not raise NoMethodError. + # No default because Tokens#nonsense should raise NoMethodError. end end diff --git a/lib/coderay/encoders/div.rb b/lib/coderay/encoders/div.rb index f9741e3..efd9435 100644 --- a/lib/coderay/encoders/div.rb +++ b/lib/coderay/encoders/div.rb @@ -1,22 +1,23 @@ module CodeRay module Encoders - + load :html # Wraps HTML output into a DIV element, using inline styles by default. # # See Encoders::HTML for available options. class Div < HTML - + FILE_EXTENSION = 'div.html' - + register_for :div - + DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge \ - :css => :style, - :wrap => :div - + :css => :style, + :wrap => :div, + :line_numbers => false + end - + end end diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index 724f3eb..ec73d2c 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -91,7 +91,7 @@ module Encoders register_for :html - FILE_EXTENSION = 'html' + FILE_EXTENSION = 'snippet.html' DEFAULT_OPTIONS = { :tab_width => 8, diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index 5aa80a7..004351b 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -126,7 +126,7 @@ module Encoders TABLE = Template.new <<-TABLE <table class="CodeRay"><tr> <td class="line_numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><%LINE_NUMBERS%></pre></td> - <td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><%CONTENT%></pre></td> + <td class="code"><pre><%CONTENT%></pre></td> </tr></table> TABLE diff --git a/lib/coderay/encoders/page.rb b/lib/coderay/encoders/page.rb index 8db45cd..800e73f 100644 --- a/lib/coderay/encoders/page.rb +++ b/lib/coderay/encoders/page.rb @@ -14,8 +14,8 @@ module Encoders register_for :page DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge \ - :css => :class, - :wrap => :page, + :css => :class, + :wrap => :page, :line_numbers => :table end diff --git a/lib/coderay/encoders/span.rb b/lib/coderay/encoders/span.rb index 1596044..da705bd 100644 --- a/lib/coderay/encoders/span.rb +++ b/lib/coderay/encoders/span.rb @@ -1,22 +1,23 @@ module CodeRay module Encoders - + load :html - + # Wraps HTML output into a SPAN element, using inline styles by default. # # See Encoders::HTML for available options. class Span < HTML - + FILE_EXTENSION = 'span.html' - + register_for :span - + DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge \ - :css => :style, - :wrap => :span - + :css => :style, + :wrap => :span, + :line_numbers => false + end - + end end |