Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 1.8.7 で //list を含む --target=html がコケる #181

Merged
merged 2 commits into from Aug 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 14 additions & 10 deletions lib/review/htmlutils.rb
Expand Up @@ -39,16 +39,20 @@ def highlight(ops)

begin
require 'pygments'
Pygments.highlight(
unescape_html(body),
:options => {
:nowrap => true,
:noclasses => true
},
:formatter => format,
:lexer => lexer)
rescue LoadError, MentosError
body
begin
Pygments.highlight(
unescape_html(body),
:options => {
:nowrap => true,
:noclasses => true
},
:formatter => format,
:lexer => lexer)
rescue MentosError
body
end
rescue LoadError
body
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions test/test_htmlbuilder.rb
Expand Up @@ -276,6 +276,14 @@ def @chapter.image(id)
assert_equal %Q|<div class="image">\n<img src="images/chap1-sampleimg.png" alt="" width="120%" />\n</div>\n|, @builder.raw_result
end

def test_list
def @chapter.list(id)
Book::ListIndex::Item.new("samplelist",1)
end
@builder.list(["test1", "test1.5", "", "test<i>2</i>"], "samplelist", "this is @<b>{test}<&>_")
assert_equal %Q|<div class="caption-code">\n<p class="caption">リスト1.1: this is <b>test</b>&lt;&amp;&gt;_</p>\n<pre class="list">test1\ntest1.5\n\ntest<i>2</i>\n</pre>\n</div>\n|, @builder.raw_result
end

def test_emlist
@builder.emlist(["lineA","lineB"])
assert_equal %Q|<div class="emlist-code">\n<pre class="emlist">lineA\nlineB\n</pre>\n</div>\n|, @builder.raw_result
Expand Down