dasil003-tm_syntax_highlighting 1.9.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +23 -9
- data/Rakefile +0 -26
- data/lib/tm_syntax_highlighting/base.rb +1 -1
- metadata +43 -58
- data/VERSION +0 -1
- data/dasil003-tm_syntax_highlighting.gemspec +0 -52
- data/test/tm_syntax_highlighting_test.rb +0 -21
- data/tm_syntax_highlighting.gemspec +0 -55
data/README.md
CHANGED
@@ -1,26 +1,40 @@
|
|
1
1
|
# TmSyntaxHighlighting
|
2
2
|
|
3
|
+
## Important Version 2.0 Notes
|
4
|
+
|
5
|
+
This fork of the original tm_syntax_highlithing gem was created for ruby 1.9 compatibility at a time when the
|
6
|
+
`ultraviolet` gem did not support it. This was done with the `spox-ultraviolet` fork, however this fork did not support
|
7
|
+
ruby 1.9.3. The original `ultraviolet` gem has since released a 1.0.0 version that *does* support 1.9.3, and ostensibly
|
8
|
+
1.8.7 as well (though I have no plans to test that).
|
9
|
+
|
10
|
+
**Important: Make sure you don't have spox-ultraviolet installed or it may supercede the regular ultraviolet and break
|
11
|
+
Ruby 1.9.3**
|
12
|
+
|
13
|
+
So the 2.0 version of this gem should have greatly improved compatibility, but note that the underlying libraries
|
14
|
+
introduced new lang identifiers, so for instance, 'ruby' must be specified as 'source.ruby'. If you're using this
|
15
|
+
plugin you wall want to audit your lang strings for correctness.
|
16
|
+
|
3
17
|
|
4
18
|
|
5
19
|
## Gems, Generators and Versions
|
6
20
|
|
7
|
-
TextMate theme based highlighting for
|
21
|
+
TextMate theme based highlighting for Rails 3.
|
8
22
|
|
9
|
-
This plugin was originally written by Arya Asemanfar. Rails 3 generator and 1.9.
|
23
|
+
This plugin was originally written by Arya Asemanfar. Rails 3 generator and 1.9.x compatibility by Gabe da Silveira.
|
10
24
|
|
11
|
-
I namespaced it as dasil003-tm_syntax_highlighting to avoid interference with the original.
|
12
|
-
with Ruby 1.8.x**
|
25
|
+
I namespaced it as dasil003-tm_syntax_highlighting to avoid interference with the original.
|
13
26
|
|
14
27
|
|
15
28
|
|
16
29
|
## Installation
|
17
30
|
|
18
|
-
|
19
|
-
built-in and thus everything becomes much less painful:
|
31
|
+
On Ruby 1.9 you simply install the gem:
|
20
32
|
|
21
33
|
$ gem install dasil003-tm_syntax_highlighting
|
22
34
|
|
23
|
-
|
35
|
+
On Ruby 1.8 you will need to install Oniguruma (http://www.geocities.jp/kosako3/oniguruma/). I haven't
|
36
|
+
actually tested this gem under Oniguruma, but `ultraviolet` claims support, so I will too. If there is a problem in
|
37
|
+
1.8, please feel free to submit a patch.
|
24
38
|
|
25
39
|
|
26
40
|
|
@@ -41,7 +55,7 @@ The plugin adds 2 view helper methods: `code` and `syntax_css`
|
|
41
55
|
|
42
56
|
### code (helper method) usage
|
43
57
|
|
44
|
-
code(some_ruby_code, :theme => "twilight", :lang => "ruby", :line_numbers => true)
|
58
|
+
code(some_ruby_code, :theme => "twilight", :lang => "source.ruby", :line_numbers => true)
|
45
59
|
|
46
60
|
`lang` and `line_numbers` are optional. `lang` will default to plain_text and `line_numbers` will default to true.
|
47
61
|
|
@@ -52,7 +66,7 @@ Theme can be an array, and one will be chosen at random.
|
|
52
66
|
You can set defaults in an initializer:
|
53
67
|
|
54
68
|
# config/initializers/tm_syntax_config.rb
|
55
|
-
TmSyntaxHighlighting.defaults = {:theme => "sunburst", :line_numbers => true, :lang => "ruby"}
|
69
|
+
TmSyntaxHighlighting.defaults = {:theme => "sunburst", :line_numbers => true, :lang => "source.ruby"}
|
56
70
|
|
57
71
|
Again, theme can be an array and will be chosen at random.
|
58
72
|
|
data/Rakefile
CHANGED
@@ -11,29 +11,3 @@ Rake::TestTask.new(:test) do |t|
|
|
11
11
|
t.pattern = 'test/**/*_test.rb'
|
12
12
|
t.verbose = true
|
13
13
|
end
|
14
|
-
|
15
|
-
desc 'Generate documentation for the tm_syntax_highlighting plugin.'
|
16
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
-
rdoc.rdoc_dir = 'rdoc'
|
18
|
-
rdoc.title = 'TmSyntaxHighlighting'
|
19
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
-
rdoc.rdoc_files.include('README')
|
21
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
-
end
|
23
|
-
|
24
|
-
begin
|
25
|
-
require 'jeweler'
|
26
|
-
Jeweler::Tasks.new do |gemspec|
|
27
|
-
gemspec.name = "dasil003-tm_syntax_highlighting"
|
28
|
-
gemspec.summary = "Ruby 1.9.2 / Rails 3 plugin to highlight code"
|
29
|
-
gemspec.description = "Uses the spox-ultraviolet gem to highlight any language that TextMate can highlight, and has a (Thor) generator to generate the relevant CSS files."
|
30
|
-
gemspec.email = "gabe@websaviour.com"
|
31
|
-
gemspec.homepage = "http://github.com/dasil003/tm_syntax_highlighting"
|
32
|
-
gemspec.authors = ["Arya Asemanfar", "Gabe da Silveira"]
|
33
|
-
|
34
|
-
gemspec.add_dependency('spox-ultraviolet')
|
35
|
-
end
|
36
|
-
Jeweler::GemcutterTasks.new
|
37
|
-
rescue LoadError
|
38
|
-
puts "Jeweler not available. Install it with: gem install jeweler"
|
39
|
-
end
|
@@ -3,7 +3,7 @@ module TmSyntaxHighlighting
|
|
3
3
|
def code(code, options = {})
|
4
4
|
options = TmSyntaxHighlighting.defaults.merge_with(options)
|
5
5
|
TmSyntaxHighlighting.defaults[:current_themes] << options[:theme]
|
6
|
-
options[:lang] = "
|
6
|
+
options[:lang] = "text.plain" unless Uv.syntaxes.include?(options[:lang])
|
7
7
|
Uv.parse(code, "xhtml", options[:lang], options[:line_numbers], options[:theme])
|
8
8
|
end
|
9
9
|
|
metadata
CHANGED
@@ -1,87 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dasil003-tm_syntax_highlighting
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 9
|
8
|
-
- 0
|
9
|
-
version: 1.9.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Arya Asemanfar
|
13
9
|
- Gabe da Silveira
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
name: spox-ultraviolet
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
13
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ultraviolet
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
- 0
|
31
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
32
23
|
type: :runtime
|
33
|
-
|
34
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
description: Uses the Ultraviolet gem to highlight any language that TextMate can
|
32
|
+
highlight, and has a (Thor) generator to generate the relevant CSS files.
|
35
33
|
email: gabe@websaviour.com
|
36
34
|
executables: []
|
37
|
-
|
38
35
|
extensions: []
|
39
|
-
|
40
|
-
extra_rdoc_files:
|
36
|
+
extra_rdoc_files:
|
41
37
|
- README.md
|
42
|
-
files:
|
38
|
+
files:
|
43
39
|
- MIT-LICENSE
|
44
40
|
- README.md
|
45
41
|
- Rakefile
|
46
|
-
- VERSION
|
47
|
-
- dasil003-tm_syntax_highlighting.gemspec
|
48
42
|
- lib/generators/USAGE
|
49
43
|
- lib/generators/syntax_css_generator.rb
|
50
44
|
- lib/tm_syntax_highlighting.rb
|
51
45
|
- lib/tm_syntax_highlighting/base.rb
|
52
|
-
|
53
|
-
- tm_syntax_highlighting.gemspec
|
54
|
-
has_rdoc: true
|
55
|
-
homepage: http://github.com/dasil003/tm_syntax_highlighting
|
46
|
+
homepage: http://github.com/gtd/tm_syntax_highlighting
|
56
47
|
licenses: []
|
57
|
-
|
58
48
|
post_install_message:
|
59
|
-
rdoc_options:
|
60
|
-
|
61
|
-
require_paths:
|
49
|
+
rdoc_options:
|
50
|
+
- --charset=UTF-8
|
51
|
+
require_paths:
|
62
52
|
- lib
|
63
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
54
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
|
70
|
-
version: "0"
|
71
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
60
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
- 0
|
78
|
-
version: "0"
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
79
65
|
requirements: []
|
80
|
-
|
81
66
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.8.24
|
83
68
|
signing_key:
|
84
69
|
specification_version: 3
|
85
|
-
summary:
|
86
|
-
test_files:
|
87
|
-
|
70
|
+
summary: Code highlighting for ActionView 3
|
71
|
+
test_files: []
|
72
|
+
has_rdoc:
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.9.0
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{dasil003-tm_syntax_highlighting}
|
8
|
-
s.version = "1.9.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Arya Asemanfar", "Gabe da Silveira"]
|
12
|
-
s.date = %q{2010-11-17}
|
13
|
-
s.description = %q{Uses the spox-ultraviolet gem to highlight any language that TextMate can highlight, and has a (Thor) generator to generate the relevant CSS files.}
|
14
|
-
s.email = %q{gabe@websaviour.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.md"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"MIT-LICENSE",
|
20
|
-
"README.md",
|
21
|
-
"Rakefile",
|
22
|
-
"VERSION",
|
23
|
-
"dasil003-tm_syntax_highlighting.gemspec",
|
24
|
-
"lib/generators/USAGE",
|
25
|
-
"lib/generators/syntax_css_generator.rb",
|
26
|
-
"lib/tm_syntax_highlighting.rb",
|
27
|
-
"lib/tm_syntax_highlighting/base.rb",
|
28
|
-
"test/tm_syntax_highlighting_test.rb",
|
29
|
-
"tm_syntax_highlighting.gemspec"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/dasil003/tm_syntax_highlighting}
|
32
|
-
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.7}
|
34
|
-
s.summary = %q{Ruby 1.9.2 / Rails 3 plugin to highlight code}
|
35
|
-
s.test_files = [
|
36
|
-
"test/tm_syntax_highlighting_test.rb"
|
37
|
-
]
|
38
|
-
|
39
|
-
if s.respond_to? :specification_version then
|
40
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
|
-
s.specification_version = 3
|
42
|
-
|
43
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_runtime_dependency(%q<spox-ultraviolet>, [">= 0"])
|
45
|
-
else
|
46
|
-
s.add_dependency(%q<spox-ultraviolet>, [">= 0"])
|
47
|
-
end
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<spox-ultraviolet>, [">= 0"])
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'tm_syntax_highlighting'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
class TmSyntaxHighlightingTest < Test::Unit::TestCase
|
5
|
-
def test_action_controller_methods_inclusion
|
6
|
-
assert ActionController::Base.instance_methods.include?(:reset_syntax_css_includes)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_action_view_methods_inclusion
|
10
|
-
assert ActionView::Base.instance_methods.include?(:code), ':code not included'
|
11
|
-
assert ActionView::Base.instance_methods.include?(:syntax_css), ':syntax_css not included'
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_code_helper
|
15
|
-
@view = ActionView::Base.new
|
16
|
-
html = @view.code("def ruby_method(param)\n return :foo\nend", :lang => 'ruby')
|
17
|
-
assert_match /span class="line-numbers"/, html, "no line number span found"
|
18
|
-
assert_match /span class="Keyword"/, html, "no keyword span found"
|
19
|
-
assert_match /span class="FunctionName"/, html, "no function name span found"
|
20
|
-
end
|
21
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{tm_syntax_highlighting}
|
8
|
-
s.version = "1.1.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Arya Asemanfar", "Gabe da Silveira"]
|
12
|
-
s.date = %q{2010-01-21}
|
13
|
-
s.description = %q{Uses the Ultraviolet gem to highlight any language that TextMate can highlight, and has a (Thor) generator to generate the relevant CSS files.}
|
14
|
-
s.email = %q{gabe@websaviour.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.md"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
".gitignore",
|
20
|
-
"MIT-LICENSE",
|
21
|
-
"README.md",
|
22
|
-
"Rakefile",
|
23
|
-
"VERSION",
|
24
|
-
"install.rb",
|
25
|
-
"lib/generators/USAGE",
|
26
|
-
"lib/generators/syntax_css_generator.rb",
|
27
|
-
"lib/tm_syntax_highlighting.rb",
|
28
|
-
"lib/tm_syntax_highlighting/base.rb",
|
29
|
-
"test/tm_syntax_highlighting_test.rb",
|
30
|
-
"tm_syntax_highlighting.gemspec",
|
31
|
-
"uninstall.rb"
|
32
|
-
]
|
33
|
-
s.homepage = %q{http://github.com/dasil003/tm_syntax_highlighting}
|
34
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
-
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.5}
|
37
|
-
s.summary = %q{Gem plugin for Rails 3 to highlight code}
|
38
|
-
s.test_files = [
|
39
|
-
"test/tm_syntax_highlighting_test.rb"
|
40
|
-
]
|
41
|
-
|
42
|
-
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
-
s.specification_version = 3
|
45
|
-
|
46
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<ultraviolet>, [">= 0"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<ultraviolet>, [">= 0"])
|
50
|
-
end
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<ultraviolet>, [">= 0"])
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|