From e3bd1c88e9ad6c9d6c89a543ca72c82a289b6bd7 Mon Sep 17 00:00:00 2001 From: Patrick Crowley Date: Fri, 23 Oct 2009 08:03:25 -0700 Subject: [PATCH] refactored render_pygments to remove duplicate code --- lib/jekyll/tags/highlight.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 067a487f..93d94868 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -30,12 +30,11 @@ module Jekyll end def render_pygments(context, code) + output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) if context["content_type"] == "markdown" - return "\n" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "\n" + return "\n" + output + "\n" elsif context["content_type"] == "textile" - return "" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "" - else - return add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + return "" + output + "" end end