flannel 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 5
4
+ :patch: 6
5
5
  :build:
data/flannel.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flannel}
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jamal Hansen"]
@@ -3,7 +3,7 @@ require 'open-uri'
3
3
 
4
4
  module Flannel
5
5
  class FeedParser
6
- def initialize cache
6
+ def initialize cache=nil
7
7
  @cache = cache
8
8
  end
9
9
 
@@ -3,7 +3,17 @@ module Flannel
3
3
  include Wrappable
4
4
 
5
5
  def initialize
6
- @tags ={:preformatted => "pre", :feed => "ul", :list => "ul", :header_1 => "h1", :header_2 => "h2", :header_3 => "h3", :header_4 => "h4", :header_5 => "h5", :header_6 => "h6", :paragraph => "p"}
6
+ @tags ={:preformatted => "pre",
7
+ :feed => "ul",
8
+ :list => "ul",
9
+ :header_1 => "h1",
10
+ :header_2 => "h2",
11
+ :header_3 => "h3",
12
+ :header_4 => "h4",
13
+ :header_5 => "h5",
14
+ :header_6 => "h6",
15
+ :paragraph => "p",
16
+ :blockquote => "blockquote"}
7
17
  end
8
18
 
9
19
  def do text, style
@@ -32,6 +32,13 @@ module Flannel
32
32
 
33
33
  @style = "header_#{weight}".to_sym
34
34
  @text = text[weight..-1]
35
+ when ':'[0] #generic
36
+ match = text.match /^(:[a-z_]+)/
37
+
38
+ @style = match.captures[0][1..-1].to_sym
39
+
40
+ style_length = match.captures[0].length
41
+ @text = text[style_length..-1].strip
35
42
  else #other
36
43
  @style = :paragraph
37
44
  @text = text
@@ -40,7 +40,14 @@ class BlockCutterTest < Test::Unit::TestCase
40
40
  assert_equal "foo\n\nbar", squares[0].to_s
41
41
  end
42
42
 
43
- should "set square style to feed based on ampersand " do
43
+ should "set square style to feed based on full tag " do
44
+ markup = ":feed http://www.example.com/rss"
45
+
46
+ squares = @block_cutter.cut markup
47
+ assert_equal :feed, squares[0].style
48
+ end
49
+
50
+ should "set square style to feed based on ampersand abbrev" do
44
51
  markup = "& http://www.example.com/rss"
45
52
 
46
53
  squares = @block_cutter.cut markup
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'mocha'
3
3
 
4
- class FeedTest < Test::Unit::TestCase
4
+ class FeedParserTest < Test::Unit::TestCase
5
5
  context "wiring" do
6
6
  setup do
7
7
  @rubyyot = File.read(File.join(File.dirname(__FILE__), "..", "features", "fixtures", "rubyyot.rss"))
@@ -17,6 +17,13 @@ class HtmlFormatterTest < Test::Unit::TestCase
17
17
  assert_equal '<p>I think it <a href="cheese/tastes-good">tastes good</a>.</p>', result
18
18
  end
19
19
  end
20
+
21
+ context "blockquotes" do
22
+ should "wrap a blockquoted block in blockquotes" do
23
+ result = @formatter.do("Ruby is #1", :blockquote)
24
+ assert_equal '<blockquote>Ruby is #1</blockquote>', result
25
+ end
26
+ end
20
27
 
21
28
  context "links" do
22
29
  should "output the link" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flannel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamal Hansen