Project

General

Profile

Feature #3359 » formatter.rb.diff

Formatter path from r3076 (CoreRay 0.9.0 support) - Aleksej Lebedev, 2009-11-23 08:11

View differences:

lib/redmine/wiki_formatting/textile/formatter.rb (working copy)
content = @pre_list[$1.to_i]
if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
content = "<code class=\"#{$1} CodeRay\">" +
CodeRay.scan($2, $1.downcase).html(:escape => false, :line_numbers => :inline)
CodeRay.scan($2, $1.downcase).redmineHtml()
end
content
end
......
end
end
end
# Load standart HTML Encoder
CodeRay::Encoders::load :html
# Create custom Encoder
class RedmineHtmlEncoder < CodeRay::Encoders::HTML
register_for :redmineHtml
DEFAULT_OPTIONS = CodeRay::Encoders::HTML::DEFAULT_OPTIONS.merge \
:line_numbers => :inline
def token text, type = :plain
case text
when String
@opened[0] = type
if text != "\n" && style = @css_style[@opened]
@out << style << text << '</span>'
else
@out << text
end
else
super
end
end
end
end
end
end
(4-4/4)