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
# start processor
@pre_list = []
rip_offtags text
rip_offtags(text, false)
no_textile text
escape_html_tags text
hard_break text
......
text.gsub!( CODE_RE ) do |m|
before,lang,code,after = $~[1..4]
lang = " lang=\"#{ lang }\"" if lang
rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }" )
rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }", false )
end
end
......
end
end
def rip_offtags( text )
def rip_offtags( text, escape_aftertag=true )
if text =~ /<.*>/
## strip and encode <pre> content
codepre, used_offtags = 0, {}
......
@pre_list.last << line
line = ""
else
htmlesc( aftertag, :NoQuotes ) if aftertag
htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag
line = "<redpre##{ @pre_list.length }>"
$3.match(/<#{ OFFTAGS }([^>]*)>/)
tag = $1
(2-2/2)