coderay 1.0.9 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +2 -0
  3. data/bin/coderay +4 -4
  4. data/lib/coderay.rb +2 -3
  5. data/lib/coderay/encoders/debug.rb +5 -17
  6. data/lib/coderay/encoders/debug_lint.rb +62 -0
  7. data/lib/coderay/encoders/html.rb +84 -84
  8. data/lib/coderay/encoders/html/css.rb +7 -7
  9. data/lib/coderay/encoders/html/numbering.rb +24 -19
  10. data/lib/coderay/encoders/html/output.rb +1 -1
  11. data/lib/coderay/encoders/lint.rb +57 -0
  12. data/lib/coderay/encoders/statistic.rb +0 -1
  13. data/lib/coderay/encoders/terminal.rb +121 -105
  14. data/lib/coderay/helpers/file_type.rb +54 -47
  15. data/lib/coderay/helpers/plugin.rb +4 -13
  16. data/lib/coderay/scanner.rb +58 -26
  17. data/lib/coderay/scanners/c.rb +1 -1
  18. data/lib/coderay/scanners/cpp.rb +1 -1
  19. data/lib/coderay/scanners/css.rb +22 -25
  20. data/lib/coderay/scanners/diff.rb +53 -31
  21. data/lib/coderay/scanners/groovy.rb +17 -4
  22. data/lib/coderay/scanners/html.rb +38 -16
  23. data/lib/coderay/scanners/java.rb +1 -1
  24. data/lib/coderay/scanners/java_script.rb +30 -6
  25. data/lib/coderay/scanners/json.rb +15 -12
  26. data/lib/coderay/scanners/lua.rb +280 -0
  27. data/lib/coderay/scanners/php.rb +22 -4
  28. data/lib/coderay/scanners/python.rb +3 -3
  29. data/lib/coderay/scanners/raydebug.rb +8 -8
  30. data/lib/coderay/scanners/ruby.rb +2 -2
  31. data/lib/coderay/scanners/sass.rb +232 -0
  32. data/lib/coderay/scanners/sql.rb +7 -4
  33. data/lib/coderay/scanners/taskpaper.rb +36 -0
  34. data/lib/coderay/scanners/yaml.rb +2 -2
  35. data/lib/coderay/styles/alpha.rb +31 -21
  36. data/lib/coderay/token_kinds.rb +68 -71
  37. data/lib/coderay/tokens.rb +23 -77
  38. data/lib/coderay/version.rb +1 -1
  39. data/test/functional/examples.rb +3 -3
  40. data/test/functional/for_redcloth.rb +4 -10
  41. metadata +13 -14
  42. data/lib/coderay/helpers/gzip.rb +0 -41
@@ -1,3 +1,3 @@
1
1
  module CodeRay
2
- VERSION = '1.0.9'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -22,7 +22,7 @@ end
22
22
  CODE
23
23
  assert_equal <<-DIV, div
24
24
  <table class="CodeRay"><tr>
25
- <td class="line-numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><a href="#n1" name="n1">1</a>
25
+ <td class="line-numbers"><pre><a href="#n1" name="n1">1</a>
26
26
  <a href="#n2" name="n2">2</a>
27
27
  <a href="#n3" name="n3">3</a>
28
28
  </pre></td>
@@ -38,7 +38,7 @@ end
38
38
  <body>
39
39
 
40
40
  <table class="CodeRay"><tr>
41
- <td class="line-numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>
41
+ <td class="line-numbers"><pre><a href="#n1" name="n1">1</a>
42
42
  </pre></td>
43
43
  <td class="code"><pre>puts <span class="string"><span class="delimiter">&quot;</span><span class="content">Hello, world!</span><span class="delimiter">&quot;</span></span></pre></td>
44
44
  </tr></table>
@@ -114,7 +114,7 @@ Token Types (7):
114
114
 
115
115
  # format the tokens
116
116
  term = terminal_encoder.encode_tokens(tokens)
117
- assert_equal "\e[1;31mimport\e[0m \e[33mthis\e[0m; \e[37m# The Zen of Python\e[0m", term
117
+ assert_equal "\e[32mimport\e[0m \e[31mthis\e[0m; \e[1;30m# The Zen of Python\e[0m", term
118
118
 
119
119
  # re-using scanner and encoder
120
120
  ruby_highlighter = CodeRay::Duo[:ruby, :div]
@@ -1,5 +1,4 @@
1
1
  require 'test/unit'
2
- require File.expand_path('../../lib/assert_warning', __FILE__)
3
2
 
4
3
  $:.unshift File.expand_path('../../../lib', __FILE__)
5
4
  require 'coderay'
@@ -66,19 +65,14 @@ class BasicTest < Test::Unit::TestCase
66
65
  # See http://jgarber.lighthouseapp.com/projects/13054/tickets/124-code-markup-does-not-allow-brackets.
67
66
  def test_for_redcloth_false_positive
68
67
  require 'coderay/for_redcloth'
69
- assert_warning 'CodeRay::Scanners could not load plugin :project; falling back to :text' do
70
- assert_equal '<p><code>[project]_dff.skjd</code></p>',
71
- RedCloth.new('@[project]_dff.skjd@').to_html
72
- end
68
+ assert_equal '<p><code>[project]_dff.skjd</code></p>',
69
+ RedCloth.new('@[project]_dff.skjd@').to_html
73
70
  # false positive, but expected behavior / known issue
74
71
  assert_equal "<p><span lang=\"ruby\" class=\"CodeRay\">_dff.skjd</span></p>",
75
72
  RedCloth.new('@[ruby]_dff.skjd@').to_html
76
- assert_warning 'CodeRay::Scanners could not load plugin :project; falling back to :text' do
77
- assert_equal <<-BLOCKCODE.chomp,
73
+ assert_equal <<-BLOCKCODE.chomp, RedCloth.new('bc. [project]_dff.skjd').to_html
78
74
  <pre><code>[project]_dff.skjd</code></pre>
79
- BLOCKCODE
80
- RedCloth.new('bc. [project]_dff.skjd').to_html
81
- end
75
+ BLOCKCODE
82
76
  end
83
77
 
84
78
  end if defined? RedCloth
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
5
- prerelease:
4
+ version: 1.1.0.rc1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kornelius Kalnbach
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-20 00:00:00.000000000 Z
11
+ date: 2013-07-13 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Fast and easy syntax highlighting for selected languages, written in
15
14
  Ruby. Comes with RedCloth integration and LOC counter.
@@ -30,6 +29,7 @@ files:
30
29
  - lib/coderay/encoders/comment_filter.rb
31
30
  - lib/coderay/encoders/count.rb
32
31
  - lib/coderay/encoders/debug.rb
32
+ - lib/coderay/encoders/debug_lint.rb
33
33
  - lib/coderay/encoders/div.rb
34
34
  - lib/coderay/encoders/filter.rb
35
35
  - lib/coderay/encoders/html.rb
@@ -38,6 +38,7 @@ files:
38
38
  - lib/coderay/encoders/html/output.rb
39
39
  - lib/coderay/encoders/json.rb
40
40
  - lib/coderay/encoders/lines_of_code.rb
41
+ - lib/coderay/encoders/lint.rb
41
42
  - lib/coderay/encoders/null.rb
42
43
  - lib/coderay/encoders/page.rb
43
44
  - lib/coderay/encoders/span.rb
@@ -49,7 +50,6 @@ files:
49
50
  - lib/coderay/encoders/yaml.rb
50
51
  - lib/coderay/for_redcloth.rb
51
52
  - lib/coderay/helpers/file_type.rb
52
- - lib/coderay/helpers/gzip.rb
53
53
  - lib/coderay/helpers/plugin.rb
54
54
  - lib/coderay/helpers/word_list.rb
55
55
  - lib/coderay/scanner.rb
@@ -69,13 +69,16 @@ files:
69
69
  - lib/coderay/scanners/java/builtin_types.rb
70
70
  - lib/coderay/scanners/java_script.rb
71
71
  - lib/coderay/scanners/json.rb
72
+ - lib/coderay/scanners/lua.rb
72
73
  - lib/coderay/scanners/php.rb
73
74
  - lib/coderay/scanners/python.rb
74
75
  - lib/coderay/scanners/raydebug.rb
75
76
  - lib/coderay/scanners/ruby.rb
76
77
  - lib/coderay/scanners/ruby/patterns.rb
77
78
  - lib/coderay/scanners/ruby/string_state.rb
79
+ - lib/coderay/scanners/sass.rb
78
80
  - lib/coderay/scanners/sql.rb
81
+ - lib/coderay/scanners/taskpaper.rb
79
82
  - lib/coderay/scanners/text.rb
80
83
  - lib/coderay/scanners/xml.rb
81
84
  - lib/coderay/scanners/yaml.rb
@@ -94,6 +97,7 @@ files:
94
97
  homepage: http://coderay.rubychan.de
95
98
  licenses:
96
99
  - MIT
100
+ metadata: {}
97
101
  post_install_message:
98
102
  rdoc_options:
99
103
  - -SNw2
@@ -102,25 +106,20 @@ rdoc_options:
102
106
  require_paths:
103
107
  - lib
104
108
  required_ruby_version: !ruby/object:Gem::Requirement
105
- none: false
106
109
  requirements:
107
- - - ! '>='
110
+ - - '>='
108
111
  - !ruby/object:Gem::Version
109
112
  version: 1.8.6
110
113
  required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
114
  requirements:
113
- - - ! '>='
115
+ - - '>'
114
116
  - !ruby/object:Gem::Version
115
- version: '0'
116
- segments:
117
- - 0
118
- hash: 218043927244084581
117
+ version: 1.3.1
119
118
  requirements: []
120
119
  rubyforge_project: coderay
121
- rubygems_version: 1.8.25
120
+ rubygems_version: 2.0.3
122
121
  signing_key:
123
- specification_version: 3
122
+ specification_version: 4
124
123
  summary: Fast syntax highlighting for selected languages.
125
124
  test_files:
126
125
  - test/functional/basic.rb
@@ -1,41 +0,0 @@
1
- module CodeRay
2
-
3
- # A simplified interface to the gzip library +zlib+ (from the Ruby Standard Library.)
4
- module GZip
5
-
6
- require 'zlib'
7
-
8
- # The default zipping level. 7 zips good and fast.
9
- DEFAULT_GZIP_LEVEL = 7
10
-
11
- # Unzips the given string +s+.
12
- #
13
- # Example:
14
- # require 'gzip_simple'
15
- # print GZip.gunzip(File.read('adresses.gz'))
16
- def GZip.gunzip s
17
- Zlib::Inflate.inflate s
18
- end
19
-
20
- # Zips the given string +s+.
21
- #
22
- # Example:
23
- # require 'gzip_simple'
24
- # File.open('adresses.gz', 'w') do |file
25
- # file.write GZip.gzip('Mum: 0123 456 789', 9)
26
- # end
27
- #
28
- # If you provide a +level+, you can control how strong
29
- # the string is compressed:
30
- # - 0: no compression, only convert to gzip format
31
- # - 1: compress fast
32
- # - 7: compress more, but still fast (default)
33
- # - 8: compress more, slower
34
- # - 9: compress best, very slow
35
- def GZip.gzip s, level = DEFAULT_GZIP_LEVEL
36
- Zlib::Deflate.new(level).deflate s, Zlib::FINISH
37
- end
38
-
39
- end
40
-
41
- end