coderay 1.0.0.788.pre → 1.0.0.798.pre

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,6 @@ $:.unshift File.dirname(__FILE__) unless $:.include? '.'
2
2
 
3
3
  ROOT = '.'
4
4
  LIB_ROOT = File.join ROOT, 'lib'
5
- EXTRA_RDOC_FILES = %w(README.rdoc FOLDERS)
6
5
 
7
6
  task :default => :test
8
7
 
data/bin/coderay CHANGED
@@ -30,7 +30,7 @@ usage:
30
30
  defaults:
31
31
  language detect from input file name or shebang; fall back to plain text
32
32
  input STDIN
33
- format detect from output file name or use terminal; fall back to HTML page
33
+ format detect from output file name or use terminal; fall back to HTML
34
34
  output STDOUT
35
35
 
36
36
  common:
data/lib/coderay/duo.rb CHANGED
@@ -21,7 +21,7 @@ module CodeRay
21
21
  # Create a new Duo, holding a lang and a format to highlight code.
22
22
  #
23
23
  # simple:
24
- # CodeRay::Duo[:ruby, :page].highlight 'bla 42'
24
+ # CodeRay::Duo[:ruby, :html].highlight 'bla 42'
25
25
  #
26
26
  # with options:
27
27
  # CodeRay::Duo[:ruby, :html, :hint => :debug].highlight '????::??'
@@ -2,15 +2,16 @@ module CodeRay
2
2
  module Encoders
3
3
 
4
4
  map \
5
- :loc => :lines_of_code,
6
- :term => :terminal,
7
- :tty => :terminal,
8
- :plain => :text,
9
- :plaintext => :text,
5
+ :loc => :lines_of_code,
6
+ :html => :page,
7
+ :plain => :text,
8
+ :plaintext => :text,
10
9
  :remove_comments => :comment_filter,
11
- :stats => :statistic
10
+ :stats => :statistic,
11
+ :term => :terminal,
12
+ :tty => :terminal
12
13
 
13
- # No default because Tokens#nonsense would not raise NoMethodError.
14
+ # No default because Tokens#nonsense should raise NoMethodError.
14
15
 
15
16
  end
16
17
  end
@@ -1,22 +1,23 @@
1
1
  module CodeRay
2
2
  module Encoders
3
-
3
+
4
4
  load :html
5
5
 
6
6
  # Wraps HTML output into a DIV element, using inline styles by default.
7
7
  #
8
8
  # See Encoders::HTML for available options.
9
9
  class Div < HTML
10
-
10
+
11
11
  FILE_EXTENSION = 'div.html'
12
-
12
+
13
13
  register_for :div
14
-
14
+
15
15
  DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge \
16
- :css => :style,
17
- :wrap => :div
18
-
16
+ :css => :style,
17
+ :wrap => :div,
18
+ :line_numbers => false
19
+
19
20
  end
20
-
21
+
21
22
  end
22
23
  end
@@ -91,7 +91,7 @@ module Encoders
91
91
 
92
92
  register_for :html
93
93
 
94
- FILE_EXTENSION = 'html'
94
+ FILE_EXTENSION = 'snippet.html'
95
95
 
96
96
  DEFAULT_OPTIONS = {
97
97
  :tab_width => 8,
@@ -126,7 +126,7 @@ module Encoders
126
126
  TABLE = Template.new <<-TABLE
127
127
  <table class="CodeRay"><tr>
128
128
  <td class="line_numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><%LINE_NUMBERS%></pre></td>
129
- <td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><%CONTENT%></pre></td>
129
+ <td class="code"><pre><%CONTENT%></pre></td>
130
130
  </tr></table>
131
131
  TABLE
132
132
 
@@ -22,7 +22,7 @@ module Encoders
22
22
  rescue LoadError
23
23
  begin
24
24
  require 'rubygems'
25
- gem "json#{'-jruby' if defined? JRUBY_VERSION}"
25
+ gem "json"
26
26
  require 'json'
27
27
  rescue LoadError
28
28
  $stderr.puts "The JSON encoder needs the JSON library.\n" \
@@ -14,8 +14,8 @@ module Encoders
14
14
  register_for :page
15
15
 
16
16
  DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge \
17
- :css => :class,
18
- :wrap => :page,
17
+ :css => :class,
18
+ :wrap => :page,
19
19
  :line_numbers => :table
20
20
 
21
21
  end
@@ -1,22 +1,23 @@
1
1
  module CodeRay
2
2
  module Encoders
3
-
3
+
4
4
  load :html
5
-
5
+
6
6
  # Wraps HTML output into a SPAN element, using inline styles by default.
7
7
  #
8
8
  # See Encoders::HTML for available options.
9
9
  class Span < HTML
10
-
10
+
11
11
  FILE_EXTENSION = 'span.html'
12
-
12
+
13
13
  register_for :span
14
-
14
+
15
15
  DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge \
16
- :css => :style,
17
- :wrap => :span
18
-
16
+ :css => :style,
17
+ :wrap => :span,
18
+ :line_numbers => false
19
+
19
20
  end
20
-
21
+
21
22
  end
22
23
  end
@@ -88,8 +88,8 @@ module CodeRay
88
88
  'groovy' => :groovy,
89
89
  'gvy' => :groovy,
90
90
  'h' => :c,
91
- 'htm' => :html,
92
- 'html' => :html,
91
+ 'htm' => :page,
92
+ 'html' => :page,
93
93
  'html.erb' => :rhtml,
94
94
  'java' => :java,
95
95
  'js' => :java_script,
@@ -101,6 +101,7 @@ module CodeRay
101
101
  'php3' => :php,
102
102
  'php4' => :php,
103
103
  'php5' => :php,
104
+ 'prawn' => :ruby,
104
105
  'py' => :python,
105
106
  'py3' => :python,
106
107
  'pyw' => :python,
@@ -111,11 +112,12 @@ module CodeRay
111
112
  'rhtml' => :rhtml,
112
113
  'rjs' => :ruby,
113
114
  'rpdf' => :ruby,
115
+ 'ru' => :ruby,
114
116
  'rxml' => :ruby,
115
117
  'sch' => :scheme,
116
118
  'sql' => :sql,
117
119
  'ss' => :scheme,
118
- 'xhtml' => :xhtml,
120
+ 'xhtml' => :page,
119
121
  'xml' => :xml,
120
122
  'yaml' => :yaml,
121
123
  'yml' => :yaml,
@@ -127,9 +129,10 @@ module CodeRay
127
129
  TypeFromShebang = /\b(?:ruby|perl|python|sh)\b/
128
130
 
129
131
  TypeFromName = {
130
- 'Capfile' => :ruby,
132
+ 'Capfile' => :ruby,
131
133
  'Rakefile' => :ruby,
132
134
  'Rantfile' => :ruby,
135
+ 'Gemfile' => :ruby,
133
136
  }
134
137
 
135
138
  end
@@ -271,7 +271,7 @@ module CodeRay
271
271
 
272
272
  def aliases
273
273
  plugin_host.load_plugin_map
274
- plugin_host.plugin_hash.inject [] do |aliases, (key, value)|
274
+ plugin_host.plugin_hash.inject [] do |aliases, (key, _)|
275
275
  aliases << key if plugin_host[key] == self
276
276
  aliases
277
277
  end
@@ -354,7 +354,7 @@ module Scanners
354
354
 
355
355
  elsif match = scan(/<<<(?:(#{RE::IDENTIFIER})|"(#{RE::IDENTIFIER})"|'(#{RE::IDENTIFIER})')/o)
356
356
  encoder.begin_group :string
357
- warn 'heredoc in heredoc?' if heredoc_delimiter
357
+ # warn 'heredoc in heredoc?' if heredoc_delimiter
358
358
  heredoc_delimiter = Regexp.escape(self[1] || self[2] || self[3])
359
359
  encoder.text_token match, :delimiter
360
360
  states.push self[3] ? :sqstring : :dqstring
@@ -381,10 +381,10 @@ module Scanners
381
381
  end
382
382
  else
383
383
  case esc = getch
384
- when state.delim, '\\'
385
- encoder.text_token match + esc, :char
386
384
  when nil
387
385
  encoder.text_token match, :content
386
+ when state.delim, '\\'
387
+ encoder.text_token match + esc, :char
388
388
  else
389
389
  encoder.text_token match + esc, :content
390
390
  end
@@ -135,18 +135,18 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
135
135
  .v { color:#037 }
136
136
  .xt { color:#444 }
137
137
 
138
- .ins { background: hsla(120,100%,50%,0.2) }
139
- .del { background: hsla(0,100%,50%,0.2) }
140
- .chg { color: #aaf; background: #007; }
138
+ .ins { background: hsla(120,100%,50%,0.1) }
139
+ .del { background: hsla(0,100%,50%,0.1) }
140
+ .chg { color: #bbf; background: #007; }
141
141
  .head { color: #f8f; background: #505 }
142
142
  .head .filename { color: white; }
143
143
 
144
144
  .del .eye { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; }
145
145
  .ins .eye { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; }
146
146
 
147
- .ins .ins { color: #080; background:transparent; font-weight:bold }
148
- .del .del { color: #800; background:transparent; font-weight:bold }
149
- .chg .chg { color: #66f }
147
+ .ins .ins { color: #0c0; background:transparent; font-weight:bold }
148
+ .del .del { color: #c00; background:transparent; font-weight:bold }
149
+ .chg .chg { color: #88f }
150
150
  .head .head { color: #f4f }
151
151
  TOKENS
152
152
 
@@ -64,7 +64,7 @@ class BasicTest < Test::Unit::TestCase
64
64
  end
65
65
 
66
66
  def test_highlight
67
- assert_match '<div class="code"><pre>test</pre></div>', CodeRay.highlight('test', :python)
67
+ assert_match '<pre>test</pre>', CodeRay.highlight('test', :python)
68
68
  end
69
69
 
70
70
  def test_highlight_file
@@ -173,7 +173,7 @@ more code # and another comment, in-line.
173
173
 
174
174
  def test_encoder_file_extension
175
175
  assert_nothing_raised do
176
- assert_equal 'html', CodeRay::Encoders::HTML::FILE_EXTENSION
176
+ assert_equal 'html', CodeRay::Encoders::Page::FILE_EXTENSION
177
177
  assert_equal 'cocoa', Milk::FILE_EXTENSION
178
178
  assert_equal 'cocoa', Milk.new.file_extension
179
179
  assert_equal 'honeybee', HoneyBee::FILE_EXTENSION
@@ -24,7 +24,7 @@ end
24
24
  <a href="#n2" name="n2">2</a>
25
25
  <a href="#n3" name="n3">3</a>
26
26
  </pre></td>
27
- <td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span style="color:#00D">5</span>.times <span style="color:#080;font-weight:bold">do</span>
27
+ <td class="code"><pre><span style="color:#00D">5</span>.times <span style="color:#080;font-weight:bold">do</span>
28
28
  puts <span style="background-color:hsla(0,100%,50%,0.08)"><span style="color:#710">'</span><span style="color:#D20">Hello, world!</span><span style="color:#710">'</span></span>
29
29
  <span style="color:#080;font-weight:bold">end</span></pre></td>
30
30
  </tr></table>
@@ -38,7 +38,7 @@ end
38
38
  <table class="CodeRay"><tr>
39
39
  <td class="line_numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>
40
40
  </pre></td>
41
- <td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">puts <span class="s"><span class="dl">&quot;</span><span class="k">Hello, world!</span><span class="dl">&quot;</span></span></pre></td>
41
+ <td class="code"><pre>puts <span class="s"><span class="dl">&quot;</span><span class="k">Hello, world!</span><span class="dl">&quot;</span></span></pre></td>
42
42
  </tr></table>
43
43
 
44
44
  </body>
metadata CHANGED
@@ -2,15 +2,15 @@
2
2
  name: coderay
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 10
5
- version: 1.0.0.788.pre
5
+ version: 1.0.0.798.pre
6
6
  platform: ruby
7
7
  authors:
8
- - murphy
8
+ - Kornelius Kalnbach
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-25 00:00:00 Z
13
+ date: 2011-07-08 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Fast and easy syntax highlighting for selected languages, written in Ruby. Comes with RedCloth integration and LOC counter.
@@ -22,7 +22,6 @@ extensions: []
22
22
 
23
23
  extra_rdoc_files:
24
24
  - README.rdoc
25
- - FOLDERS
26
25
  files:
27
26
  - lib/coderay/duo.rb
28
27
  - lib/coderay/encoder.rb
@@ -96,7 +95,6 @@ files:
96
95
  - test/functional/for_redcloth.rb
97
96
  - test/functional/suite.rb
98
97
  - bin/coderay
99
- - FOLDERS
100
98
  homepage: http://coderay.rubychan.de
101
99
  licenses: []
102
100
 
data/FOLDERS DELETED
@@ -1,49 +0,0 @@
1
- = CodeRay - folder structure
2
-
3
- == bench - Benchmarking system
4
-
5
- All benchmarking stuff goes here.
6
-
7
- Test inputs are stored in files named <code>example.<lang></code>.
8
- Test outputs go to <code>bench/test.<encoder-default-file-extension></code>.
9
-
10
- Run <code>bench/bench.rb</code> to get a usage description.
11
-
12
- Run <code>rake bench</code> to perform an example benchmark.
13
-
14
-
15
- == bin - Scripts
16
-
17
- Executional files for CodeRay.
18
-
19
- coderay:: The CodeRay executable.
20
- coderay_stylesheet:: Prints the default stylesheet.
21
-
22
- == demo - Demos and functional tests
23
-
24
- Demonstrational scripts to show of CodeRay's features.
25
-
26
- Run them as functional tests with <code>rake test:demos</code>.
27
-
28
-
29
- == etc - Lots of stuff
30
-
31
- Some addidtional files for CodeRay, mainly graphics and Vim scripts.
32
-
33
-
34
- == lib - CodeRay library code
35
-
36
- This is the base directory for the CodeRay library.
37
-
38
-
39
- == rake_helpers - Rake helper libraries
40
-
41
- Some files to enhance Rake, including the Autumnal Rdoc template and some scripts.
42
-
43
-
44
- == test - Tests
45
-
46
- In the subfolder scanners/ are the scanners tests.
47
- Each language has its own subfolder and sub-suite.
48
-
49
- Run with <code>rake test</code>.