jackb 0.0.5 → 0.0.6.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +3 -0
- data/Gemfile +4 -1
- data/Gemfile.lock +39 -0
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/jackb.gemspec +10 -11
- data/lib/jackb/highlight.rb +8 -3
- data/spec/lib/highlight_spec.rb +3 -3
- data/spec/lib/html_spec.rb +4 -4
- data/spec/lib/markdown_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -1
- metadata +26 -25
data/.rvmrc
ADDED
data/Gemfile
CHANGED
@@ -2,7 +2,6 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
gem 'rdiscount'
|
4
4
|
gem 'open4'
|
5
|
-
gem 'albino'
|
6
5
|
|
7
6
|
gem 'activesupport', '3.0.0.beta4'
|
8
7
|
gem 'i18n'
|
@@ -10,6 +9,10 @@ gem 'tzinfo'
|
|
10
9
|
|
11
10
|
gem 'jeweler'
|
12
11
|
|
12
|
+
group :development do
|
13
|
+
gem 'albino'
|
14
|
+
end
|
15
|
+
|
13
16
|
group :test do
|
14
17
|
gem 'test-unit', '1.2.3'
|
15
18
|
gem 'rspec'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.0.0.beta4)
|
5
|
+
albino (1.0)
|
6
|
+
gemcutter (0.6.1)
|
7
|
+
git (1.2.5)
|
8
|
+
hoe (2.6.1)
|
9
|
+
rake (>= 0.8.7)
|
10
|
+
rubyforge (>= 2.0.4)
|
11
|
+
i18n (0.4.1)
|
12
|
+
jeweler (1.4.0)
|
13
|
+
gemcutter (>= 0.1.0)
|
14
|
+
git (>= 1.2.5)
|
15
|
+
rubyforge (>= 2.0.0)
|
16
|
+
json_pure (1.4.6)
|
17
|
+
open4 (1.0.1)
|
18
|
+
rake (0.8.7)
|
19
|
+
rdiscount (1.6.5)
|
20
|
+
rspec (1.3.0)
|
21
|
+
rubyforge (2.0.4)
|
22
|
+
json_pure (>= 1.1.7)
|
23
|
+
test-unit (1.2.3)
|
24
|
+
hoe (>= 1.5.1)
|
25
|
+
tzinfo (0.3.22)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
activesupport (= 3.0.0.beta4)
|
32
|
+
albino
|
33
|
+
i18n
|
34
|
+
jeweler
|
35
|
+
open4
|
36
|
+
rdiscount
|
37
|
+
rspec
|
38
|
+
test-unit (= 1.2.3)
|
39
|
+
tzinfo
|
data/Rakefile
CHANGED
@@ -31,8 +31,7 @@ begin
|
|
31
31
|
|
32
32
|
gemspec.add_dependency('rdiscount', '>= 1.6.3.2')
|
33
33
|
gemspec.add_dependency('open4', '>= 1.0.1')
|
34
|
-
gemspec.add_dependency('albino', '>= 1.0')
|
35
34
|
end
|
36
35
|
rescue LoadError
|
37
36
|
puts "Jeweler not available. Install it with: gem install jeweler"
|
38
|
-
end
|
37
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6.beta
|
data/jackb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jackb}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6.beta"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Damien MATHIEU"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-17}
|
13
13
|
s.description = %q{Takes some content and parses it depending of the format your specify (HTML or Markdown)}
|
14
14
|
s.email = %q{42@dmathieu.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,7 +17,9 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".gitignore",
|
20
|
+
".rvmrc",
|
20
21
|
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
21
23
|
"README.md",
|
22
24
|
"Rakefile",
|
23
25
|
"VERSION",
|
@@ -35,13 +37,13 @@ Gem::Specification.new do |s|
|
|
35
37
|
s.homepage = %q{http://github.com/dmathieu/jackb}
|
36
38
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
39
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
39
41
|
s.summary = %q{Is your content in HTML or Markdown ?}
|
40
42
|
s.test_files = [
|
41
|
-
"spec/lib/
|
42
|
-
"spec/lib/html_spec.rb",
|
43
|
-
"spec/lib/jackb_spec.rb",
|
43
|
+
"spec/lib/jackb_spec.rb",
|
44
44
|
"spec/lib/markdown_spec.rb",
|
45
|
+
"spec/lib/html_spec.rb",
|
46
|
+
"spec/lib/highlight_spec.rb",
|
45
47
|
"spec/spec_helper.rb"
|
46
48
|
]
|
47
49
|
|
@@ -49,19 +51,16 @@ Gem::Specification.new do |s|
|
|
49
51
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
52
|
s.specification_version = 3
|
51
53
|
|
52
|
-
if Gem::Version.new(Gem::
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
55
|
s.add_runtime_dependency(%q<rdiscount>, [">= 1.6.3.2"])
|
54
56
|
s.add_runtime_dependency(%q<open4>, [">= 1.0.1"])
|
55
|
-
s.add_runtime_dependency(%q<albino>, [">= 1.0"])
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<rdiscount>, [">= 1.6.3.2"])
|
58
59
|
s.add_dependency(%q<open4>, [">= 1.0.1"])
|
59
|
-
s.add_dependency(%q<albino>, [">= 1.0"])
|
60
60
|
end
|
61
61
|
else
|
62
62
|
s.add_dependency(%q<rdiscount>, [">= 1.6.3.2"])
|
63
63
|
s.add_dependency(%q<open4>, [">= 1.0.1"])
|
64
|
-
s.add_dependency(%q<albino>, [">= 1.0"])
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
data/lib/jackb/highlight.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
module Jackb
|
4
5
|
|
@@ -9,7 +10,11 @@ module Jackb
|
|
9
10
|
|
10
11
|
def render(content)
|
11
12
|
content.gsub(highlight_regex) do |s|
|
12
|
-
|
13
|
+
code, lang = unescape($2), extract_lang($1)
|
14
|
+
Net::HTTP.post_form(
|
15
|
+
URI.parse('http://pygments.appspot.com/'),
|
16
|
+
{:lang => lang, :code => code}
|
17
|
+
).body
|
13
18
|
end
|
14
19
|
end
|
15
20
|
|
@@ -30,4 +35,4 @@ module Jackb
|
|
30
35
|
/<pre><code([^<>]*)>(.*?)<\/code><\/pre>/im
|
31
36
|
end
|
32
37
|
end
|
33
|
-
end
|
38
|
+
end
|
data/spec/lib/highlight_spec.rb
CHANGED
@@ -3,11 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe Jackb::Highlight do
|
4
4
|
describe 'code highlighting' do
|
5
5
|
it 'should highlight the code' do
|
6
|
-
Jackb::Highlight.render('<pre><code><%= "test" %></code></pre>').should eql(Albino.new('<%= "test" %>', :ruby).to_s)
|
6
|
+
Jackb::Highlight.render('<pre><code><%= "test" %></code></pre>').should eql(Albino.new('<%= "test" %>', :ruby).to_s + "\n")
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should highlight the code in an other language' do
|
10
|
-
Jackb::Highlight.render('<pre><code language="python"><%= "test" %></code></pre>').should eql(Albino.new('<%= "test" %>', :python).to_s)
|
10
|
+
Jackb::Highlight.render('<pre><code language="python"><%= "test" %></code></pre>').should eql(Albino.new('<%= "test" %>', :python).to_s + "\n")
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'unescape' do
|
@@ -33,4 +33,4 @@ describe Jackb::Highlight do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
data/spec/lib/html_spec.rb
CHANGED
@@ -8,16 +8,16 @@ describe Jackb::Html do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should highlight the code' do
|
11
|
-
Jackb::Html.new('[code language="ruby"]<%= "test" %>[/code]').render.should eql(Albino.new('<%= "test" %>', :ruby).to_s)
|
11
|
+
Jackb::Html.new('[code language="ruby"]<%= "test" %>[/code]').render.should eql(Albino.new('<%= "test" %>', :ruby).to_s + "\n")
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should highlight multiple codes' do
|
15
15
|
Jackb::Html.new('Some Text. [code language="ruby"]<%= "test" %>[/code]; some other text. [code language="python"]<%= "testing" %>[/code]').
|
16
|
-
render.should eql("Some Text. #{Albino.new('<%= "test" %>', :ruby).to_s}; some other text. #{Albino.new('<%= "testing" %>', :python).to_s}")
|
16
|
+
render.should eql("Some Text. #{Albino.new('<%= "test" %>', :ruby).to_s}\n; some other text. #{Albino.new('<%= "testing" %>', :python).to_s}\n")
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should highlight multiple codes with new lines' do
|
20
20
|
Jackb::Html.new("Some Text. [code language='ruby']<%= 'test' %>\n\n<%= 'second' %>[/code]; some other text. [code language='python']<%= 'testing' %>[/code]").
|
21
|
-
render.should eql("Some Text. #{Albino.new("<%= 'test' %>\n\n<%= 'second' %>", :ruby).to_s}; some other text. #{Albino.new("<%= 'testing' %>", :python).to_s}")
|
21
|
+
render.should eql("Some Text. #{Albino.new("<%= 'test' %>\n\n<%= 'second' %>", :ruby).to_s}\n; some other text. #{Albino.new("<%= 'testing' %>", :python).to_s}\n")
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
data/spec/lib/markdown_spec.rb
CHANGED
@@ -9,6 +9,6 @@ describe Jackb::Markdown do
|
|
9
9
|
|
10
10
|
it 'should highlight the code' do
|
11
11
|
Jackb::Markdown.new("Hey!\n\n <%= \"test\" %>").render.
|
12
|
-
should eql("<p>Hey!</p>\n\n#{Albino.new('<%= "test" %>', :ruby).to_s}\n")
|
12
|
+
should eql("<p>Hey!</p>\n\n#{Albino.new('<%= "test" %>', :ruby).to_s}\n\n")
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31098201
|
5
|
+
prerelease: true
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
|
9
|
+
- 6
|
10
|
+
- beta
|
11
|
+
version: 0.0.6.beta
|
10
12
|
platform: ruby
|
11
13
|
authors:
|
12
14
|
- Damien MATHIEU
|
@@ -14,14 +16,17 @@ autorequire:
|
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date: 2010-
|
19
|
+
date: 2010-08-17 00:00:00 +02:00
|
18
20
|
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
23
|
+
prerelease: false
|
21
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
22
26
|
requirements:
|
23
27
|
- - ">="
|
24
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 103
|
25
30
|
segments:
|
26
31
|
- 1
|
27
32
|
- 6
|
@@ -30,13 +35,15 @@ dependencies:
|
|
30
35
|
version: 1.6.3.2
|
31
36
|
name: rdiscount
|
32
37
|
requirement: *id001
|
33
|
-
prerelease: false
|
34
38
|
type: :runtime
|
35
39
|
- !ruby/object:Gem::Dependency
|
40
|
+
prerelease: false
|
36
41
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
37
43
|
requirements:
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 21
|
40
47
|
segments:
|
41
48
|
- 1
|
42
49
|
- 0
|
@@ -44,20 +51,6 @@ dependencies:
|
|
44
51
|
version: 1.0.1
|
45
52
|
name: open4
|
46
53
|
requirement: *id002
|
47
|
-
prerelease: false
|
48
|
-
type: :runtime
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 1
|
56
|
-
- 0
|
57
|
-
version: "1.0"
|
58
|
-
name: albino
|
59
|
-
requirement: *id003
|
60
|
-
prerelease: false
|
61
54
|
type: :runtime
|
62
55
|
description: Takes some content and parses it depending of the format your specify (HTML or Markdown)
|
63
56
|
email: 42@dmathieu.com
|
@@ -69,7 +62,9 @@ extra_rdoc_files:
|
|
69
62
|
- README.md
|
70
63
|
files:
|
71
64
|
- .gitignore
|
65
|
+
- .rvmrc
|
72
66
|
- Gemfile
|
67
|
+
- Gemfile.lock
|
73
68
|
- README.md
|
74
69
|
- Rakefile
|
75
70
|
- VERSION
|
@@ -93,29 +88,35 @@ rdoc_options:
|
|
93
88
|
require_paths:
|
94
89
|
- lib
|
95
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
96
92
|
requirements:
|
97
93
|
- - ">="
|
98
94
|
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
99
96
|
segments:
|
100
97
|
- 0
|
101
98
|
version: "0"
|
102
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
103
101
|
requirements:
|
104
|
-
- - "
|
102
|
+
- - ">"
|
105
103
|
- !ruby/object:Gem::Version
|
104
|
+
hash: 25
|
106
105
|
segments:
|
107
|
-
-
|
108
|
-
|
106
|
+
- 1
|
107
|
+
- 3
|
108
|
+
- 1
|
109
|
+
version: 1.3.1
|
109
110
|
requirements: []
|
110
111
|
|
111
112
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.3.
|
113
|
+
rubygems_version: 1.3.7
|
113
114
|
signing_key:
|
114
115
|
specification_version: 3
|
115
116
|
summary: Is your content in HTML or Markdown ?
|
116
117
|
test_files:
|
117
|
-
- spec/lib/highlight_spec.rb
|
118
|
-
- spec/lib/html_spec.rb
|
119
118
|
- spec/lib/jackb_spec.rb
|
120
119
|
- spec/lib/markdown_spec.rb
|
120
|
+
- spec/lib/html_spec.rb
|
121
|
+
- spec/lib/highlight_spec.rb
|
121
122
|
- spec/spec_helper.rb
|