code highligting

This commit is contained in:
Tom Preston-Werner
2010-04-20 13:10:50 -07:00
parent af7caae80d
commit a6079f3abd
4 changed files with 178 additions and 0 deletions
+15
View File
@@ -134,6 +134,21 @@ context "Markup" do
assert_equal %{<p>a <a href="/greek/alpha.jpg">Alpha</a> b</p>\n}, output
end
test "code blocks" do
content = "a\n\n```ruby\nx = 1\n```\n\nb"
output = "<p>a</p>\n\n<p><div class=\"highlight\"><pre>" +
"<span class=\"n\">x</span> <span class=\"o\">=</span> " +
"<span class=\"mi\">1</span>\n</pre>\n</div></p>\n\n<p>b</p>\n"
index = @wiki.repo.index
index.add("Bilbo-Baggins.md", content)
index.commit("Add alpha.jpg")
page = @wiki.page("Bilbo Baggins")
rendered = Gollum::Markup.new(page).render
assert_equal output, rendered
end
def relative_image(content, output)
index = @wiki.repo.index
index.add("greek/alpha.jpg", "hi")