den 0.1.2 → 0.2.0
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/den.gemspec +1 -1
- data/lib/den.rb +2 -2
- data/lib/den/resource.rb +6 -3
- metadata +1 -1
    
        data/den.gemspec
    CHANGED
    
    
    
        data/lib/den.rb
    CHANGED
    
    | @@ -113,13 +113,13 @@ class Den | |
| 113 113 | 
             
                  elsif type == 'post'
         | 
| 114 114 | 
             
                    file = File.join('posts', 'new', 'new.post')
         | 
| 115 115 | 
             
                    system("/usr/bin/editor #{file}")
         | 
| 116 | 
            -
                    gather_new_posts
         | 
| 117 116 | 
             
                  end
         | 
| 118 117 |  | 
| 119 118 | 
             
                  if File.exists?(file)
         | 
| 119 | 
            +
                    gather_new_posts
         | 
| 120 120 | 
             
                    puts "Added a #{type}."
         | 
| 121 121 | 
             
                  else
         | 
| 122 | 
            -
                    puts " | 
| 122 | 
            +
                    puts "Canceled adding a #{type}."
         | 
| 123 123 | 
             
                  end
         | 
| 124 124 |  | 
| 125 125 | 
             
                else
         | 
    
        data/lib/den/resource.rb
    CHANGED
    
    | @@ -33,7 +33,7 @@ class Resource | |
| 33 33 | 
             
                # Remove duplicate newlines
         | 
| 34 34 | 
             
                s.gsub!(/\n\n+/, "\n\n")
         | 
| 35 35 |  | 
| 36 | 
            -
                # Remove leading  | 
| 36 | 
            +
                # Remove leading spaces from lines
         | 
| 37 37 | 
             
                s.gsub!(/^ +/, "")
         | 
| 38 38 |  | 
| 39 39 | 
             
                # Pad string to remove edge cases
         | 
| @@ -45,12 +45,15 @@ class Resource | |
| 45 45 | 
             
                  "<h#{len+1} class=\"header\">#$2</h#{len+1}>"
         | 
| 46 46 | 
             
                }
         | 
| 47 47 |  | 
| 48 | 
            +
                # Code (leaving placeholder pre tags)
         | 
| 49 | 
            +
                s.gsub!(/^\t(.*)$/, "<pre>\\1</pre>")
         | 
| 50 | 
            +
             | 
| 48 51 | 
             
                # Paragraphs
         | 
| 49 52 | 
             
                s.gsub!(/(\A|\n)\n([^<])/, "\n\n<p>\\2")
         | 
| 50 53 | 
             
                s.gsub!(/([^>])\n\n/, "\\1</p>\n\n")
         | 
| 51 54 |  | 
| 52 | 
            -
                # Remove  | 
| 53 | 
            -
                s.gsub!( | 
| 55 | 
            +
                # Remove placeholder pre tags
         | 
| 56 | 
            +
                s.gsub!(/<\/pre>\n<pre>/, "\n")
         | 
| 54 57 |  | 
| 55 58 | 
             
                {:title => title, :body => s}
         | 
| 56 59 | 
             
              end
         |