Feature #3359 » formatter.rb.diff
| 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
|
||
- « Previous
- 1
- 2
- 3
- 4
- Next »