jackb 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/jackb.gemspec +10 -10
- data/lib/{jack → jackb}/highlight.rb +1 -1
- data/lib/{jack → jackb}/html.rb +2 -2
- data/lib/{jack → jackb}/markdown.rb +2 -2
- data/lib/{jack → jackb}/string.rb +2 -2
- data/lib/jackb.rb +13 -0
- data/spec/lib/highlight_spec.rb +8 -8
- data/spec/lib/html_spec.rb +5 -5
- data/spec/lib/jackb_spec.rb +8 -0
- data/spec/lib/markdown_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +11 -11
- data/lib/jack.rb +0 -13
- data/spec/lib/jack_spec.rb +0 -8
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
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.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Damien MATHIEU"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-18}
|
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 = [
|
@@ -22,14 +22,14 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Rakefile",
|
23
23
|
"VERSION",
|
24
24
|
"jackb.gemspec",
|
25
|
-
"lib/
|
26
|
-
"lib/
|
27
|
-
"lib/
|
28
|
-
"lib/
|
29
|
-
"lib/
|
25
|
+
"lib/jackb.rb",
|
26
|
+
"lib/jackb/highlight.rb",
|
27
|
+
"lib/jackb/html.rb",
|
28
|
+
"lib/jackb/markdown.rb",
|
29
|
+
"lib/jackb/string.rb",
|
30
30
|
"spec/lib/highlight_spec.rb",
|
31
31
|
"spec/lib/html_spec.rb",
|
32
|
-
"spec/lib/
|
32
|
+
"spec/lib/jackb_spec.rb",
|
33
33
|
"spec/lib/markdown_spec.rb",
|
34
34
|
"spec/lib/string_spec.rb",
|
35
35
|
"spec/spec_helper.rb"
|
@@ -40,11 +40,11 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.rubygems_version = %q{1.3.7}
|
41
41
|
s.summary = %q{Is your content in HTML or Markdown ?}
|
42
42
|
s.test_files = [
|
43
|
-
"spec/lib/
|
43
|
+
"spec/lib/jackb_spec.rb",
|
44
|
+
"spec/lib/markdown_spec.rb",
|
44
45
|
"spec/lib/html_spec.rb",
|
45
46
|
"spec/lib/highlight_spec.rb",
|
46
47
|
"spec/lib/string_spec.rb",
|
47
|
-
"spec/lib/jack_spec.rb",
|
48
48
|
"spec/spec_helper.rb"
|
49
49
|
]
|
50
50
|
|
data/lib/{jack → jackb}/html.rb
RENAMED
data/lib/jackb.rb
ADDED
data/spec/lib/highlight_spec.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Jackb::Highlight do
|
4
4
|
describe 'code highlighting' do
|
5
5
|
it 'should highlight the code' do
|
6
|
-
|
6
|
+
Jackb::Highlight.render('<pre><code><%= "test" %></code></pre>').should eql(Albino.new('<%= "test" %>', :ruby).to_s)
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should highlight the code in an other language' do
|
10
|
-
|
10
|
+
Jackb::Highlight.render('<pre><code language="python"><%= "test" %></code></pre>').should eql(Albino.new('<%= "test" %>', :python).to_s)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'unescape' do
|
14
14
|
it 'should unescape the <' do
|
15
|
-
|
15
|
+
Jackb::Highlight.new.send(:unescape, 'hey<').should eql('hey<')
|
16
16
|
end
|
17
17
|
it 'should unescape the >' do
|
18
|
-
|
18
|
+
Jackb::Highlight.new.send(:unescape, 'hey>').should eql('hey>')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'extract_lang' do
|
23
23
|
it 'should extract a language' do
|
24
|
-
|
24
|
+
Jackb::Highlight.new.send(:extract_lang, ' language="python"').should eql(:python)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should extract a language with short lang attribute' do
|
28
|
-
|
28
|
+
Jackb::Highlight.new.send(:extract_lang, ' lang="python"').should eql(:python)
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should get the default language' do
|
32
|
-
|
32
|
+
Jackb::Highlight.new.send(:extract_lang, '').should eql(:ruby)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/spec/lib/html_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Jackb::Html do
|
4
4
|
|
5
5
|
it 'should render the content from html to html' do
|
6
|
-
format =
|
6
|
+
format = Jackb::Html.new('My <strong>test</strong>')
|
7
7
|
format.render.should eql('My <strong>test</strong>')
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should highlight the code' do
|
11
|
-
|
11
|
+
Jackb::Html.new('[code language="ruby"]<%= "test" %>[/code]').render.should eql(Albino.new('<%= "test" %>', :ruby).to_s)
|
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
16
|
render.should eql("Some Text. #{Albino.new('<%= "test" %>', :ruby).to_s}; some other text. #{Albino.new('<%= "testing" %>', :python).to_s}")
|
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
21
|
render.should eql("Some Text. #{Albino.new("<%= 'test' %>\n\n<%= 'second' %>", :ruby).to_s}; some other text. #{Albino.new("<%= 'testing' %>", :python).to_s}")
|
22
22
|
end
|
23
23
|
end
|
data/spec/lib/markdown_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Jackb::Markdown do
|
4
4
|
|
5
5
|
it 'should render the content from markdown to html' do
|
6
|
-
format =
|
6
|
+
format = Jackb::Markdown.new('My **test**')
|
7
7
|
format.render.should eql("<p>My <strong>test</strong></p>\n")
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should highlight the code' do
|
11
|
-
|
11
|
+
Jackb::Markdown.new("Hey!\n\n <%= \"test\" %>").render.
|
12
12
|
should eql("<p>Hey!</p>\n\n#{Albino.new('<%= "test" %>', :ruby).to_s}\n")
|
13
13
|
end
|
14
14
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'lib/
|
1
|
+
require 'lib/jackb'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Damien MATHIEU
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-18 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -81,14 +81,14 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- VERSION
|
83
83
|
- jackb.gemspec
|
84
|
-
- lib/
|
85
|
-
- lib/
|
86
|
-
- lib/
|
87
|
-
- lib/
|
88
|
-
- lib/
|
84
|
+
- lib/jackb.rb
|
85
|
+
- lib/jackb/highlight.rb
|
86
|
+
- lib/jackb/html.rb
|
87
|
+
- lib/jackb/markdown.rb
|
88
|
+
- lib/jackb/string.rb
|
89
89
|
- spec/lib/highlight_spec.rb
|
90
90
|
- spec/lib/html_spec.rb
|
91
|
-
- spec/lib/
|
91
|
+
- spec/lib/jackb_spec.rb
|
92
92
|
- spec/lib/markdown_spec.rb
|
93
93
|
- spec/lib/string_spec.rb
|
94
94
|
- spec/spec_helper.rb
|
@@ -127,9 +127,9 @@ signing_key:
|
|
127
127
|
specification_version: 3
|
128
128
|
summary: Is your content in HTML or Markdown ?
|
129
129
|
test_files:
|
130
|
+
- spec/lib/jackb_spec.rb
|
130
131
|
- spec/lib/markdown_spec.rb
|
131
132
|
- spec/lib/html_spec.rb
|
132
133
|
- spec/lib/highlight_spec.rb
|
133
134
|
- spec/lib/string_spec.rb
|
134
|
-
- spec/lib/jack_spec.rb
|
135
135
|
- spec/spec_helper.rb
|
data/lib/jack.rb
DELETED