Project

General

Profile

Defect #1416 » redcloth3_3.0.4_escape.diff

Patch for Redcloth3 in conjunction with coderay 0.9.1 - Anthony Groyer, 2010-02-26 18:09

View differences:

redcloth3.rb.new 2010-02-17 15:17:32.000000000 +0100
293 293

  
294 294
        # start processor
295 295
        @pre_list = []
296
        rip_offtags text
296
        rip_offtags(text, false)
297 297
        no_textile text
298 298
        escape_html_tags text
299 299
        hard_break text 
......
611 611
        text.gsub!( CODE_RE ) do |m|
612 612
            before,lang,code,after = $~[1..4]
613 613
            lang = " lang=\"#{ lang }\"" if lang
614
            rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }" )
614
            rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }", false )
615 615
        end
616 616
    end
617 617

  
......
1049 1049
        end
1050 1050
    end
1051 1051

  
1052
    def rip_offtags( text )
1052
    def rip_offtags( text, escape_aftertag=true )
1053 1053
        if text =~ /<.*>/
1054 1054
            ## strip and encode <pre> content
1055 1055
            codepre, used_offtags = 0, {}
......
1063 1063
                        @pre_list.last << line
1064 1064
                        line = ""
1065 1065
                    else
1066
                        htmlesc( aftertag, :NoQuotes ) if aftertag
1066
                        htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag
1067 1067
                        line = "<redpre##{ @pre_list.length }>"
1068 1068
                        $3.match(/<#{ OFFTAGS }([^>]*)>/)
1069 1069
                        tag = $1
(2-2/2)