Changeset 128

Show
Ignore:
Timestamp:
05/19/2006 15:52:10 (2 years ago)
Author:
cardmagic
Message:

Fixing hardbreaks

Location:
trunk
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/redcloth/base.rb

    r124 r128  
    392392 
    393393    def hard_break( text ) 
    394         text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks 
     394        text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks 
    395395    end 
    396396 
  • trunk/run-tests.rb

    r97 r128  
    1111    errors = [] 
    1212    tests = 0 
     13    options = (testfile =~ /hardbreaks/) ? [:hard_breaks] : [] 
     14     
    1315    print File.basename(testfile)+":\n\t" 
    1416    YAML::load_documents( File.open( testfile ) ) do |doc| 
    1517        if doc['in'] and doc['out'] 
    1618            tests += 1 
    17             red = RedCloth.new( doc['in'] ) 
     19            red = RedCloth.new( doc['in'], options ) 
    1820            html = if testfile =~ /markdown/ 
    1921                       red.to_html( :markdown ) 
    2022                   elsif testfile =~ /docbook/ 
    2123                                                                                         red.to_docbook 
     24                   elsif testfile =~ /textile/ 
     25                       red.to_html( :textile ) 
    2226                   else 
    2327                       red.to_html