flannel 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
 - data/flannel.gemspec +1 -1
 - data/lib/flannel/feed_parser.rb +1 -1
 - data/lib/flannel/html_formatter.rb +11 -1
 - data/lib/flannel/text_block.rb +7 -0
 - data/test/block_cutter_test.rb +8 -1
 - data/test/feed_parser_test.rb +1 -1
 - data/test/html_formatter_test.rb +7 -0
 - metadata +1 -1
 
    
        data/VERSION.yml
    CHANGED
    
    
    
        data/flannel.gemspec
    CHANGED
    
    
    
        data/lib/flannel/feed_parser.rb
    CHANGED
    
    
| 
         @@ -3,7 +3,17 @@ module Flannel 
     | 
|
| 
       3 
3 
     | 
    
         
             
                include Wrappable
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                def initialize
         
     | 
| 
       6 
     | 
    
         
            -
                  @tags ={:preformatted => "pre",  
     | 
| 
      
 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
         
     | 
    
        data/lib/flannel/text_block.rb
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        data/test/block_cutter_test.rb
    CHANGED
    
    | 
         @@ -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  
     | 
| 
      
 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
         
     | 
    
        data/test/feed_parser_test.rb
    CHANGED
    
    
    
        data/test/html_formatter_test.rb
    CHANGED
    
    | 
         @@ -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
         
     |