Merge commit 'e3bd1c88e9ad6c9d6c89a543ca72c82a289b6bd7'

This commit is contained in:
Tom Preston-Werner 2010-01-08 18:19:36 -08:00
commit 8d4b96084a
2 changed files with 12 additions and 6 deletions

View File

@ -30,12 +30,11 @@ module Jekyll
end end
def render_pygments(context, code) def render_pygments(context, code)
output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang)
if context["content_type"] == "markdown" if context["content_type"] == "markdown"
return "\n" + Albino.new(code, @lang).to_s(@options) + "\n" return "\n" + output + "\n"
elsif context["content_type"] == "textile" elsif context["content_type"] == "textile"
return "<notextile>" + Albino.new(code, @lang).to_s(@options) + "</notextile>" return "<notextile>" + output + "</notextile>"
else
return Albino.new(code, @lang).to_s(@options)
end end
end end
@ -49,6 +48,13 @@ module Jekyll
</div> </div>
HTML HTML
end end
def add_code_tags(code, lang)
# Add nested <code> tags to code blocks
code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
code = code.sub(/<\/pre>/,"</code></pre>")
end
end end
end end

View File

@ -49,7 +49,7 @@ CONTENT
end end
should "render markdown with pygments line handling" do should "render markdown with pygments line handling" do
assert_match %{<pre>test\n</pre>}, @result assert_match %{<pre><code class='text'>test\n</code></pre>}, @result
end end
end end
@ -59,7 +59,7 @@ CONTENT
end end
should "render markdown with pygments line handling" do should "render markdown with pygments line handling" do
assert_match %{<pre>Æ\n</pre>}, @result assert_match %{<pre><code class='text'>Æ\n</code></pre>}, @result
end end
end end