Feature #3359 » formatter.rb.diff
| lib/redmine/wiki_formatting/textile/formatter.rb (working copy) | ||
|---|---|---|
| 55 | 55 |
content = @pre_list[$1.to_i] |
| 56 | 56 |
if content.match(/<code\s+class="(\w+)">\s?(.+)/m) |
| 57 | 57 |
content = "<code class=\"#{$1} CodeRay\">" +
|
| 58 |
CodeRay.scan($2, $1.downcase).html(:escape => false, :line_numbers => :inline)
|
|
| 58 |
CodeRay.scan($2, $1.downcase).redmineHtml()
|
|
| 59 | 59 |
end |
| 60 | 60 |
content |
| 61 | 61 |
end |
| ... | ... | |
| 179 | 179 |
end |
| 180 | 180 |
end |
| 181 | 181 |
end |
| 182 |
|
|
| 183 |
# Load standart HTML Encoder |
|
| 184 |
CodeRay::Encoders::load :html |
|
| 185 |
|
|
| 186 |
# Create custom Encoder |
|
| 187 |
class RedmineHtmlEncoder < CodeRay::Encoders::HTML |
|
| 188 |
register_for :redmineHtml |
|
| 189 |
|
|
| 190 |
DEFAULT_OPTIONS = CodeRay::Encoders::HTML::DEFAULT_OPTIONS.merge \ |
|
| 191 |
:line_numbers => :inline |
|
| 192 |
|
|
| 193 |
def token text, type = :plain |
|
| 194 |
case text |
|
| 195 |
when String |
|
| 196 |
@opened[0] = type |
|
| 197 |
if text != "\n" && style = @css_style[@opened] |
|
| 198 |
@out << style << text << '</span>' |
|
| 199 |
else |
|
| 200 |
@out << text |
|
| 201 |
end |
|
| 202 |
else |
|
| 203 |
super |
|
| 204 |
end |
|
| 205 |
end |
|
| 206 |
end |
|
| 182 | 207 |
end |
| 183 | 208 |
end |
| 184 | 209 |
end |
- « Previous
- 1
- 2
- 3
- 4
- Next »