stupid_formatter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  This is a super-stupid gem for formatting text in a chain. You can change the chain by doing this:
4
4
 
5
- StupidFormatter.chain = [StupidFormatter::ErbWithCoderay, StupidFormatter::RDiscount]
5
+ StupidFormatter.chain = [StupidFormatter::Erb, StupidFormatter::RDiscount]
6
6
 
7
7
  Then, pass in your Markdown-markedup, erb-riddled string to StupidFormatter.result and you'll
8
- see results.
8
+ see results. A coderay helper is included for erb, see test/fixtures/erb_coderay_markdown_example.txt
9
9
 
10
10
  This is so completely alpha, you have no idea!
11
11
 
data/Rakefile CHANGED
@@ -10,6 +10,8 @@ begin
10
10
  gem.email = "christoph at olszowka dot de"
11
11
  gem.homepage = "http://github.com/colszowka/stupid_formatter"
12
12
  gem.authors = ["Christoph Olszowka"]
13
+ gem.add_dependency "rdiscount", ">= 1.5.0"
14
+ gem.add_dependency "coderay", ">= 0.9.0"
13
15
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
17
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -58,17 +58,19 @@ module StupidFormatter
58
58
  end
59
59
  end
60
60
 
61
- # Actually, this might get converted into a module that can optionally be mixed into the formatter
62
- class ErbWithCoderay < Erb
63
- def highlight(language=:ruby)
64
- code = capture { yield }
65
- @output_buffer << CodeRay.scan(code, language).div(:css => :class)
66
- end
67
- end
68
-
69
61
  class RDiscount < AbstractFormatter
70
62
  def result
71
63
  Markdown.new(input).to_html
72
64
  end
73
65
  end
66
+
67
+ module CoderayHelper
68
+ def highlight(language=:ruby)
69
+ code = capture { yield }
70
+ @output_buffer << CodeRay.scan(code, language).div(:css => :class)
71
+ end
72
+ end
74
73
  end
74
+
75
+ # Add coderay helper by default
76
+ StupidFormatter::Erb.send :include, StupidFormatter::CoderayHelper
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{stupid_formatter}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Olszowka"]
@@ -49,11 +49,17 @@ Gem::Specification.new do |s|
49
49
  s.specification_version = 3
50
50
 
51
51
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<rdiscount>, [">= 1.5.0"])
53
+ s.add_runtime_dependency(%q<coderay>, [">= 0.9.0"])
52
54
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
53
55
  else
56
+ s.add_dependency(%q<rdiscount>, [">= 1.5.0"])
57
+ s.add_dependency(%q<coderay>, [">= 0.9.0"])
54
58
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
55
59
  end
56
60
  else
61
+ s.add_dependency(%q<rdiscount>, [">= 1.5.0"])
62
+ s.add_dependency(%q<coderay>, [">= 0.9.0"])
57
63
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
58
64
  end
59
65
  end
@@ -22,9 +22,9 @@ puts "foo bar baz"
22
22
  <% end %>'
23
23
  end
24
24
 
25
- context "after piping it through a new erb with coderay formatter instance" do
25
+ context "after piping it through a new erb instance" do
26
26
  setup do
27
- @result = StupidFormatter::ErbWithCoderay.new(@text).result
27
+ @result = StupidFormatter::Erb.new(@text).result
28
28
  end
29
29
 
30
30
  should('match <div class="CodeRay">') { assert_match /\<div class="CodeRay"\>/, @result.strip.chomp }
@@ -1,13 +1,13 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestStupidFormatter < Test::Unit::TestCase
4
- context "After configuring the StupidFormatter.chain to [StupidFormatter::ErbWithCoderay, StupidFormatter::RDiscount]" do
4
+ context "After configuring the StupidFormatter.chain to [StupidFormatter::Erb, StupidFormatter::RDiscount]" do
5
5
  setup do
6
- StupidFormatter.chain = [StupidFormatter::ErbWithCoderay, StupidFormatter::RDiscount]
6
+ StupidFormatter.chain = [StupidFormatter::Erb, StupidFormatter::RDiscount]
7
7
  end
8
8
 
9
- should "return StupidFormatter::ErbWithCoderay for the first chain item" do
10
- assert_equal StupidFormatter::ErbWithCoderay, StupidFormatter.chain[0]
9
+ should "return StupidFormatter::Erb for the first chain item" do
10
+ assert_equal StupidFormatter::Erb, StupidFormatter.chain[0]
11
11
  end
12
12
 
13
13
  should "return StupidFormatter::RDiscount for the last chain item" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stupid_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
@@ -12,6 +12,26 @@ cert_chain: []
12
12
  date: 2010-02-11 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rdiscount
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.5.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: coderay
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
+ version:
15
35
  - !ruby/object:Gem::Dependency
16
36
  name: thoughtbot-shoulda
17
37
  type: :development