# File lib/gerbil/html.rb, line 90 def thru_coderay gsub %r{<(code)(.*?)>(.*?)</\1>}m do atts, code = $2, CGI.unescapeHTML($3) lang = if $2 =~ /lang=('|")(.*?)\1/i $2 else :ruby end tag = if code =~ /\n/ :pre else :code end html = CodeRay.scan(code, lang).html(:css => :style) %{<#{tag} class="code"#{atts}>#{html}</#{tag}>} end end