Skip to content

Commit

Permalink
Redmine style syntax highlighting: <pre><code class="LANG">
Browse files Browse the repository at this point in the history
(merged from asai/redmine_markdown_extra_formatter)
  • Loading branch information
Junya Ogura committed Jun 30, 2010
1 parent 7c52aa1 commit 3f02db6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/redmine_markdown_extra_formatter/wiki_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def inline_macros(text)
text
end

PreCodeClassBlockRegexp = %r{^<pre><code\s+class="(\w+)">\s*\n(.+?)</code></pre>\n}m
PreCodeClassBlockRegexp = %r{^<pre><code\s+class="(\w+)">\s*\n(.+?)</code></pre>}m

def syntax_highlight( str )
str.gsub( PreCodeClassBlockRegexp ) {|block|
def syntax_highlight(str)
str.gsub(PreCodeClassBlockRegexp) {|block|
syntax = $1.downcase
"<pre><code class=\"#{syntax.downcase} CodeRay\">" +
CodeRay.scan($2, syntax).html(:escape => true, :line_numbers => nil) +
Expand Down

0 comments on commit 3f02db6

Please sign in to comment.