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 CHANGED
@@ -1 +1 @@
1
- 0.0.3
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.3"
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-11}
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/jack.rb",
26
- "lib/jack/highlight.rb",
27
- "lib/jack/html.rb",
28
- "lib/jack/markdown.rb",
29
- "lib/jack/string.rb",
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/jack_spec.rb",
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/markdown_spec.rb",
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
 
@@ -1,6 +1,6 @@
1
1
  require 'albino'
2
2
 
3
- module Jack
3
+ module Jackb
4
4
 
5
5
  class Highlight
6
6
  def self.render(content)
@@ -1,5 +1,5 @@
1
- module Jack
2
- class Html < Jack::Highlight
1
+ module Jackb
2
+ class Html < Jackb::Highlight
3
3
  attr_reader :content
4
4
 
5
5
  def initialize(content)
@@ -1,7 +1,7 @@
1
1
  require 'rdiscount'
2
2
 
3
- module Jack
4
- class Markdown < Jack::Highlight
3
+ module Jackb
4
+ class Markdown < Jackb::Highlight
5
5
  attr_reader :content, :formatted_content
6
6
 
7
7
  def initialize(content)
@@ -1,4 +1,4 @@
1
- module Jack
1
+ module Jackb
2
2
  module String
3
3
  def self.included(klass)
4
4
  klass.class_eval do
@@ -37,4 +37,4 @@ module Jack
37
37
  end
38
38
  end
39
39
  end
40
- String.send(:include, Jack::String)
40
+ String.send(:include, Jackb::String)
data/lib/jackb.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'cgi'
2
+
3
+ require 'jackb/string'
4
+ require 'jackb/highlight'
5
+ require 'jackb/html'
6
+ require 'jackb/markdown'
7
+
8
+ module Jackb
9
+
10
+ def self.render(text, format = 'html')
11
+ "Jackb::#{format.camelize}".constantize.new(text).render
12
+ end
13
+ end
@@ -1,35 +1,35 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Jack::Highlight do
3
+ describe Jackb::Highlight do
4
4
  describe 'code highlighting' do
5
5
  it 'should highlight the code' do
6
- Jack::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)
7
7
  end
8
8
 
9
9
  it 'should highlight the code in an other language' do
10
- Jack::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)
11
11
  end
12
12
 
13
13
  describe 'unescape' do
14
14
  it 'should unescape the <' do
15
- Jack::Highlight.new.send(:unescape, 'hey&lt;').should eql('hey<')
15
+ Jackb::Highlight.new.send(:unescape, 'hey&lt;').should eql('hey<')
16
16
  end
17
17
  it 'should unescape the >' do
18
- Jack::Highlight.new.send(:unescape, 'hey&gt;').should eql('hey>')
18
+ Jackb::Highlight.new.send(:unescape, 'hey&gt;').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
- Jack::Highlight.new.send(:extract_lang, ' language="python"').should eql(:python)
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
- Jack::Highlight.new.send(:extract_lang, ' lang="python"').should eql(:python)
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
- Jack::Highlight.new.send(:extract_lang, '').should eql(:ruby)
32
+ Jackb::Highlight.new.send(:extract_lang, '').should eql(:ruby)
33
33
  end
34
34
  end
35
35
  end
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Jack::Html do
3
+ describe Jackb::Html do
4
4
 
5
5
  it 'should render the content from html to html' do
6
- format = Jack::Html.new('My <strong>test</strong>')
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
- Jack::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)
12
12
  end
13
13
 
14
14
  it 'should highlight multiple codes' do
15
- Jack::Html.new('Some Text. [code language="ruby"]<%= "test" %>[/code]; some other text. [code language="python"]<%= "testing" %>[/code]').
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
- Jack::Html.new("Some Text. [code language='ruby']<%= 'test' %>\n\n<%= 'second' %>[/code]; some other text. [code language='python']<%= 'testing' %>[/code]").
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
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Jackb do
4
+
5
+ it 'should render the content using the specified format' do
6
+ Jackb.render('<strong>test</strong>', 'html').should eql('<strong>test</strong>')
7
+ end
8
+ end
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Jack::Html do
3
+ describe Jackb::Markdown do
4
4
 
5
5
  it 'should render the content from markdown to html' do
6
- format = Jack::Markdown.new('My **test**')
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
- Jack::Markdown.new("Hey!\n\n <%= \"test\" %>").render.
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/jack'
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
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-11 00:00:00 +02:00
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/jack.rb
85
- - lib/jack/highlight.rb
86
- - lib/jack/html.rb
87
- - lib/jack/markdown.rb
88
- - lib/jack/string.rb
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/jack_spec.rb
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
@@ -1,13 +0,0 @@
1
- require 'cgi'
2
-
3
- require 'jack/string'
4
- require 'jack/highlight'
5
- require 'jack/html'
6
- require 'jack/markdown'
7
-
8
- module Jack
9
-
10
- def self.render(text, format = 'html')
11
- "Jack::#{format.camelize}".constantize.new(text).render
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Jack do
4
-
5
- it 'should render the content using the specified format' do
6
- Jack.render('<strong>test</strong>', 'html').should eql('<strong>test</strong>')
7
- end
8
- end