Ticket #50: BlueCloth-encode-code-double-escape.diff

File BlueCloth-encode-code-double-escape.diff, 0.7 kB (added by ueno, 11 months ago)
  • lib/bluecloth.rb

     
    10251025    ### Escape any characters special to HTML and encode any characters special 
    10261026    ### to Markdown in a copy of the given +str+ and return it. 
    10271027    def encode_code( str, rs ) 
    1028         str.gsub( %r{&}, '&' ). 
    1029             gsub( %r{<}, '&lt;' ). 
    1030             gsub( %r{>}, '&gt;' ). 
    1031             gsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]} 
     1028        unless filter_html 
     1029            str = str.gsub( %r{&}, '&amp;' ). 
     1030                gsub( %r{<}, '&lt;' ). 
     1031                gsub( %r{>}, '&gt;' ) 
     1032        end 
     1033        str.gsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]} 
    10321034    end 
    10331035                 
    10341036