Permalink
Browse files

code highlight should support utf-8 character.

  • Loading branch information...
1 parent 5163f11 commit db1db75b4ef9ec77ba5658e3be3e639f22d8aa1a @saberma committed Jan 6, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/gollum/markup.rb
  2. +6 −0 test/test_markup.rb
View
@@ -390,7 +390,7 @@ def process_code(data)
end
highlighted = begin
- blocks.map { |lang, code| Pygments.highlight(code, :lexer => lang) }
+ blocks.map { |lang, code| Pygments.highlight(code, :lexer => lang, :options => {:encoding => 'utf-8'}) }
rescue ::RubyPython::PythonError
[]
end
View
@@ -441,6 +441,12 @@
end
end
+ test "code blocks with utf-8 character" do
+ content = "```html\n恭喜发财\n```"
+ output = "<divclass=\"highlight\"><pre>恭喜发财</pre></div>"
@vxsx

vxsx Mar 23, 2012

There is a space missing.

+ compare(content, output)
+ end
+
def assert_markup_highlights_code(markup_class, rendered)
assert_match /div class="highlight"/, rendered, "#{markup_class} doesn't highlight code\n #{rendered}"
assert_match /span class="n"/, rendered, "#{markup_class} doesn't highlight code\n #{rendered}"

0 comments on commit db1db75

Please sign in to comment.