Skip to content
Snippets Groups Projects
Commit d5f6a5ed authored by Ted Nyman's avatar Ted Nyman
Browse files

Merge pull request #70 from tmm1/rstrip

Use rstrip to deal with table mode.
parents f82642a3 c7ddb4af
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -364,7 +364,8 @@ module Pygments
unless method == :lexer_name_for || method == :highlight || method == :css
res = Yajl.load(res, :symbolize_keys => true)
end
res = res[0..-2]
res = res.rstrip if res.class == String
res
end
 
# Convert a text header into JSON for easy access.
Loading
Loading
Loading
Loading
@@ -17,6 +17,18 @@ class PygmentsHighlightTest < Test::Unit::TestCase
assert_equal '<div class', code[0..9]
end
 
def test_full_html_highlight
code = P.highlight(RUBY_CODE)
assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
assert_equal "<div class=\"highlight\"><pre><span class=\"c1\">#!/usr/bin/ruby</span>\n<span class=\"nb\">puts</span> <span class=\"s1\">&#39;foo&#39;</span>\n</pre></div>", code
end
def test_full_table_highlight
code = P.highlight(RUBY_CODE, :options => {:linenos => true})
assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
assert_equal "<table class=\"highlighttable\"><tr><td class=\"linenos\"><div class=\"linenodiv\"><pre>1\n2</pre></div></td><td class=\"code\"><div class=\"highlight\"><pre><span class=\"c1\">#!/usr/bin/ruby</span>\n<span class=\"nb\">puts</span> <span class=\"s1\">&#39;foo&#39;</span>\n</pre></div>\n</td></tr></table>", code
end
def test_highlight_works_with_larger_files
code = P.highlight(REDIS_CODE)
assert_match 'used_memory_peak_human', code
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment